@media (max-width: 768px) {
        html, body { overflow: auto !important; height: auto !important; }

        .container {
            height: auto !important;
            overflow: visible !important;
            gap: 0.45rem !important;
            padding-top: 0.5rem !important;
            padding-bottom: 0.75rem !important;
        }

        .breadcrumb { font-size: 0.72rem; margin-bottom: 0.1rem; }

        .bracket-page-layout {
            display: flex !important;
            flex-direction: column !important;
            gap: 0.45rem !important;
            overflow: visible !important;
        }

        /* On mobile the sidebar becomes display:contents so its children
           participate directly in the bracket-page-layout flex column.
           This lets us use `order` to move the predict card below the bracket
           without duplicating HTML or touching JS. */
        .sidebar {
            display: contents !important;
        }

        /* Restore gap between sidebar children by treating them as direct flex items */
        .hero-card,
        .filter-card:not(.predict-card),
        .predict-card {
            margin-bottom: 0.45rem;
            width: 100% !important;
            box-sizing: border-box !important;
            align-self: stretch !important;
        }

        /* Stack order: hero → filter → bracket → predict */
        .hero-card                      { order: 1; }
        .filter-card:not(.predict-card) { order: 2; }
        .bracket-wrap                   { order: 3; }
        .predict-card                   { order: 4; }

        /* Predict card on mobile: natural height, no flex overflow clipping */
        .predict-card {
            flex: none !important;
            min-height: 0 !important;
            height: auto !important;
            overflow: visible !important;
            display: flex !important;
        }
        .predict-card .filter-body {
            flex: none !important;
            overflow: visible !important;
            display: flex !important;
            flex-direction: column !important;
        }
        /* Predict card filter-groups: stack label + content vertically,
           not the horizontal row layout used by the filters card */
        .predict-card .filter-group {
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 0.35rem !important;
            overflow: visible !important;
        }
        .predict-card .filter-group:last-child {
            flex: none !important;
            overflow: visible !important;
        }
        /* Predict input: 16px prevents iOS auto-zoom on focus */
        .predict-search-input {
            font-size: 16px !important;
        }
        /* Suggestions: position absolute relative to search-wrap on mobile */
        .predict-suggestions {
            position: absolute !important;
            top: 100% !important;
            left: 0 !important;
            right: 0 !important;
            width: auto !important;
            margin-top: 3px;
        }
        .predict-search-wrap {
            width: 100% !important;
        }
        .predict-results {
            overflow: visible !important;
            max-height: none !important;
            flex: none !important;
        }

        /* ── Hero: slim horizontal banner ── */
        .hero-card {
            flex-direction: row !important;
            justify-content: flex-start !important;
            align-items: center !important;
            gap: 0.6rem !important;
            padding: 0.6rem 0.75rem !important;
            border-radius: 10px !important;
            text-align: left !important;
        }
        .hero-icon { font-size: 1.5rem !important; line-height: 1 !important; flex-shrink: 0 !important; }
        .hero-title { font-size: 1.1rem !important; }
        .hero-sub { font-size: 0.62rem !important; text-align: right !important; margin-left: auto !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

        /* ── Filter card ── */
        .filter-card { border-radius: 10px !important; }
        .filter-header { padding: 0.35rem 0.6rem !important; font-size: 0.65rem !important; border-radius: 8px 8px 0 0 !important; }
        .filter-body { padding: 0.4rem 0.6rem !important; gap: 0.35rem !important; flex-direction: column !important; }
        .filter-group { flex-direction: row !important; align-items: center !important; gap: 0.3rem !important; flex-wrap: wrap !important; }
        .filter-label { font-size: 0.55rem !important; white-space: nowrap !important; }
        .tab-btn { padding: 0.25rem 0.5rem !important; font-size: 0.68rem !important; }

        /* ── Bracket: height set once by JS via --bracket-h, stable after that ── */
        .bracket-wrap {
            height: var(--bracket-h, calc(100dvh - 260px)) !important;
            min-height: 300px !important;
            border-radius: 10px !important;
            overflow: hidden !important;
        }

        /* Scroll area: free scroll in both axes, contained, no bleed */
        .bracket-outer {
            overflow: auto !important;
            overscroll-behavior: contain !important;
        }

        /* Toolbar: two rows — title+zoom on row 1, search on row 2 */
        .bracket-toolbar {
            padding: 0.35rem 0.6rem !important;
            gap: 0.3rem !important;
            flex-wrap: wrap !important;
            align-items: center !important;
        }
        .bracket-toolbar-title { font-size: 0.65rem !important; }
        .zoom-btn {
            padding: 0.15rem 0.45rem !important;
            font-size: 0.85rem !important;
            touch-action: manipulation !important;
        }
        #zoomLabel { font-size: 0.65rem !important; min-width: 30px !important; }
        /* Search goes on its own row */
        #fsSearchWrap { width: 100% !important; order: 10 !important; margin-right: 0 !important; }
        #fsSearchWrap .team-search-input { font-size: 16px !important; }
        #searchClearBtn { font-size: 1.2rem !important; padding: 0.2rem 0.4rem !important; }
        #fsBtn { display: none !important; }
        /* Mobile expand button */
        #mobileFsBtn { display: inline-flex !important; }
        /* When mobile-expanded: hide everything except bracket */
        body.mobile-expanded,
        body.mobile-expanded html { overflow: hidden !important; }
        body.mobile-expanded .sidebar,
        body.mobile-expanded .breadcrumb { display: none !important; }
        body.mobile-expanded .bracket-page-layout { gap: 0 !important; }
        body.mobile-expanded .bracket-wrap {
            height: 100dvh !important;
            width: 100vw !important;
            border-radius: 0 !important;
            position: fixed !important;
            inset: 0 !important;
            z-index: 999 !important;
            min-height: unset !important;
            overflow: hidden !important;
        }

        /* Disable double-tap zoom on bracket area */
        .bracket-outer { touch-action: pan-x pan-y !important; }
        /* Lock all scroll while modal is open (position:fixed needed for iOS Safari) */
        html.modal-open-root { overflow: hidden !important; touch-action: none !important; }
        body.modal-open { overflow: hidden !important; position: fixed; width: 100%; }
        body.modal-open .bracket-outer { overflow: hidden !important; touch-action: none !important; }
        #bracketScroll { min-width: max-content; }

        /* ── Mobile modal: h2h-style cards ── */
        .modal-overlay {
            padding: 0.6rem !important;
            align-items: center !important;
            background: rgba(0,0,0,0.8) !important;
            z-index: 1100 !important;
        }
        .modal {
            max-width: 100% !important;
            width: 100% !important;
            max-height: 92dvh !important;
            border-radius: 14px !important;
            border: 2px solid rgba(var(--primary-rgb), 0.3) !important;
            box-shadow: 0 8px 40px rgba(0,0,0,0.7) !important;
        }
        .modal::before { display: none !important; }
        .modal-fixed-header { padding: 0.45rem 0.5rem 0 !important; position: relative !important; }
        .modal-title { font-size: 0.72rem !important; margin-bottom: 0.08rem !important; padding-right: 1.8rem !important; }
        .close-btn { float: none !important; position: absolute !important; top: 0.45rem !important; right: 0.5rem !important; }
        #modalSeriesHeader { padding-bottom: 0.25rem !important; }
        #modalBody { padding: 0.3rem 0.5rem 0.75rem !important; }

        /* Series header: tight 3-col */
        .ms-header { gap: 0.2rem !important; }
        .ms-header-left, .ms-header-right { gap: 0.25rem !important; }
        .ms-logo { width: 40px !important; height: 40px !important; }
        .ms-name { font-size: 0.65rem !important; }
        .ms-score { font-size: 1.2rem !important; gap: 0.1rem !important; }
        .ms-score-centre { padding: 0 0.1rem !important; }
        .ms-share-btn { font-size: 0.55rem !important; padding: 0.15rem 0.35rem !important; letter-spacing: 0 !important; }
        .ms-dots { gap: 2px !important; }
        .game-dot { width: 5px !important; height: 5px !important; }

        /* Set label */
        .match-section-label { font-size: 0.65rem !important; margin-top: 0.4rem !important; margin-bottom: 0.2rem !important; }

        /* Set tabs */
        .set-tabs { padding: 0.2rem 0.35rem 0 !important; gap: 0.15rem !important; }
        .set-tab-btn { padding: 0.15rem 0.4rem !important; font-size: 0.6rem !important; margin-bottom: 0.2rem !important; }

        /* ── Hide the complex overview/stats tables entirely on mobile ──
           Replaced by the clean per-game h2h-style cards below            */
        .series-overview { display: none !important; }
        .series-stats-panel { display: none !important; }
        .game-details { display: none !important; }

        /* ── Per-game cards: h2h style ── */
        .game-card {
            margin-bottom: 0.3rem !important;
            border-radius: 8px !important;
            border: 1px solid rgba(255,255,255,0.07) !important;
        }

        /* Score row: [logo · score] [mode · map] [score · logo] */
        .match-header {
            display: grid !important;
            grid-template-columns: 1fr auto 1fr !important;
            padding: 0.3rem 0.5rem !important;
            gap: 0.15rem !important;
            border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        }
        .match-header-logo { width: 18px !important; height: 18px !important; }
        .match-header-team-score { font-size: 0.9rem !important; }
        .match-header-mode-icon { width: 14px !important; height: 14px !important; }
        .match-header-mode-name { font-size: 0.62rem !important; }
        .match-header-map-label { font-size: 0.52rem !important; }
        .match-header-time { display: none !important; }

        /* Body: left brawlers | map img | right brawlers — side by side like h2h */
        .match-body {
            display: grid !important;
            grid-template-columns: 1fr auto 1fr !important;
            align-items: center !important;
            padding: 0.35rem 0.5rem !important;
            gap: 0.3rem !important;
        }
        .match-comp { gap: 0.22rem !important; }
        .brawler-row { gap: 0.28rem !important; }
        .match-comp.right .brawler-row { flex-direction: row-reverse !important; }
        .match-comp.right .brawler-row-info { align-items: flex-end !important; }
        .comp-brawler { width: 30px !important; height: 30px !important; border-radius: 4px !important; }
        .brawler-slot-name { font-size: 0.62rem !important; max-width: 72px !important; letter-spacing: 0 !important; }
        .brawler-slot-player { font-size: 0.52rem !important; max-width: 72px !important; }
        .match-center { width: 62px !important; gap: 0.15rem !important; }
        .match-map-img { width: 58px !important; border-radius: 5px !important; }
        .match-map-name { font-size: 0.5rem !important; max-width: 58px !important; }
        .game-center-score { gap: 0.15rem !important; }
        .gcs-num { font-size: 0.9rem !important; }

        /* Bans row below body */
        .game-bans {
            padding: 0.2rem 0.5rem !important;
            gap: 0.15rem !important;
            background: rgba(0,0,0,0.12) !important;
        }
        .ban-brawler { width: 18px !important; height: 18px !important; }
        .bans-center-label { font-size: 0.46rem !important; }

        /* Hide ability grids and pick badges */
        .ability-grid { display: none !important; }
        .pick-badge { display: none !important; }

        /* ── Mobile h2h-style set cards ── */
        .mob-set-card {
            display: block !important;
            background: var(--dark);
            border: 1px solid rgba(255,255,255,0.09);
            border-radius: 10px;
            overflow: hidden;
            margin-bottom: 0.5rem;
        }
        .mob-set-card:last-child { margin-bottom: 0; }

        /* Score header row */
        .mob-set-header {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 0.5rem;
            padding: 0.65rem 0.75rem 0.55rem;
            border-bottom: 1px solid rgba(255,255,255,0.07);
            background: rgba(0,0,0,0.22);
        }
        /* [logo | name-over-score] left, [logo | name-over-score] mirrored right */
        .mob-set-team {
            display: flex; align-items: center; gap: 0.5rem; min-width: 0;
        }
        .mob-set-team--left  { flex-direction: row; justify-content: flex-start; }
        .mob-set-team--right { flex-direction: row-reverse; justify-content: flex-start; }
        .mob-set-logo { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
        .mob-set-logo-name {
            display: flex; flex-direction: column; gap: 0.08rem;
            min-width: 0; flex: 1;
        }
        .mob-set-team--right .mob-set-logo-name { align-items: flex-end; }
        .mob-team-name { display: none; }
        .mob-score { font-size: 1.6rem; font-weight: 900; line-height: 1; }
        .mob-score--win  { color: #10b981; }
        .mob-score--loss { color: rgba(255,255,255,0.28); }
        .mob-set-centre {
            display: flex; flex-direction: column; align-items: center;
            gap: 0.08rem; flex-shrink: 0; min-width: 0;
        }
        .mob-mode-row { display: flex; align-items: center; gap: 0.28rem; }
        .mob-mode-icon { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
        .mob-mode-name { font-size: 0.75rem; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
        .mob-map-name  { font-size: 0.6rem; color: rgba(255,255,255,0.38); white-space: nowrap; }
        .mob-obj-row { display: flex; align-items: center; gap: 0.2rem; }
        .mob-obj-score {
            font-size: 0.8rem; font-weight: 700; line-height: 1;
            color: rgba(255,255,255,0.5);
        }
        .mob-obj-sep { font-size: 0.65rem; color: var(--text-dim); font-weight: 400; }
        .mob-score--draw { color: rgba(255,255,255,0.45); }
        .mob-stat-line {
            font-size: clamp(0.4rem, 2.5vw, 0.5rem); color: rgba(255,255,255,0.38);
            white-space: nowrap; display: block; line-height: 1.2; min-width: 0; width: 100%;
        }

        /* Bans strip */
        .mob-bans-row {
            display: grid; grid-template-columns: 1fr auto 1fr;
            align-items: center; gap: 0.3rem;
            padding: 0.2rem 0.6rem;
            background: rgba(239,68,68,0.04);
            border-bottom: 1px solid rgba(239,68,68,0.1);
        }
        .mob-bans-side { display: flex; gap: 0.2rem; align-items: center; padding: 0 !important; padding-right: 0.75rem !important; }
        .mob-bans-side--right { justify-content: flex-end; padding: 0 !important; padding-left: 0.75rem !important; }
        .mob-ban-img {
            width: 22px; height: 22px; object-fit: contain; border-radius: 3px;
            opacity: 0.6; filter: grayscale(40%);
            border: 1px solid rgba(239,68,68,0.35); flex-shrink: 0;
        }
        .mob-bans-label {
            font-size: 0.46rem; font-weight: 800; text-transform: uppercase;
            letter-spacing: 1px; color: rgba(239,68,68,0.7);
            text-align: center; flex-shrink: 0;
        }

        /* Body: left comp | map | right comp */
        .mob-set-body {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 0.3rem;
            padding: 0.45rem 0.55rem;
        }

        /* Brawler columns — [playername | brawlerimg] [map] [brawlerimg | playername]
           Left:  [info right-aligned | img nearest map]
           Right: [img nearest map | info left-aligned]  */
        .mob-comp { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }

        /* Both rows use normal row direction; DOM order sets which side the img is on */
        .mob-brawler-row {
            display: flex; align-items: center; gap: 0.35rem; min-width: 0;
            flex-direction: row;
            justify-content: flex-end; /* left: push [info|img] to the right, near map */
        }
        .mob-brawler-row--right {
            flex-direction: row; /* right: img first, info second */
            justify-content: flex-start; /* right: push [img|info] to the left, near map */
        }
        .mob-brawler-img {
            width: 40px; height: 40px; object-fit: contain;
            border-radius: 5px; flex-shrink: 0;
        }
        .mob-brawler-info {
            display: flex; flex-direction: column; min-width: 0; gap: 0.04rem;
            align-items: flex-end; /* left: text right-aligned */
        }
        .mob-brawler-info--right {
            align-items: flex-start; /* right: text left-aligned */
        }
        /* Primary line: player name */
        .mob-brawler-name {
            font-size: 0.58rem;
            font-weight: 700; color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            display: block; min-width: 0; max-width: 80px;
        }
        /* Second line: brawler build icons */
        .mob-build-row {
            display: flex; gap: 3px; align-items: center; flex-wrap: nowrap;
        }
        .mob-build-icon {
            width: 14px; height: 14px; max-width: 14px; max-height: 14px; object-fit: contain;
            border-radius: 2px; flex-shrink: 0; display: block;
        }
        .mob-build-icon.gear { border-radius: 50%; }

        /* Center map column */
        .mob-map-col {
            display: flex; flex-direction: column; align-items: center;
            gap: 0.2rem; flex-shrink: 0; width: 72px;
        }
        .mob-map-img {
            width: 68px; height: auto; display: block;
            object-fit: contain; border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.1);
            background: rgba(0,0,0,0.4);
        }
        .mob-map-label {
            font-size: 0.5rem; color: rgba(255,255,255,0.32);
            text-align: center; white-space: nowrap;
            overflow: hidden; text-overflow: ellipsis; max-width: 68px;
        }
        .mob-game-dots { display: flex; gap: 3px; align-items: center; justify-content: center; flex-wrap: wrap; }
        /* Tag line hidden on mobile — not enough space */
        .mob-player-tag { display: none !important; }
        /* Mobile: brawler body visible, stat body hidden, bans strip shown */
        .mob-set-body   { display: grid !important; }
        .mob-stat-body  { display: none !important; }
        .mob-bans-belt { display: none !important; }
        .mob-bans-strip { display: grid !important; grid-template-columns: 1fr auto 1fr; padding: 0.2rem 0.6rem; background: rgba(239,68,68,0.04); border-bottom: 1px solid rgba(239,68,68,0.1); align-items: center; gap: 0.3rem; }
        /* Mobile bans: back to grid layout */
        .mob-bans-row {
            display: grid !important;
            grid-template-columns: 1fr auto 1fr !important;
            flex-wrap: unset !important;
            justify-content: unset !important;
            padding: 0.2rem 0.6rem !important;
        }
        .mob-bans-side { justify-content: flex-end !important; }
        .mob-bans-side--right { flex-direction: row-reverse !important; justify-content: flex-end !important; padding-left: 0.75rem !important; }
        .mob-bans-label { font-size: 0.46rem !important; }
        .mob-ban-img { width: 22px !important; height: 22px !important; }
    }
