.demo-prematch {
    --demo-surface: #f4f6ff;
    --demo-panel: #fff;
    --demo-odds: #f2f5ff;
    --demo-text: #17243e;
    --demo-muted: #495779;
    --demo-border: #d5ddef;
    --demo-accent: #3968d8;
    --demo-accent-ink: #fff;
    --demo-selected: #e5edff;
    --demo-hero: #e8efff;
    --demo-radius: 6px;
    --demo-market-type: #6e4903;
    --demo-top-space: 17rem;
    width: 100%;
    min-width: 0;
    max-width: 1380px;
    margin: 0 auto;
    padding: clamp(8px, 1.25vw, 18px);
    color: var(--demo-text);
    background: var(--demo-surface);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}

.demo-prematch[data-theme="multi"] {
    --demo-surface: #141111;
    --demo-panel: #26231e;
    --demo-odds: #181615;
    --demo-text: #fff5ef;
    --demo-muted: #ccbdb6;
    --demo-border: #523639;
    --demo-accent: #fd526f;
    --demo-accent-ink: #1a1111;
    --demo-selected: #4b2226;
    --demo-hero: #3c191d;
    --demo-market-type: #e3bd88;
}

.demo-prematch[data-theme="demo3"] {
    --demo-surface: #1c1f21;
    --demo-panel: #272b2e;
    --demo-odds: #202426;
    --demo-text: #f5f5f6;
    --demo-muted: #c0c0c0;
    --demo-border: #454a4e;
    --demo-accent: #fc6200;
    --demo-accent-ink: #1a110a;
    --demo-selected: #4a3021;
    --demo-hero: #402c22;
    --demo-market-type: #ffab68;
}

.demo-prematch[data-theme="awgi"] {
    --demo-surface: #16131a;
    --demo-panel: #241d28;
    --demo-odds: #1b171e;
    --demo-text: #fff4fa;
    --demo-muted: #d1c0cc;
    --demo-border: #56394f;
    --demo-accent: var(--background-color-button, #f44788);
    --demo-accent-ink: #1b1117;
    --demo-selected: #4c2438;
    --demo-hero: #432335;
    --demo-market-type: #ffc076;
}

.demo-prematch[data-theme="livebet"] {
    --demo-surface: #111;
    --demo-panel: #1d1d1d;
    --demo-odds: #161616;
    --demo-text: #f5f5f5;
    --demo-muted: #c4c4c4;
    --demo-border: #3d3d3d;
    --demo-accent: #ffca5f;
    --demo-accent-ink: #161411;
    --demo-selected: #383123;
    --demo-hero: #30291e;
    --demo-market-type: #e9c578;
}

.demo-prematch[data-theme="fan"] {
    --demo-surface: #0f131f;
    --demo-panel: #182237;
    --demo-odds: #10182a;
    --demo-text: #f4f8ff;
    --demo-muted: #b4c5da;
    --demo-border: #344b70;
    --demo-accent: #4088d9;
    --demo-accent-ink: #081424;
    --demo-selected: #233e62;
    --demo-hero: #1b3456;
    --demo-market-type: #92c3ff;
}

.demo-prematch,
.demo-prematch * {
    box-sizing: border-box;
}

.demo-prematch [hidden] {
    display: none !important;
}

.demo-prematch :where(h1, h2, h3, h4, p) {
    margin: 0;
    padding: 0;
    color: inherit;
    font-family: inherit;
}

.demo-prematch :where(button, select) {
    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    color: var(--demo-text);
    background: var(--demo-odds);
    font: inherit;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.demo-prematch :where(button, select):focus-visible,
.demo-prematch :where([data-board], [data-markets]):focus-visible {
    outline: 2px solid var(--demo-accent);
    outline-offset: 2px;
}

.demo-prematch button:hover:not(:disabled) {
    border-color: var(--demo-accent);
}

.demo-prematch button:disabled {
    cursor: default;
    opacity: .6;
}

.demo-prematch button:where(.is-active, [aria-pressed="true"]) {
    border-color: var(--demo-accent);
    color: var(--demo-accent-ink);
    background: var(--demo-accent);
    font-weight: 700;
}

.demo-prematch .demo-prematch-subviews {
    display: flex;
    gap: 6px;
    padding: 5px;
    margin-bottom: 10px;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    background: var(--demo-panel);
}

.demo-prematch-subviews > button {
    flex: 1 1 0;
    min-height: 35px;
    font-weight: 700;
}

.demo-prematch-sports,
.demo-prematch-dates,
.demo-prematch-market-filters {
    display: flex;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

.demo-prematch-sports {
    margin-bottom: 10px;
}

.demo-prematch-sports > button {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 56px;
}

.demo-prematch-sport-icon {
    font-size: 17px;
    line-height: 1;
}

.demo-prematch-sports > button,
.demo-prematch-dates > button,
.demo-prematch-market-filters > button {
    white-space: nowrap;
}

.demo-prematch-board-header {
    padding: 10px 12px;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius) var(--demo-radius) 0 0;
    background: var(--demo-panel);
}

.demo-prematch-board-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 8px;
}

.demo-prematch-board-title h1 {
    font-size: clamp(16px, 1.25vw, 20px);
    line-height: 1.25;
}

.demo-prematch-board-title [data-count],
.demo-prematch-status,
.demo-prematch-meta,
.demo-prematch-kickoff {
    color: var(--demo-muted);
    font-variant-numeric: tabular-nums;
}

.demo-prematch-dates:not(:empty) {
    margin-top: 8px;
}

.demo-prematch-date {
    border-radius: 999px;
}

.demo-prematch-status:not(:empty) {
    margin-top: 7px;
}

.demo-prematch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--demo-border);
    border-top: 0;
    border-radius: 0 0 var(--demo-radius) var(--demo-radius);
}

.demo-prematch-board,
.demo-prematch-detail {
    min-width: 0;
    height: max(310px, calc(100vh - var(--demo-top-space)));
    height: max(310px, calc(100dvh - var(--demo-top-space)));
    scrollbar-color: var(--demo-border) transparent;
}

.demo-prematch-board,
.demo-prematch-markets {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}

.demo-prematch-board {
    padding-inline-end: 4px;
}

.demo-prematch-league {
    margin-bottom: 10px;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    background: var(--demo-panel);
}

.demo-prematch-league-heading,
.demo-prematch-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.demo-prematch-league-heading {
    min-height: 40px;
    padding: 8px 12px;
    background: var(--demo-odds);
    border-radius: var(--demo-radius) var(--demo-radius) 0 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.demo-prematch-event {
    padding: 9px 12px;
    border-top: 1px solid var(--demo-border);
}

.demo-prematch-event:is(.is-selected, [aria-current="true"]) {
    background: var(--demo-selected);
    box-shadow: inset 3px 0 var(--demo-accent);
}

.demo-prematch-meta {
    margin-bottom: 6px;
    font-size: .88em;
}

.demo-prematch-open {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
}

.demo-prematch-open.is-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-color: var(--demo-accent);
    color: var(--demo-accent);
}

.demo-prematch-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 32px;
    padding: 6px 8px;
    color: var(--demo-muted);
    font-size: 12px;
    font-weight: 700;
}

.demo-prematch-loading--next-page {
    position: sticky;
    bottom: 0;
    z-index: 1;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    background: var(--demo-panel);
}

.demo-prematch-spinner {
    display: inline-block;
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 2px solid var(--demo-accent);
    border-right-color: transparent;
    border-radius: 50%;
    animation: demo-prematch-spin .7s linear infinite;
}

.demo-prematch-open .demo-prematch-spinner {
    width: 12px;
    height: 12px;
}

@keyframes demo-prematch-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .demo-prematch-spinner {
        animation: none;
    }
}

.demo-prematch-market-type,
.demo-prematch-market-heading {
    color: var(--demo-market-type);
    font-size: .92em;
    font-weight: 700;
}

.demo-prematch :is(.demo-prematch-market-type, .demo-prematch-market-heading).is-handicap {
    color: var(--demo-accent);
}

.demo-prematch-quote {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}

.demo-prematch-prices,
.demo-prematch-market-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.demo-prematch-selection,
.demo-prematch-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    background: var(--demo-odds);
}

.demo-prematch-line {
    flex: 0 0 auto;
    justify-content: center;
    min-width: 38px;
    color: var(--demo-muted);
}

.demo-prematch-selection {
    flex: 1 1 0;
    justify-content: space-between;
}

.demo-prematch [data-prematch-choice] {
    text-align: start;
}

.demo-prematch [data-prematch-choice][aria-pressed="true"] {
    border-color: var(--demo-accent);
    color: var(--demo-accent-ink);
    background: var(--demo-accent);
}

.demo-prematch [data-prematch-choice][aria-pressed="true"] .demo-prematch-odd::after {
    color: inherit;
}

.demo-prematch-selection-label {
    overflow-wrap: anywhere;
}

.demo-prematch-odd {
    flex: none;
    font-weight: 750;
}

.demo-prematch-selection.is-under .demo-prematch-odd::after,
.demo-prematch-selection.is-over .demo-prematch-odd::after,
.demo-prematch-selection.is-handicap .demo-prematch-odd::after {
    display: inline-block;
    margin-inline-start: .3em;
    font-size: .76em;
}

.demo-prematch-selection.is-under .demo-prematch-odd::after {
    content: '▼';
    color: #3275d8;
}

.demo-prematch-selection.is-over .demo-prematch-odd::after {
    content: '▲';
    color: #df6841;
}

.demo-prematch-selection.is-handicap .demo-prematch-odd::after {
    content: 'H';
    color: var(--demo-market-type);
}

.demo-prematch-detail {
    position: sticky;
    top: var(--demo-prematch-sticky-top, 8px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--demo-border);
    border-radius: var(--demo-radius);
    background: var(--demo-panel);
}

.demo-prematch-match-header {
    flex: 0 0 auto;
    padding: 12px;
    border-bottom: 1px solid var(--demo-border);
    background: var(--demo-hero);
}

.demo-prematch-match-header:empty {
    display: none;
}

.demo-prematch-detail-league {
    font-size: 14px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.demo-prematch-matchup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 14px 0 5px;
    font-size: clamp(14px, 1.1vw, 18px);
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
}

.demo-prematch-versus {
    color: var(--demo-accent);
    font-size: 1.1em;
    font-weight: 700;
}

.demo-prematch-kickoff {
    display: block;
    text-align: center;
}

.demo-prematch-market-filters {
    flex: 0 0 auto;
    padding: 8px;
    border-bottom: 1px solid var(--demo-border);
}

.demo-prematch-market-filters:empty {
    display: none;
}

.demo-prematch-market-filters > button {
    flex: 1 0 auto;
    min-height: 30px;
    padding: 4px 8px;
    font-size: 12px;
}

.demo-prematch-markets {
    flex: 1 1 auto;
    min-height: 0;
    padding: 8px;
}

.demo-prematch-market {
    margin-bottom: 12px;
}

.demo-prematch-market-heading {
    margin: 4px 0 6px;
}

.demo-prematch-market-row + .demo-prematch-market-row {
    margin-top: 4px;
}

.demo-prematch-market-row:not([data-option-count="1"]):not([data-option-count="2"]):not([data-option-count="3"]) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
}

.demo-prematch-inline-detail {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--demo-border);
}

.demo-prematch-empty {
    margin: 0;
    padding: 14px 8px;
    color: var(--demo-muted);
}

.demo-prematch-sentinel {
    height: 2px;
}

.demo-prematch-load-more {
    display: block;
    width: 100%;
    margin-top: 5px;
}

.demo-prematch-close-detail {
    display: none;
}

.demo-prematch[data-mode="domestic"] .demo-prematch-layout {
    grid-template-columns: minmax(0, 1fr);
}

.demo-prematch[data-mode="domestic"] [data-detail] {
    display: none;
}

@media (min-width: 821px) {
    .demo-prematch[data-mode="domestic"] .demo-prematch-quote,
    .demo-prematch[data-mode="domestic"] .demo-prematch-inline-detail .demo-prematch-market {
        display: grid;
        grid-template-columns: minmax(0, 7rem) minmax(0, 1fr);
        gap: 4px 7px;
    }

    .demo-prematch[data-mode="domestic"] .demo-prematch-inline-detail .demo-prematch-market {
        align-items: center;
    }

    .demo-prematch[data-mode="domestic"] .demo-prematch-inline-detail .demo-prematch-market-row {
        grid-column: 2;
        margin: 0;
    }
}

@media (max-width: 820px) {
    .centerWrap:has(.demo-prematch[data-theme="multi"]) {
        min-width: 0;
    }

    #main > .MuiAppBar-positionFixed ~ .demo-prematch[data-theme="livebet"] {
        margin-block-start: 43px;
    }

    .demo-prematch {
        --demo-top-space: 14rem;
        padding: 8px;
        font-size: 13px;
    }

    .demo-prematch-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 6px;
    }

    .demo-prematch-detail {
        position: static;
        height: auto;
        overflow: visible;
    }

    .demo-prematch-markets {
        overflow: visible;
        overscroll-behavior-y: auto;
    }

    /* Fan locks body scrolling, so its bounded page shell scrolls the details. */
    .wrap_type_3 > .demo-prematch-page-shell:has(.demo-prematch[data-theme="fan"].is-detail-open) {
        overflow-y: auto;
    }

    .demo-prematch-detail:not(.is-open) {
        display: none;
    }

    .demo-prematch.is-detail-open .demo-prematch-board {
        display: none;
    }

    .demo-prematch-layout:has(.demo-prematch-detail.is-open) > .demo-prematch-board {
        display: none;
    }

    .demo-prematch-close-detail {
        display: block;
        align-self: flex-start;
        margin: 7px 7px 0;
    }

    .demo-prematch-event {
        padding: 8px;
    }

    .demo-prematch-quote {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .demo-prematch-selection {
        padding: 5px;
    }
}

@media (max-width: 374px) {
    #main > .MuiAppBar-positionFixed ~ .demo-prematch[data-theme="livebet"] {
        margin-block-start: 61px;
    }
}
