.ptb-random-video {
    position: relative;
    isolation: isolate;
    width: min(100%, 900px);
    margin: 0 auto;
    border-radius: var(--main-radius, 8px);
    overflow: hidden;
    background: #050505;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .18);
    touch-action: pan-x;
}

.ptb-random-video > br,
.ptb-random-video__controls > br {
    display: none !important;
}

.ptb-random-video > p:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0 !important;
}

.ptb-random-video__player {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: min(78vh, 820px);
    min-height: 420px;
    background: #050505;
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
}

.ptb-random-video__player.is-active {
    position: relative;
    opacity: 1;
    pointer-events: auto;
}

.ptb-random-video__player::-webkit-media-controls,
.ptb-random-video__player::-webkit-media-controls-enclosure,
.ptb-random-video__player::-webkit-media-controls-panel,
.ptb-random-video__player::-webkit-media-controls-play-button,
.ptb-random-video__player::-webkit-media-controls-timeline,
.ptb-random-video__player::-webkit-media-controls-current-time-display,
.ptb-random-video__player::-webkit-media-controls-time-remaining-display,
.ptb-random-video__player::-webkit-media-controls-mute-button,
.ptb-random-video__player::-webkit-media-controls-volume-slider,
.ptb-random-video__player::-webkit-media-controls-fullscreen-button,
.ptb-random-video__player::-webkit-media-controls-download-button,
.ptb-random-video__player::-webkit-media-controls-start-playback-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ptb-random-video__player::-webkit-media-controls-overlay-play-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ptb-random-video__player::-internal-media-controls-download-button {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.ptb-random-video__overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ptb-random-video__overlay:focus {
    outline: 0;
}

.ptb-random-video__icon {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 7;
    display: grid;
    width: 76px;
    height: 76px;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .42);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.94);
    transition: opacity .18s ease, transform .18s ease;
}

.ptb-random-video__icon.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.ptb-random-video.is-loading .ptb-random-video__icon {
    opacity: .68;
}

.ptb-random-video__status {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 9;
    max-width: calc(100% - 36px);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(8px);
    transition: opacity .16s ease, transform .16s ease;
    backdrop-filter: blur(12px);
}

.ptb-random-video__status.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ptb-random-video__controls {
    position: absolute;
    right: 18px;
    top: 50%;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateY(-50%);
    transition: opacity .2s ease, transform .2s ease;
}

.ptb-random-video__controls.is-hidden {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%);
}

.ptb-random-video__controls.is-hidden .ptb-random-video__button {
    display: none;
}

.ptb-random-video__button,
.ptb-random-video__hide {
    min-width: 86px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff2d68, #ff7a00);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    padding: 12px 16px;
    box-shadow: 0 10px 24px rgba(255, 75, 66, .3);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ptb-random-video__button:hover,
.ptb-random-video__hide:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(255, 75, 66, .36);
}

.ptb-random-video__hide {
    background: rgba(20, 20, 20, .72);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
    backdrop-filter: blur(12px);
}

.ptb-random-video__hide.is-faded {
    opacity: .56;
}

@media (max-width: 768px) {
    body.ptb-tbs-video-page {
        padding-top: 52px !important;
    }

    body.ptb-tbs-video-page .footer-tabbar,
    body.ptb-tbs-video-page .footer-tabbar-placeholder,
    body.ptb-tbs-video-page footer.footer,
    body.ptb-tbs-video-page .footer {
        display: none !important;
    }

    body.ptb-tbs-video-page .header {
        margin-bottom: 0 !important;
    }

    .ptb-random-video {
        width: 100%;
        border-radius: 8px;
    }

    .ptb-random-video__player {
        height: calc(100vh - 150px);
        min-height: 420px;
        max-height: 760px;
    }

    .ptb-random-video__controls {
        right: 10px;
        gap: 8px;
    }

    .ptb-random-video__button,
    .ptb-random-video__hide {
        min-width: 74px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .ptb-random-video__hide {
        right: 10px;
        bottom: 10px;
    }

    .ptb-random-video__icon {
        width: 62px;
        height: 62px;
        font-size: 28px;
    }

    .ptb-random-video.is-mobile-compat {
        --ptb-video-actions-height: 56px;
        width: calc(100vw - 12px);
        max-width: none;
        height: calc(100vh - 108px);
        height: max(640px, calc(100svh - 108px));
        margin-left: 50%;
        padding: 0;
        overflow: hidden;
        background: rgba(5, 5, 5, .96);
        transform: translateX(-50%);
    }

    @supports (height: 100dvh) {
        .ptb-random-video.is-mobile-compat {
            height: max(640px, calc(100dvh - 108px));
        }
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__player {
        position: absolute;
        top: 0;
        right: 0;
        bottom: var(--ptb-video-actions-height);
        left: 0;
        width: 100%;
        height: calc(100% - var(--ptb-video-actions-height));
        min-height: 0;
        max-height: none;
        border-radius: 8px 8px 0 0;
        object-fit: cover;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__player.is-active {
        position: absolute;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__overlay {
        bottom: var(--ptb-video-actions-height);
        height: auto;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__controls {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        top: auto;
        z-index: 12;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        width: 100%;
        height: var(--ptb-video-actions-height);
        padding: 7px 7px max(7px, env(safe-area-inset-bottom));
        transform: none;
        background: rgba(5, 5, 5, .96);
        border-top: 1px solid rgba(255, 255, 255, .08);
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__controls.is-hidden {
        display: grid;
        grid-template-columns: 1fr;
        opacity: 1;
        pointer-events: auto;
        top: auto;
        transform: none;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__controls.is-hidden .ptb-random-video__button {
        display: none;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__button,
    .ptb-random-video.is-mobile-compat .ptb-random-video__hide {
        position: relative;
        right: auto;
        bottom: auto;
        z-index: 12;
        align-self: center;
        min-width: 0;
        width: 100%;
        height: 40px;
        margin: 0;
        padding: 0 2px;
        font-size: 11px;
        line-height: 40px;
        box-shadow: none;
        white-space: nowrap;
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__hide {
        background: rgba(20, 20, 20, .86);
    }

    .ptb-random-video.is-mobile-compat .ptb-random-video__status {
        bottom: calc(var(--ptb-video-actions-height) + max(18px, env(safe-area-inset-bottom)));
        font-size: 12px;
    }

    body.ptb-tbs-video-page .ptb-random-video {
        --ptb-video-actions-height: 56px;
        position: relative;
        width: calc(100vw - 10px);
        max-width: none;
        height: var(--ptb-video-mobile-height, calc(100vh - 52px));
        height: var(--ptb-video-mobile-height, calc(100svh - 52px));
        min-height: 520px;
        margin: 0 0 0 50%;
        padding: 0;
        overflow: hidden;
        border-radius: 8px;
        background: #050505;
        transform: translateX(-50%);
    }

    @supports (height: 100dvh) {
        body.ptb-tbs-video-page .ptb-random-video {
            height: var(--ptb-video-mobile-height, calc(100dvh - 52px));
        }
    }

    body.ptb-tbs-video-page .ptb-random-video__player,
    body.ptb-tbs-video-page .ptb-random-video__player.is-active {
        position: absolute !important;
        top: 0;
        right: 0;
        bottom: var(--ptb-video-actions-height);
        left: 0;
        display: block;
        width: 100%;
        height: calc(100% - var(--ptb-video-actions-height));
        min-height: 0;
        max-height: none;
        border-radius: 8px 8px 0 0;
        object-fit: cover;
        object-position: center center;
    }

    body.ptb-tbs-video-page .ptb-random-video__player {
        opacity: 0;
        pointer-events: none;
    }

    body.ptb-tbs-video-page .ptb-random-video__player.is-active {
        opacity: 1;
        pointer-events: none;
    }

    body.ptb-tbs-video-page .ptb-random-video__overlay {
        top: 0;
        right: 0;
        bottom: var(--ptb-video-actions-height);
        left: 0;
        height: auto;
    }

    body.ptb-tbs-video-page .ptb-random-video__controls,
    body.ptb-tbs-video-page .ptb-random-video__controls.is-hidden {
        position: absolute !important;
        right: 0;
        bottom: 0;
        left: 0;
        top: auto !important;
        z-index: 20;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-flow: column;
        gap: 5px;
        align-items: center;
        width: 100%;
        height: var(--ptb-video-actions-height);
        margin: 0;
        padding: 7px;
        box-sizing: border-box;
        overflow: hidden;
        transform: none !important;
        opacity: 1;
        pointer-events: auto;
        background: rgba(5, 5, 5, .96);
        border-top: 1px solid rgba(255, 255, 255, .08);
    }

    body.ptb-tbs-video-page .ptb-random-video__button,
    body.ptb-tbs-video-page .ptb-random-video__hide {
        position: static !important;
        display: block;
        box-sizing: border-box;
        min-width: 0;
        width: 100%;
        height: 42px;
        margin: 0;
        padding: 0 2px;
        font-size: 11px;
        line-height: 42px;
        white-space: nowrap;
        box-shadow: none;
    }

    body.ptb-tbs-video-page .ptb-random-video__hide {
        order: 1;
    }

    body.ptb-tbs-video-page .ptb-random-video__button[data-video-action="shuffle"] {
        order: 2;
    }

    body.ptb-tbs-video-page .ptb-random-video__button[data-video-action="prev"] {
        order: 3;
    }

    body.ptb-tbs-video-page .ptb-random-video__button[data-video-action="next"] {
        order: 4;
    }

    body.ptb-tbs-video-page .ptb-random-video__controls.is-hidden {
        grid-template-columns: 1fr;
    }

    body.ptb-tbs-video-page .ptb-random-video__controls.is-hidden .ptb-random-video__button {
        display: none;
    }

    body.ptb-tbs-video-page .ptb-random-video__status {
        bottom: calc(var(--ptb-video-actions-height) + 12px);
    }
}
