.stall-livestream {
    --stall-livestream-height: 620px;
    align-items: stretch;
}

.stall-livestream .stall-video-column,
.stall-livestream .stall-chat-column {
    display: flex;
    min-height: var(--stall-livestream-height);
}

.stall-livestream.horse-tv-video-active .horse-tv-hidden-livestream-part {
    display: none !important;
}

.stall-livestream .stall-video-column .single-video,
.stall-livestream #live_stream {
    width: 100%;
    height: var(--stall-livestream-height);
    min-height: var(--stall-livestream-height);
}

.stall-livestream .stall-chat-column {
    align-self: stretch;
}

.stall-livestream .stall-chat-column .livechat,
.stall-livestream .stall-chat-column .cgl-live-chat,
.stall-livestream .stall-chat-column .chat-wrapper {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.stall-livestream .stall-chat-column .cgl-live-chat {
    height: 100% !important;
}

.stall-livestream .stall-chat-column .chat-title,
.stall-livestream .stall-chat-column .chat-message {
    flex: 0 0 auto;
    padding: 14px 18px;
}

.stall-livestream .stall-chat-column .chat-title {
    display: flex;
    align-items: center;
    min-height: 58px;
    padding-right: 68px;
    overflow: visible;
}

.stall-livestream .stall-chat-column .total_view {
    margin-left: 8px;
}

.stall-livestream .stall-chat-column .chat-view {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
}

.stall-livestream .stall-chat-column .chat-message .input-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

.stall-livestream .stall-chat-column .chat-message input {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 0;
}

.stall-livestream .stall-chat-column .input-group-append {
    flex: 0 0 auto;
}

.stall-livestream .stall-chat-column .sendtext {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    line-height: 1;
}

.stall-livestream .stall-chat-column #chat_header #music-button {
    position: absolute !important;
    top: 50% !important;
    right: 12px !important;
    bottom: auto !important;
    left: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 40px;
    margin: 0;
    border: 1px solid rgba(255, 106, 0, .45);
    background: #03070b;
    color: #fff;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background .22s ease, border-color .22s ease, box-shadow .22s ease, transform .18s ease;
}

.stall-livestream .stall-chat-column #chat_header #music-button:hover,
.stall-livestream .stall-chat-column #chat_header #music-button:focus {
    border-color: rgba(255, 138, 52, .92);
    background: linear-gradient(135deg, #101719, #020405);
    box-shadow: 0 0 0 3px rgba(255, 106, 0, .2), 0 10px 24px rgba(0, 0, 0, .3);
    color: #fff;
    outline: none;
    transform: translateY(-50%) scale(1.05);
}

.stall-livestream .stall-chat-column #chat_header #music-button:active {
    transform: translateY(-50%) scale(.96);
}

.stall-livestream .stall-chat-column #music-button.is-playing {
    position: absolute !important;
    box-shadow: 0 0 0 3px rgba(255, 106, 0, .26);
}

.stall-livestream .stall-chat-column #music-button.is-playing::after {
    content: "";
    position: absolute;
    right: -1px;
    top: -1px;
    width: 9px;
    height: 9px;
    border: 2px solid #0a1424;
    border-radius: 50%;
    background: #18d36b;
}

.popup-menu.music-menu--livestream {
    position: fixed;
    width: min(262px, calc(100vw - 32px));
    max-height: min(332px, calc(100vh - 180px));
    padding: 12px;
    border: 1px solid rgba(255, 106, 0, .42);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(5, 11, 15, .96), rgba(8, 37, 35, .94));
    color: #fff;
    line-height: 1.2;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06) inset;
    z-index: 1200;
    overflow-x: hidden;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
    transition: opacity .18s ease, visibility .18s ease, transform .18s ease;
    backdrop-filter: blur(14px);
}

.popup-menu.music-menu--livestream.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, -8px, 0) scale(.98);
}

.music-menu--livestream::-webkit-scrollbar {
    width: 7px;
}

.music-menu--livestream::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .06);
    border-radius: 999px;
}

.music-menu--livestream::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, #ff6a00, #0d5b56);
}

.music-menu--livestream .music-menu__title {
    display: flex;
    align-items: center;
    margin: 0 0 9px;
    padding: 2px 2px 11px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .01em;
}

.music-menu--livestream ul {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.music-menu--livestream .music-menu__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    margin: 0;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, .88);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.music-menu--livestream .music-menu__item:hover,
.music-menu--livestream .music-menu__item:focus {
    border-color: rgba(255, 106, 0, .32);
    background: rgba(13, 91, 86, .32);
    color: #fff;
    outline: none;
    transform: translateX(3px);
}

.music-menu--livestream .music-menu__item.is-selected {
    border-color: rgba(255, 106, 0, .5);
    background: linear-gradient(90deg, rgba(255, 106, 0, .28), rgba(13, 91, 86, .34));
    color: #fff;
}

.music-menu--livestream .music-menu__item--back {
    color: #ffb179;
}

.music-menu--livestream .music-menu__track.is-playing {
    border-color: rgba(24, 211, 107, .55);
    background: rgba(24, 211, 107, .16);
}

.music-menu--livestream .music-menu__option-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.music-menu--livestream .music-menu__check {
    color: #ff8a34;
    font-size: 12px;
    opacity: 0;
    transform: scale(.72);
    transition: opacity .18s ease, transform .18s ease;
}

.music-menu--livestream .music-menu__item.is-selected .music-menu__check {
    opacity: 1;
    transform: scale(1);
}

.music-menu--livestream .music-menu__track.is-playing .music-menu__check {
    color: #18d36b;
    opacity: 1;
    transform: scale(1);
}

.stall-livestream .horse-chat-shortcut-wrapper {
    display: flex;
    justify-content: center;
    margin: 22px auto 8px;
    min-height: 46px;
    text-align: center;
}

.stall-livestream .horse-chat-shortcut-mobile {
    display: none;
}

.stall-livestream .horse-chat-shortcut {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 250px;
    max-width: min(100%, 390px);
    min-height: 44px;
    padding: 11px 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transform: skewX(-14deg);
    transition: transform .18s ease, color .18s ease;
    z-index: 0;
}

.stall-livestream .horse-chat-shortcut::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid #f35111;
    border-radius: 5px;
    background: linear-gradient(17deg, #f35111, #ff8a00);
    box-shadow: 10px 4px 12px rgba(0, 0, 0, .25);
    z-index: -1;
    transition: inset .18s ease, background .18s ease, box-shadow .18s ease;
}

.stall-livestream .horse-chat-shortcut:hover,
.stall-livestream .horse-chat-shortcut:focus {
    color: #fff;
    text-decoration: none;
    transform: skewX(-14deg) translateY(-1px);
}

.stall-livestream .horse-chat-shortcut:hover::before,
.stall-livestream .horse-chat-shortcut:focus::before {
    inset: 3px -3px -3px 3px;
    border-color: #ff8a00;
    background: linear-gradient(-34deg, #ff8a00, #f35111);
    box-shadow: 5px 3px 5px rgba(0, 0, 0, .25);
}

.stall-livestream .horse-chat-shortcut:active,
.stall-livestream .horse-chat-shortcut.is-loading {
    transform: skewX(-14deg) translateY(1px);
}

.stall-livestream .horse-chat-shortcut:disabled {
    cursor: wait;
    opacity: .78;
}

.stall-livestream .horse-chat-shortcut i,
.stall-livestream .horse-chat-shortcut span {
    flex: 0 1 auto;
    transform: skewX(14deg);
}

.stall-livestream .stall-chat-column .sendtext i {
    display: block;
    width: 1em;
    height: 1em;
    line-height: 1;
    text-align: center;
}

@media (max-width: 991px) {
    .stall-livestream {
        --stall-livestream-height: clamp(300px, 56.25vw, 460px);
    }

    .stall-livestream .stall-video-column,
    .stall-livestream .stall-chat-column {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }

    .stall-livestream .stall-chat-column {
        min-height: 360px;
        padding-left: calc(var(--bs-gutter-x, 1.5rem) * .5) !important;
    }

    .stall-livestream .stall-chat-column .livechat {
        height: 360px;
        max-height: 360px;
        min-height: 360px;
    }

    .popup-menu.music-menu--livestream {
        width: min(252px, calc(100vw - 28px));
        max-height: min(300px, calc(100vh - 150px));
    }

}

@keyframes horseChatShortcutFadeIn {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0) scale(.92);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@media (max-width: 767px) {
    .stall-livestream {
        --stall-livestream-height: clamp(230px, 56.25vw, 330px);
    }

    .stall-livestream .stall-chat-column {
        min-height: 320px;
    }

    .stall-livestream .stall-chat-column .livechat {
        height: 320px;
        max-height: 320px;
        min-height: 320px;
    }

    .stall-livestream .horse-chat-shortcut-wrapper--desktop {
        display: none;
    }

    .stall-livestream .horse-chat-shortcut-mobile {
        position: fixed;
        right: calc(20px + env(safe-area-inset-right, 0px));
        bottom: calc(clamp(96px, 18vh, 126px) + env(safe-area-inset-bottom, 0px));
        z-index: 1060;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 62px;
        height: 62px;
        padding: 0;
        border: 2px solid rgba(255, 255, 255, .78);
        border-radius: 50%;
        background: radial-gradient(circle at 36% 32%, #ff9c19 0, #ff7900 48%, #f25a00 100%);
        box-shadow: 0 8px 18px rgba(0, 0, 0, .32), 0 0 0 4px rgba(255, 106, 0, .18);
        opacity: 0;
        animation: horseChatShortcutFadeIn .28s ease-out .15s forwards;
        -webkit-tap-highlight-color: transparent;
    }

    .stall-livestream .horse-chat-shortcut-mobile:active,
    .stall-livestream .horse-chat-shortcut-mobile.is-loading {
        transform: scale(.94);
    }

    .stall-livestream .horse-chat-shortcut-mobile:focus {
        outline: 3px solid rgba(255, 255, 255, .78);
        outline-offset: 3px;
    }

    .stall-livestream .horse-chat-shortcut-mobile__icon {
        display: block;
        width: 54px;
        height: 54px;
        pointer-events: none;
    }

    .stall-livestream .horse-chat-shortcut-mobile svg {
        display: block;
        width: 100%;
        height: 100%;
        overflow: visible;
    }

    .stall-livestream .horse-chat-shortcut-mobile__horse {
        fill: none;
        stroke: #fff;
        stroke-width: 4.4;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .stall-livestream .horse-chat-shortcut-mobile__bubble {
        fill: #fff;
    }

    .stall-livestream .horse-chat-shortcut-mobile__dot {
        fill: #ff7900;
    }

    .stall-livestream .stall-chat-column .chat-title {
        min-height: 50px;
        padding-right: 58px;
        font-size: 17px;
    }

    .stall-livestream .stall-chat-column #chat_header #music-button {
        right: 10px !important;
        width: 36px;
        min-width: 36px;
        max-width: 36px;
        height: 36px;
        font-size: 1.45rem;
    }

    .popup-menu.music-menu--livestream {
        width: min(244px, calc(100vw - 24px));
        max-height: min(286px, calc(100vh - 132px));
        padding: 10px;
        border-radius: 12px;
    }

    .stall-livestream .stall-chat-column .chat-message {
        padding: 8px;
    }

}

#race-replay .horse-chat-shortcut-wrapper {
    display: flex;
    justify-content: center;
    margin: 22px auto 8px;
    min-height: 46px;
    text-align: center;
}

#race-replay .horse-chat-shortcut-mobile {
    display: none;
}

#race-replay .horse-chat-shortcut {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 250px;
    max-width: min(100%, 390px);
    min-height: 44px;
    padding: 11px 30px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transform: skewX(-14deg);
    transition: transform .18s ease, color .18s ease;
    z-index: 0;
}

#race-replay .horse-chat-shortcut::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid #f35111;
    border-radius: 5px;
    background: linear-gradient(17deg, #f35111, #ff8a00);
    box-shadow: 10px 4px 12px rgba(0, 0, 0, .25);
    z-index: -1;
    transition: inset .18s ease, background .18s ease, box-shadow .18s ease;
}

#race-replay .horse-chat-shortcut:hover,
#race-replay .horse-chat-shortcut:focus {
    color: #fff;
    text-decoration: none;
    transform: skewX(-14deg) translateY(-1px);
}

#race-replay .horse-chat-shortcut:hover::before,
#race-replay .horse-chat-shortcut:focus::before {
    inset: 3px -3px -3px 3px;
    border-color: #ff8a00;
    background: linear-gradient(-34deg, #ff8a00, #f35111);
    box-shadow: 5px 3px 5px rgba(0, 0, 0, .25);
}

#race-replay .horse-chat-shortcut:active,
#race-replay .horse-chat-shortcut.is-loading {
    transform: skewX(-14deg) translateY(1px);
}

#race-replay .horse-chat-shortcut:disabled {
    cursor: wait;
    opacity: .78;
}

#race-replay .horse-chat-shortcut i,
#race-replay .horse-chat-shortcut span {
    flex: 0 1 auto;
    transform: skewX(14deg);
}

@media (max-width: 767px) {
    #race-replay .horse-chat-shortcut-wrapper--desktop {
        display: none;
    }

    #race-replay .horse-chat-shortcut-mobile {
        position: fixed;
        right: calc(20px + env(safe-area-inset-right, 0px));
        bottom: calc(clamp(96px, 18vh, 126px) + env(safe-area-inset-bottom, 0px));
        z-index: 1060;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 62px;
        height: 62px;
        padding: 0;
        border: 2px solid rgba(255, 255, 255, .78);
        border-radius: 50%;
        background: radial-gradient(circle at 36% 32%, #ff9c19 0, #ff7900 48%, #f25a00 100%);
        box-shadow: 0 8px 18px rgba(0, 0, 0, .32), 0 0 0 4px rgba(255, 106, 0, .18);
        opacity: 0;
        animation: horseChatShortcutFadeIn .28s ease-out .15s forwards;
        -webkit-tap-highlight-color: transparent;
    }

    #race-replay .horse-chat-shortcut-mobile:active,
    #race-replay .horse-chat-shortcut-mobile.is-loading {
        transform: scale(.94);
    }

    #race-replay .horse-chat-shortcut-mobile:focus {
        outline: 3px solid rgba(255, 255, 255, .78);
        outline-offset: 3px;
    }

    #race-replay .horse-chat-shortcut-mobile__icon {
        display: block;
        width: 54px;
        height: 54px;
        pointer-events: none;
    }

    #race-replay .horse-chat-shortcut-mobile svg {
        display: block;
        width: 100%;
        height: 100%;
        overflow: visible;
    }

    #race-replay .horse-chat-shortcut-mobile__horse {
        fill: none;
        stroke: #fff;
        stroke-width: 4.4;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    #race-replay .horse-chat-shortcut-mobile__bubble {
        fill: #fff;
    }

    #race-replay .horse-chat-shortcut-mobile__dot {
        fill: #ff7900;
    }
}


/* Keep the selected genre/track available for pause and resume. */
.music-menu--livestream .music-menu__item.has-playback-control {
    grid-template-columns: minmax(0, 1fr) 26px;
}
.music-menu--livestream .music-menu__item.is-playing {
    border-color: rgba(24, 211, 107, .55);
    background: rgba(24, 211, 107, .16);
}
.music-menu--livestream .music-menu__item.is-paused {
    border-color: rgba(239, 83, 80, .65);
    background: rgba(239, 83, 80, .13);
}
.music-menu--livestream .has-playback-control .music-menu__check,
.music-menu--livestream .music-menu__toggle[hidden] {
    display: none !important;
}
.music-menu--livestream .music-menu__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: rgba(2, 20, 20, .55);
    color: #18d36b;
    box-shadow: none;
    cursor: pointer;
}
.music-menu--livestream .is-paused .music-menu__toggle {
    color: #ef5350;
}
.music-menu--livestream .music-menu__toggle:hover,
.music-menu--livestream .music-menu__toggle:focus-visible {
    border-color: #ff8a34;
    outline: 2px solid #ff8a34;
    outline-offset: 2px;
}
.music-menu--livestream .music-menu__toggle-icon {
    width: 9px;
    height: 11px;
    border-left: 3px solid currentColor;
    border-right: 3px solid currentColor;
    box-sizing: border-box;
}
.music-menu--livestream .is-paused .music-menu__toggle-icon {
    width: 0;
    height: 0;
    margin-left: 2px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid currentColor;
    border-right: 0;
}
.stall-livestream #music-button.is-paused::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border: 1px solid #003d3d;
    border-radius: 50%;
    background: #ef5350;
}
