
#racePage .market-table td.runner-name
img.rb-market-silk-v2 {
    display: inline-block !important;
    width: 30px !important;
    height: 40px !important;
    min-width: 30px;
    max-width: 30px;
    object-fit: contain;
    vertical-align: middle;
    margin: 2px 5px 2px 0;
    padding: 0;
    background: #ffffff;
    border-radius: 4px;
    box-sizing: border-box;
}

#racePage .market-table td.runner-name
img.rb-market-silk-v2[style*="display"] {
    display: none !important;
}

#racePage .market-table td.runner-name {
    white-space: normal;
    vertical-align: middle;
}

#racePage .market-table td.runner-name
button.horse-link {
    vertical-align: middle;
}



#racePage .market-table td.runner-name {
    vertical-align: middle !important;
}

#racePage .market-table td.runner-name
.rb-market-runner-flex {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#racePage .market-table td.runner-name
.rb-market-runner-flex img.rb-market-silk-v2 {
    flex: 0 0 30px !important;
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    height: 40px !important;
    object-fit: contain !important;
    margin: 0 !important;
    align-self: center;
}

#racePage .market-table td.runner-name
.rb-market-runner-flex button.horse-link {
    display: block !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: auto !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    text-align: left !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@media (max-width: 700px) {

    #racePage .market-table td.runner-name
    .rb-market-runner-flex {
        gap: 4px !important;
    }

}




@media (min-width: 851px) {

    /* Give horse names more room. */

    #racePage .market-wrap .market-table:has(th.brain-rank-heading)
    th:nth-child(2),

    #racePage .market-wrap .market-table:has(th.brain-rank-heading)
    td:nth-child(2) {
        width: 19.5% !important;
    }

    /* Reduce the space occupied by Brain Rank. */

    #racePage .market-wrap .market-table:has(th.brain-rank-heading)
    th:nth-child(9),

    #racePage .market-wrap .market-table:has(th.brain-rank-heading)
    td:nth-child(9) {
        width: 7% !important;
        padding-left: 3px !important;
        padding-right: 3px !important;
        text-align: center !important;
    }

    #racePage .market-wrap .market-table
    th.brain-rank-heading {
        font-size: 0.65rem !important;
        white-space: normal !important;
        line-height: 1.15 !important;
    }

    /* Preserve natural wrapping at spaces. */

    #racePage .market-table
    .rb-market-runner-flex button.horse-link {
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

}



/* RB_HORSE_STATS_VISUAL_V2 */

#racePageContent .rb-hs-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--muted, #99a49a) !important;
    font-size: 10px !important;
}

#racePageContent .rb-hs-toggle.rb-hs-enabled {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--accent, #b5ff00) !important;
}

#racePageContent .rb-hs-switch-track {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 19px;
    border-radius: 20px;
    background: #414941;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

#racePageContent .rb-hs-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #c1c9c1;
    transition: transform 0.15s ease;
}

#racePageContent .rb-hs-enabled .rb-hs-switch-track {
    background: var(--accent, #b5ff00);
}

#racePageContent .rb-hs-enabled .rb-hs-switch-thumb {
    background: #172109;
    transform: translateX(15px);
}

#racePageContent .rb-hs-switch-status {
    min-width: 22px;
    text-align: left;
    font-size: 9px;
    font-weight: 800;
}

#racePageContent .market-table td.rb-hs-cell {
    padding: 4px 10px !important;
}

#racePageContent .rb-hs-content {
    width: 100%;
    gap: 3px;
    font-size: 11px;
    line-height: 1.35;
}

#racePageContent .rb-hs-line {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    column-gap: 12px;
    row-gap: 3px;
}

#racePageContent .rb-hs-item {
    gap: 4px;
}

#racePageContent .rb-hs-item:last-child {
    margin-right: auto;
}

#racePageContent .rb-hs-line:first-child
.rb-hs-item:last-child {
    margin-right: 0;
}

#racePageContent .rb-hs-toggle:focus-visible {
    outline: 2px solid var(--accent, #b5ff00);
    outline-offset: 3px;
}

@media (max-width: 700px) {
    #racePageContent .rb-hs-toggle {
        gap: 5px;
        padding: 5px !important;
        font-size: 9px !important;
    }

    #racePageContent .rb-hs-content {
        font-size: 10px;
        max-width: calc(100vw - 65px);
    }

    #racePageContent .rb-hs-line {
        justify-content: flex-start;
        column-gap: 10px;
        row-gap: 3px;
    }

    #racePageContent .rb-hs-switch-status {
        min-width: 18px;
    }
}


/* RB_HORSE_STATS_MOBILE_V3 */

@media (max-width: 700px) {

    /* Override existing mobile runner-card layout. */

    #racePageContent .market-table tbody tr.rb-hs-row {
        display: block !important;
        grid-template-columns: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 0 !important;
        margin: -5px 0 10px !important;
        border: 1px solid rgba(255,255,255,0.08) !important;
        border-top: 0 !important;
        border-radius: 0 0 10px 10px !important;
        background: rgba(255,255,255,0.025) !important;
        box-shadow: none !important;
    }

    #racePageContent .market-table tbody
    tr.rb-hs-row > td.rb-hs-cell {
        display: block !important;
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        border: 0 !important;
        text-align: left !important;
        white-space: normal !important;
    }

    #racePageContent .market-table tbody
    tr.rb-hs-row > td.rb-hs-cell::before,

    #racePageContent .market-table tbody
    tr.rb-hs-row > td.rb-hs-cell::after {
        display: none !important;
        content: none !important;
    }

    /* Use the full available width. */

    #racePageContent .rb-hs-content {
        display: grid !important;
        grid-template-columns:
            minmax(0, 1fr) minmax(0, 1fr) !important;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        column-gap: 10px !important;
        row-gap: 4px !important;
        font-size: 10.5px !important;
        line-height: 1.4 !important;
    }

    /* Flatten both desktop lines into one mobile grid. */

    #racePageContent .rb-hs-line {
        display: contents !important;
    }

    #racePageContent .rb-hs-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: baseline !important;
        justify-content: flex-start !important;
        gap: 5px !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap !important;
    }

    #racePageContent .rb-hs-label,
    #racePageContent .rb-hs-value {
        display: inline !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0 !important;
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
        font-size: inherit !important;
        line-height: inherit !important;
    }

    /* Distances won occupies the full final line. */

    #racePageContent .rb-hs-line:last-child
    .rb-hs-item:last-child {
        grid-column: 1 / -1 !important;
        margin-top: 2px !important;
    }

    #racePageContent .rb-hs-line:last-child
    .rb-hs-item:last-child .rb-hs-value {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    /* Keep the statistics switch easy to tap. */

    #racePageContent .rb-hs-toggle {
        min-height: 36px !important;
        font-size: 10px !important;
        gap: 6px !important;
    }

    #racePageContent .rb-hs-switch-track {
        width: 34px !important;
        height: 19px !important;
    }
}



#racePageContent .rb-hs-breeding {
    display: flex !important;
    align-items: baseline !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-bottom: 3px !important;
    margin-bottom: 2px !important;
    border-bottom: 1px solid
        rgba(255,255,255,0.06) !important;
    font-size: inherit !important;
    line-height: 1.4 !important;
}

#racePageContent .rb-hs-breeding-value {
    color: var(--text, #e4e9e3);
    font-weight: 600;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

@media (max-width: 700px) {

    #racePageContent .rb-hs-breeding {
        grid-column: 1 / -1 !important;
        padding-bottom: 5px !important;
        margin-bottom: 2px !important;
        font-size: 10.5px !important;
    }

    #racePageContent .rb-hs-breeding-value {
        min-width: 0 !important;
    }
}


/* RB_BET_PRICE_DISPLAY_V3 */

.rb-bet-price-pair {
    display: flex !important;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.rb-bet-price-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    white-space: nowrap;
}

.rb-bet-price-label {
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .35px;
    color: #929e94;
}

.rb-bet-price-item strong {
    font-size: 14px;
    font-weight: 800;
}

.rb-bet-price-drift {
    color: #b6ff38 !important;
}

.rb-bet-price-firm {
    color: #43d9e6 !important;
}

.rb-bet-table-prices {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.rb-bet-table-now {
    font-size: 11px;
    font-weight: 650;
}

.rb-bet-table-now small {
    font-size: 9px;
    color: #929e94;
    margin-right: 4px;
}

@media (max-width: 700px) {
    .rb-bet-price-pair {
        gap: 8px;
    }

    .rb-bet-price-item strong {
        font-size: 12px;
    }

    .rb-bet-price-label {
        font-size: 8px;
    }
}
