/* Search-first discovery; card count is bounded by server pagination. */
.discovery-feed, .discovery-feed * { box-sizing: border-box; }
.discovery-feed .feed-search-bar { box-shadow: none; border-radius: 0; }
.discovery-feed .bib-chip { color: #3750a4; }
.discovery-feed .feed-search-bar.active { display: block; }
/* The race list opens over the BIB panel below it, so the panel must not win
   the paint order. Both boxes make their own stacking context — the rail group
   through backdrop-filter, the search panel through a z-index on a flex item —
   and without this the later sibling covered the open dropdown. */
.discovery-feed .feed-search-bar, .discovery-feed .feed-search-bar:focus-within { z-index: auto; }
.discovery-feed .feed-top-header { z-index: 3; }
.discovery-feed .feed-rail-group { position: relative; z-index: 3; }
.discovery-controls { grid-column: 1; grid-row: 1/4; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.discovery-feed.reels-wrapper {
    max-width: 1560px;
    width: calc(100% - 32px);
    margin: 18px auto;
    border-radius: 20px;
    background: #f6f8fb;
    display: grid;
    grid-template-columns: 260px minmax(0,1fr) 300px;
    grid-template-rows: auto minmax(0,1fr) auto;
    gap: 0 20px;
    overflow: hidden;
    height: calc(100dvh - 130px);
}
.discovery-feed .feed-top-header, .discovery-feed .feed-top-header.header-hidden {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    transform: none;
    opacity: 1;
    max-height: none;
    overflow: visible;
    background: #fff;
    border: 0;
}
.discovery-feed .feed-search-bar {
    grid-column: 1;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    width: 100%;
    max-height: none;
    border: 0;
    padding: 12px 16px 16px;
    overflow: hidden;
    min-height: 0;
}
.discovery-search-title { font-size: 20px; margin: 0 0 16px; color: #121b2b; }
.discovery-feed .feed-search-input-wrap {
    border: 1px solid #dce3ee;
    background: #f5f7fb;
    border-radius: 12px;
    padding: 8px;
}
.discovery-feed #feedSearchInput { font-size: 16px; width: 100%; min-width: 0; }
.discovery-feed .feed-search-input-wrap .text-white-50 { color: #66758c !important; }
.discovery-feed .feed-bib-tray {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 18px;
    overflow: hidden;
}
.discovery-feed #bibTrayTitle { color: #3750a4 !important; }
.discovery-feed #btnClearBibFilter {
    color: #ef4444 !important;
    font-weight: 600;
    font-size: 12px;
}
.discovery-feed #btnClearBibFilter:hover {
    color: #b91c1c !important;
    text-decoration: underline !important;
}
.discovery-feed .bib-chips-container {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    align-content: flex-start;
    padding-bottom: 12px;
}
.discovery-feed .feed-sort-tabs { gap: 4px; }
.discovery-feed .feed-sort-tab { padding: 8px 5px; font-size: 12px; }
.discovery-feed .feed-breadcrumb .fb-cat, .discovery-feed .feed-breadcrumb .fb-sep { display: none; }
.discovery-feed .fb-event { min-width: 0; }
.discovery-feed .event-selector-name { white-space: normal; text-align: left; }
.discovery-feed .event-dropdown { width: 320px; max-width: calc(100vw - 40px); z-index: 1100; }
/* The middle column is the scroller on desktop, and holds nothing but results:
   the view switch sits in the left pane with the other filters. */
.discovery-main {
    grid-column: 2;
    grid-row: 1 / 4;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.discovery-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    gap: 6px;
    padding: 4px 16px 0;
    color: #65748a;
    font-size: 13px;
}
.discovery-toolbar #discoveryResults { width: 100%; padding: 0 4px; font-size: 12px; }
.discovery-modes { display: flex; gap: 4px; padding: 4px; background: #e9eef5; border-radius: 28px; }
.discovery-toolbar .discovery-modes { width: 100%; }
.discovery-toolbar .discovery-modes button { flex: 1; padding: 8px 12px; font-size: 13px; }
.discovery-modes button, .discovery-pagination button, .discovery-guide button {
    border: 1px solid #d6deea;
    border-radius: 24px;
    padding: 10px 16px;
    background: #fff;
    color: #121b2b;
    cursor: pointer;
}
.discovery-modes button { background: transparent; border: 0; }
.discovery-modes button[aria-pressed=true] { background: #d9f23c; font-weight: 600; }
.discovery-feed .reels-feed {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    grid-auto-rows: max-content;
    align-content: start;
    gap: 16px;
    padding: 0 4px 20px 0 !important;
    scroll-snap-type: none;
    min-height: 0;
    height: auto;
    overflow: visible;
}
.discovery-feed .reel-slide {
    width: 100%;
    margin: 0;
    height: auto;
    min-height: min-content;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid #dce3ee;
    background: #fff;
}
.discovery-feed .reel-slide .reel-media-container {
    position: relative;
    inset: auto;
    height: auto;
    aspect-ratio: 4/5;
    max-height: none;
    width: 100%;
    flex-shrink: 0;
    background: #121b2b;
    cursor: pointer;
}
.discovery-feed .reel-media { object-fit: contain; }
.discovery-feed .reel-media-backdrop, .discovery-feed .reel-gradient { display: none; }
.discovery-feed .reel-slide .reel-info { position: static; padding: 12px; color: #121b2b; }
.discovery-feed .reel-info .text-white-50 { color: #64748b !important; }
.discovery-feed .reel-creator-link, .discovery-feed .reel-caption { color: #121b2b; }
.discovery-feed .reel-creator { font-size: 12px; }
.discovery-feed .reel-avatar { width: 25px; height: 25px; }
.discovery-feed .reel-slide .reel-actions {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 18px;
    padding: 10px 12px 14px;
    margin-top: auto;
}
.discovery-feed .action-btn { color: #42516a; width: auto; flex-direction: row; font-size: 12px; }
.discovery-feed .action-btn i { font-size: 18px; }
.discovery-feed .reel-pending { color: #53637b; background: #f2f5fa; padding: 8px; font-size: 12px; }
.discovery-feed .reel-pending-note { display: none; }
.discovery-feed .reel-badges { gap: 5px; }
.discovery-feed .reel-badge { font-size: 11px; background: #edf1f7; color: #42516a; }
.discovery-feed .fit-toggle-btn { display: none; }
.discovery-feed .loading-more, .discovery-feed .feed-bottom-spacer, .discovery-feed .reels-feed > .text-center { grid-column: 1/-1; }
.discovery-feed .reels-feed > .text-white { color: #42516a !important; }

/* Non-sticky pagination - lives naturally at the bottom of the card list */
.discovery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px 12px 36px;
    font-size: 13px;
    color: #64748b;
    width: 100%;
}
.discovery-feed .reels-feed .discovery-pagination {
    grid-column: 1 / -1;
}
.discovery-pagination button {
    border: 1px solid #d6deea;
    border-radius: 24px;
    padding: 8px 18px;
    background: #ffffff;
    color: #121b2b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.discovery-pagination button:hover:not(:disabled) {
    background: #D9F23C;
    color: #121B2B;
    border-color: #D9F23C;
}
.discovery-pagination button:disabled {
    opacity: 0.35;
    cursor: default;
}
.discovery-pagination #discoveryPage {
    font-weight: 700;
    color: #475569;
    font-size: 13px;
}

.discovery-guide {
    grid-column: 3;
    grid-row: 1/4;
    background: #fff;
    padding: 24px 20px;
    color: #64748b;
    overflow: auto;
}
.discovery-eyebrow { color: #3750a4; font-size: 10px; letter-spacing: 1px; }
.discovery-guide h2 { font-size: 22px; color: #121b2b; margin: 0 0 6px; font-family: var(--font-heading); font-weight: 700; }
.discovery-guide p { font-size: 13px; line-height: 1.6; }
.discovery-guide-detail { display: flex; align-items: baseline; gap: 12px; margin: 22px 0; }
.discovery-guide-detail i { color: #3750a4; }
.discovery-guide-detail strong { color: #121b2b; font-size: 14px; }
.discovery-guide button { width: 100%; border-radius: 12px; }
.discovery-guide .discovery-small { margin-top: 24px; font-size: 12px; }
.discovery-reels .reel-media-container { aspect-ratio: 9/16 !important; }

button.bottom-nav-center-btn {
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

/* Discovery Filter Bottom Sheet */
.discovery-filter-sheet {
    max-height: 85vh;
    background: #121B2B !important;
    color: #ffffff;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.discovery-filter-sheet .feed-sheet-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
}
.discovery-filter-sheet .feed-sheet-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
}
.discovery-filter-sheet .feed-sheet-body {
    padding: 16px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.filter-section {
    margin-bottom: 20px;
}
.filter-section-title {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 8px;
}
.filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0 12px;
}
.filter-input-wrap:focus-within {
    border-color: #D9F23C;
    background: rgba(255, 255, 255, 0.12);
}
.filter-input-icon {
    color: #94a3b8;
    margin-right: 8px;
}
.filter-input-wrap input {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 14px;
    padding: 10px 0;
    width: 100%;
    outline: none;
}
.filter-input-wrap input::placeholder {
    color: #64748b;
}
.filter-input-clear {
    background: transparent;
    border: 0;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}
.modal-sort-pills, .modal-mode-pills {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    padding: 4px;
    border-radius: 28px;
}
.modal-sort-pill, .modal-mode-pill {
    flex: 1;
    text-align: center;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal-sort-pill.active, .modal-mode-pill.active {
    background: #D9F23C !important;
    color: #121B2B !important;
    font-weight: 700;
}
.modal-event-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}
.modal-event-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.modal-event-item:hover {
    background: rgba(255, 255, 255, 0.1);
}
.modal-event-item.selected {
    background: rgba(217, 242, 60, 0.14);
    border-color: rgba(217, 242, 60, 0.4);
    color: #D9F23C;
    font-weight: 700;
}
.modal-bib-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 130px;
    overflow-y: auto;
    padding: 4px 0;
}
.discovery-filter-sheet .feed-sheet-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 18px;
    background: #0d1422;
}

@media (min-width: 1400px) {
    .discovery-feed .reels-feed { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1100px) and (min-width: 769px) {
    .discovery-feed.reels-wrapper { grid-template-columns: 230px minmax(0,1fr); }
    .discovery-guide { display: none; }
}

/* Mobile Viewport (≤ 768px) */
@media (max-width: 768px) {
    /* Hide the desktop sidebar, desktop toolbar, and guide from the main scroll view */
    /* The desktop column wrapper disappears so the feed is the grid item — and
       the scroller — exactly as it was before the toolbar moved inside it. */
    .discovery-main { display: contents; }
    .discovery-feed .discovery-controls { display: none !important; }
    .discovery-feed .discovery-toolbar { display: none !important; }
    .discovery-feed .discovery-guide { display: none !important; }

    /* Mobile header: brand + account, race chips, sort tabs. */
    .mobile-feed-bar {
        display: flex;
        flex-direction: column;
        background: #121B2B;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-shrink: 0;
        z-index: 40;
    }
    .mfb-top { display: flex; align-items: center; justify-content: space-between; height: 50px; padding: 0 8px 0 16px; }
    .mfb-logo { font-family: var(--font-brand); font-weight: 700; font-size: 20px; color: #fff; text-decoration: none; letter-spacing: -0.01em; }
    .mfb-logo span { color: #D9F23C; }
    .mfb-logo:hover { color: #fff; }
    .mfb-actions { display: flex; align-items: center; gap: 2px; }
    .mfb-icon {
        position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
        background: none; border: 0; color: #fff; font-size: 18px; text-decoration: none;
    }
    .mfb-icon:hover { color: #D9F23C; }
    .mfb-dot { position: absolute; top: 10px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #D9F23C; }
    .mfb-avatar {
        width: 32px; height: 32px; margin: 0 6px 0 4px; border-radius: 50%; background: #79AAD3; color: #121B2B;
        display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; text-decoration: none;
    }
    .mfb-signin {
        height: 34px; margin: 0 4px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.22);
        display: inline-flex; align-items: center; color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
    }
    .mfb-chips {
        display: flex; gap: 8px; padding: 2px 16px 10px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    }
    .mfb-chips::-webkit-scrollbar { display: none; }
    .feed-race-chip {
        flex-shrink: 0; max-width: 220px; padding: 8px 14px; border-radius: 999px;
        background: #1C2740; border: 1px solid #2E3B55; color: #fff; font-size: 13px; font-weight: 600;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .feed-race-chip.active { background: #D9F23C; border-color: #D9F23C; color: #121B2B; font-weight: 700; }
    .mf-bar-filter-badge {
        flex-shrink: 0; display: inline-flex; align-items: center; padding: 8px 12px; border-radius: 999px;
        background: #D9F23C; color: #121B2B; font-size: 13px; font-weight: 700; white-space: nowrap;
    }
    .mfb-tabs { display: flex; gap: 24px; padding: 0 16px; }
    .mobile-feed-bar .feed-sort-tab.mfb-tab {
        background: none; border: 0; border-radius: 0; border-bottom: 2px solid transparent;
        color: #A3ACBB; font-size: 14px; font-weight: 600; padding: 8px 0 9px; box-shadow: none; flex: 0 0 auto; width: auto;
    }
    .mobile-feed-bar .feed-sort-tab.mfb-tab.active { color: #fff; font-weight: 700; border-bottom-color: #D9F23C; background: none; }

    .discovery-feed .feed-findme, .discovery-feed .feed-isthisyou { margin: 0 0 16px; }

    body.feed-mode,
    body:has(.discovery-feed) {
        background-color: #121B2B !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
    }
    body.feed-mode > .content,
    body:has(.discovery-feed) > .content {
        background-color: #121B2B !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .discovery-feed.reels-wrapper {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: calc(100dvh - 60px);
        height: calc(100dvh - 60px - env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
        gap: 0;
        background: #121B2B;
    }
    .discovery-feed .reels-feed {
        display: block;
        padding: 10px 10px 24px !important;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .discovery-feed .reel-slide {
        margin: 0 0 16px;
        border-radius: 16px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: #182338;
        overflow: hidden;
    }
    .discovery-feed .reel-slide .reel-media-container {
        aspect-ratio: 4/5;
        background: #0d1422;
        cursor: pointer;
    }
    .discovery-feed .reel-slide .reel-info {
        color: #ffffff;
    }
    .discovery-feed .reel-info .text-white-50 {
        color: #94a3b8 !important;
    }

    /* Seamless dark bottom nav on mobile feed */
    .mobile-bottom-nav {
        background: rgba(18, 27, 43, 0.98) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5) !important;
    }
    .mobile-bottom-nav .bottom-nav-item {
        color: #94A3B8;
    }
    .mobile-bottom-nav .bottom-nav-item.active {
        color: #D9F23C;
    }
    .mobile-bottom-nav .bottom-nav-item:hover {
        color: #ffffff;
    }
    .mobile-bottom-nav .bottom-nav-label {
        color: inherit;
    }
    .discovery-feed .reel-creator-link, .discovery-feed .reel-caption {
        color: #ffffff;
    }
    .discovery-feed .action-btn {
        color: #cbd5e1;
    }

    /* Mobile pagination: strictly non-sticky at the bottom of the scroll list */
    .discovery-pagination {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 20px 8px 36px;
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        width: 100%;
    }
    .discovery-pagination button {
        border: 1px solid rgba(255, 255, 255, 0.18);
        border-radius: 20px;
        padding: 8px 16px;
        background: #121B2B;
        color: #ffffff;
        font-size: 12px;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    .discovery-pagination button:disabled {
        opacity: 0.35;
    }
    .discovery-pagination #discoveryPage {
        color: #94a3b8;
        font-size: 12px;
        font-weight: 600;
    }
}

@media (min-width: 769px) {
    .mobile-feed-bar { display: none !important; }
}

/* In-feed panels: "Find your photos" and "Is this you?". */
/* The panel under a shared moment already asks; the card need not ask twice. */
.reel-slide:has(+ .feed-isthisyou) .reel-shop-cta { display: none; }
.feed-findme {
    grid-column: 1 / -1;
    padding: 12px; border-radius: 14px; background: #1A2538; border: 1px solid #2E3B55; color: #fff;
    display: flex; flex-direction: column; gap: 10px;
}
.feed-findme-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.feed-findme-head p { margin: 0; font-size: 13px; line-height: 1.4; }
.feed-findme-head strong { font-weight: 700; }
.feed-findme-head span { color: #A3ACBB; }
.feed-findme-close { width: 32px; height: 32px; margin: -6px -6px 0 0; flex-shrink: 0; background: none; border: 0; color: #A3ACBB; }
.feed-findme-row, .feed-isthisyou-row { display: flex; gap: 8px; }
.feed-findme-row input {
    flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #34425E;
    background: #121B2B; color: #fff; font-size: 16px;
}
.feed-findme-row input::placeholder { color: #7C879A; }
.feed-findme-row button, .findme-row button {
    height: 44px; padding: 0 18px; border-radius: 10px; border: 0; background: #D9F23C; color: #121B2B; font-weight: 700; font-size: 14px;
}
.feed-findme-other { align-self: flex-start; font-size: 12px; font-weight: 600; color: #79AAD3; text-decoration: none; }
.feed-isthisyou {
    grid-column: 1 / -1;
    padding: 16px; border-radius: 16px; background: #D9F23C; color: #121B2B; display: flex; flex-direction: column; gap: 10px;
}
.feed-isthisyou h2 { margin: 0; font-family: var(--font-heading); font-size: 19px; font-weight: 700; color: #121B2B; }
.feed-isthisyou p { margin: 0; font-size: 13px; line-height: 1.45; }
.feed-isthisyou-row input {
    flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 10px; border: 0; background: #fff; color: #121B2B; font-size: 17px; font-weight: 700;
}
.feed-isthisyou-row button { height: 46px; padding: 0 18px; border-radius: 10px; border: 0; background: #121B2B; color: #fff; font-weight: 700; font-size: 14px; }
.feed-more-from { grid-column: 1 / -1; margin: 4px 2px 12px; font-size: 14px; font-weight: 700; color: #fff; }
@media (min-width: 769px) {
    .feed-more-from { color: #fff; }
    /* Beside the shared moment rather than under it, so the first row of the
       grid is not one card and two empty cells. */
    .feed-isthisyou { padding: 22px; gap: 12px; }
    .feed-isthisyou h2 { font-size: 22px; }
}

/* Desktop right column. */
.findme-box { padding: 18px; border-radius: 16px; background: #f6f8fb; border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 10px; }
.findme-box p { margin: 0 0 4px; }
.findme-select, .findme-row input {
    width: 100%; height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: #121b2b; font-size: 14px;
}
.findme-row { display: flex; gap: 8px; }
.findme-row input { flex: 1; min-width: 0; }
.discovery-guide .findme-row button { width: auto; flex-shrink: 0; }
.guide-races { margin: 24px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.guide-races h3 { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #64748b; }
.guide-race { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: #f6f8fb; text-decoration: none; }
.guide-race:hover { background: #eef1ff; }
.guide-race-name { font-size: 14px; font-weight: 700; color: #121b2b; }
.guide-race-meta { font-size: 12px; color: #64748b; }

/* =====================================================================
   DESKTOP: one column of moments, dark, scrolled one at a time.
   The desktop feed was a 2–3 column grid of cards: a gallery to scan, not a
   feed to scroll. It is now the same single column as the phone, centred,
   with the filters on the left and "find your photos" on the right.
   ===================================================================== */
@media (min-width: 769px) {
    body:has(.discovery-feed), body:has(.discovery-feed) > .content { background: #0B1220 !important; }
    .discovery-feed.reels-wrapper {
        background: #121B2B;
        border: 1px solid #243049;
        box-shadow: none;
        grid-template-columns: 280px minmax(0, 1fr) 320px;
        gap: 0;
    }
    .discovery-main {
        scroll-snap-type: y proximity;
        scroll-padding-top: 20px;
        padding: 20px 24px 0;
    }
    .discovery-feed .reels-feed,
    .discovery-feed.discovery-reels .reels-feed {
        grid-template-columns: minmax(0, 600px);
        justify-content: center;
        gap: 20px;
        padding: 0 0 20px !important;
    }
    /* The panels are stops too, or the snap skips straight past them. */
    .discovery-feed .feed-findme, .discovery-feed .feed-isthisyou { scroll-snap-align: start; }
    .discovery-feed .reel-slide {
        scroll-snap-align: start;
        background: #172136;
        border: 1px solid #243049;
        color: #fff;
    }
    .discovery-feed .reel-slide .reel-media-container,
    .discovery-reels .reel-slide .reel-media-container {
        aspect-ratio: auto !important;
        height: min(66vh, 620px);
        background: #0B1220;
    }
    .discovery-feed .reel-slide .reel-info { color: #fff; padding: 14px 16px 4px; }
    .discovery-feed .reel-info .text-white-50 { color: #A3ACBB !important; }
    .discovery-feed .reel-creator-link, .discovery-feed .reel-caption { color: #fff; }
    .discovery-feed .reel-creator { font-size: 13px; }
    .discovery-feed .reel-caption { font-size: 17px; }
    .discovery-feed .reel-badge { background: #243049; color: #DCE1E8; font-size: 12px; }
    .discovery-feed .action-btn { color: #DCE1E8; font-size: 13px; }
    .discovery-feed .action-btn:hover { color: #D9F23C; }
    .discovery-feed .reel-slide .reel-actions { padding: 8px 16px 14px; }
    .discovery-feed .reel-pending { color: #A3ACBB; background: #1C2740; }
    .discovery-feed .reels-feed > .text-white { color: #A3ACBB !important; }

    /* Left: filters. */
    .discovery-controls, .discovery-feed .feed-top-header, .discovery-feed .feed-top-header.header-hidden {
        background: #121B2B; border-right: 1px solid #243049;
    }
    .discovery-feed .feed-top-header { border-right: 0; }
    .discovery-feed .feed-search-bar { background: #121B2B; }
    .discovery-feed .reels-nav .nav-link-btn { background: #1C2740; border-color: #2E3B55; color: #fff; }
    .discovery-feed .feed-badge-pill { background: #1C2740; border-color: #2E3B55; color: #D9F23C; }
    .discovery-feed .feed-sort-tab { background: #1C2740; border-color: #2E3B55; color: #DCE1E8; }
    .discovery-feed .feed-sort-tab.active { background: #D9F23C; border-color: #D9F23C; color: #121B2B; }
    .discovery-feed .event-selector-card { background: #1C2740; border-color: #2E3B55; color: #fff; }
    .discovery-feed .event-selector-name, .discovery-feed .fb-crumb, .discovery-feed .fb-event-icon { color: #fff; }
    .discovery-feed .event-selector-count { background: #243049; color: #D9F23C; }
    .discovery-feed .event-selector-caret { color: #A3ACBB; }
    .discovery-modes { background: #1C2740; }
    .discovery-modes button { color: #DCE1E8; }
    .discovery-modes button[aria-pressed=true] { color: #121B2B; }
    .discovery-toolbar, .discovery-toolbar #discoveryResults { color: #A3ACBB; }
    .discovery-search-title { color: #fff; }
    .discovery-feed .feed-search-input-wrap { background: #1A2538; border-color: #34425E; }
    .discovery-feed #feedSearchInput { color: #fff; background: transparent; }
    .discovery-feed .feed-search-input-wrap .text-white-50 { color: #A3ACBB !important; }
    .discovery-feed #bibTrayTitle { color: #D9F23C !important; }
    .discovery-feed .bib-chip { color: #fff; background: #1C2740; border-color: #2E3B55; }

    /* Right: find your photos + races. */
    .discovery-guide { background: #121B2B; border-left: 1px solid #243049; color: #A3ACBB; }
    .discovery-guide h2 { color: #fff; }
    .findme-box { background: #1A2538; border-color: #2E3B55; }
    .findme-select, .findme-row input { background: #121B2B; border-color: #34425E; color: #fff; }
    .findme-row input::placeholder { color: #7C879A; }
    .guide-races h3 { color: #A3ACBB; }
    .guide-race { background: #172136; }
    .guide-race:hover { background: #1C2740; }
    .guide-race-name { color: #fff; }
    .guide-race-meta { color: #A3ACBB; }
    .discovery-guide button#discoverySaved { background: #1C2740; border-color: #2E3B55; color: #fff; }

    .discovery-pagination, .discovery-pagination #discoveryPage { color: #A3ACBB; }
    .discovery-pagination button { background: #1C2740; border-color: #2E3B55; color: #fff; box-shadow: none; }
}
/* One search on desktop: the bib search in the left column. The right column
   (a second search box and a race list repeating the race picker) is gone,
   and its width goes to the feed. */
@media (min-width: 769px) {
    .discovery-feed .discovery-guide,
    .discovery-feed .reels-feed .feed-findme { display: none !important; }
    .discovery-feed.reels-wrapper { grid-template-columns: 280px minmax(0, 1fr); }
    .discovery-feed .reels-feed,
    .discovery-feed.discovery-reels .reels-feed { grid-template-columns: minmax(0, 820px); }
    .discovery-feed .reel-slide .reel-media-container,
    .discovery-reels .reel-slide .reel-media-container { height: min(76vh, 780px); }
}
@media (max-width: 1100px) and (min-width: 769px) {
    .discovery-feed.reels-wrapper { grid-template-columns: 250px minmax(0, 1fr); }
}

/* The feed loads more as you scroll; the page buttons are gone. */
.discovery-feed .discovery-pagination { display: none !important; }

/* Find a runner: one field, then the race's bibs as a flowing cloud. */
.bib-find { padding: 4px 0 12px; }
.bib-find-field {
    display: flex; align-items: center; gap: 10px; height: 44px; margin: 0; padding: 0 6px 0 14px;
    border-radius: 12px; border: 1px solid #34425E; background: #1A2538; color: #A3ACBB; cursor: text;
}
.bib-find-field:focus-within { border-color: #D9F23C; }
.bib-find-field input {
    flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: 0; background: transparent !important;
    color: #fff !important; font-size: 15px; padding: 0 !important; box-shadow: none !important;
}
.bib-find-field input::placeholder { color: #7C879A; }
.bib-find-field input::-webkit-search-cancel-button { display: none; }
.bib-find-clear { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: #7C879A; }
.bib-find-clear:hover { color: #fff; background: #243049; }
.discovery-feed .feed-search-input-wrap { display: none; }

.bib-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.bib-tray-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #A3ACBB; }
.bib-tray-title span { color: #fff; margin-left: 4px; }
.bib-sort { display: flex; padding: 2px; border-radius: 999px; background: #1C2740; }
.bib-sort button {
    height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: #A3ACBB; font-size: 12px; font-weight: 600;
}
.bib-sort button[aria-pressed="true"] { background: #fff; color: #121B2B; }
.bib-clear { align-self: flex-start; margin: -2px 0 10px; padding: 0; border: 0; background: none; color: #D9F23C; font-size: 12px; font-weight: 700; }

.bib-chips-container, .modal-bib-chips { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.discovery-feed .bib-chip, .modal-bib-chips .bib-chip {
    flex: 0 0 auto; height: 32px; padding: 0 12px; border-radius: 999px; gap: 0;
    background: #1C2740; border: 1px solid #2E3B55; color: #fff; font-size: 13px; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.discovery-feed .bib-chip:hover, .modal-bib-chips .bib-chip:hover { border-color: #D9F23C; background: #243049; color: #fff; }
.discovery-feed .bib-chip.active, .modal-bib-chips .bib-chip.active { background: #D9F23C; border-color: #D9F23C; color: #121B2B; }
.bib-more {
    height: 32px; padding: 0 12px; border-radius: 999px; border: 1px dashed #34425E; background: none; color: #79AAD3; font-size: 13px; font-weight: 600;
}
.bib-more:hover { border-color: #79AAD3; }

/* Desktop: the tray takes the rest of the column and scrolls inside it,
   rather than stopping at a fixed 190px and leaving the column empty below. */
@media (min-width: 769px) {
    .discovery-feed .feed-search-bar { padding: 8px 16px 0; }
    .discovery-feed .feed-bib-tray {
        max-height: none; border-top: 0; padding-top: 0; display: flex; flex-direction: column;
    }
    .discovery-feed .bib-chips-container { overflow-y: auto; padding-bottom: 16px; scrollbar-width: thin; }
}
.bib-tray-head { flex-wrap: wrap; row-gap: 6px; }
.bib-tray-title, .bib-sort button { white-space: nowrap; }
.discovery-feed #bibTrayTitle { color: #A3ACBB !important; }

/* Accessible high-contrast secondary text (WCAG AA compliant) */
.discovery-feed .text-white-50,
.feed-sheet .text-white-50,
.reel-info .text-white-50 {
    color: rgba(255, 255, 255, 0.78) !important;
}
.discovery-feed .reel-info .text-white-50 {
    color: #4b5563 !important;
}
.event-choice-meta {
    color: #475569 !important;
}

