.vjs-pip-control {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vjs-pip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.vjs-pip-icon svg {
    transition: transform 0.1s ease;
}

.vjs-pip-control:hover .vjs-pip-icon svg {
    transform: scale(1.15);
}

.vjs-storyboard-preview {
    position: absolute;
    bottom: 14px;
    pointer-events: none;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 15;
}

/* ── Most Replayed heatmap (sits above the scrubber, YouTube-style) ──────
   White contour + vertical white→transparent gradient fill. No theme tint. */
.vjs-most-replayed {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 3px;
    height: 34px;
    pointer-events: none;
    z-index: 1;
}

.vjs-most-replayed-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.vjs-most-replayed-area {
    stroke: none;
}

.vjs-most-replayed-line {
    fill: none;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.video-js.vjs-ad-playing .vjs-most-replayed {
    display: none !important;
}

.vjs-most-replayed.is-hidden {
    display: none !important;
}

/* Player settings: compact, clear controls above the control bar.
   position is declared here (not just inherited from style.css) so this
   panel still floats correctly on pages that don't load the main
   stylesheet, e.g. templates/embed/embed-video.php. */
.video-js .vjs-player-setting {
    position: absolute;
    right: 14px;
    bottom: 49px;
    width: 230px;
    height: auto;
    max-height: 0;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    background: rgba(31, 31, 31, .94);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .42), inset 0 1px rgba(255, 255, 255, .06);
    backdrop-filter: blur(10px);
    opacity: 0;
    overflow: hidden;
    transition: max-height .2s ease, opacity .16s ease, padding .2s ease;
    z-index: 20;
}

.video-js .vjs-player-setting.open {
    max-height: 220px;
    padding-top: 8px;
    padding-bottom: 8px;
    opacity: 1;
}

.video-js .vjs-setting-row {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.video-js .vjs-setting-row:last-child {
    border-bottom: 0;
}

.video-js .vjs-setting-label {
    color: rgba(255, 255, 255, .92);
    font-size: 13px;
    font-weight: 600;
}

.video-js .vjs-setting-switch {
    display: inline-flex;
    width: 38px;
    height: 22px;
    align-items: center;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.video-js .vjs-setting-switch::after {
    width: 16px;
    height: 16px;
    margin: 0;
    background: #d5d5d5;
    border-radius: 50%;
    content: '';
    float: none;
    transform: translateX(0);
    transition: transform .18s ease, background .18s ease;
}

.video-js .vjs-setting-switch.on {
    border-color: var(--accent, var(--color-primary, #f55151));
    background: var(--accent, var(--color-primary, #f55151));
}

.video-js .vjs-setting-switch.on::after {
    background: #fff !important;
    float: none;
    transform: translateX(16px);
}

.video-js .vjs-setting-switch:focus-visible,
.video-js .speed-selector:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.video-js .speed-selector {
    width: 76px;
    height: 27px;
    margin: 0;
    padding: 0 25px 0 8px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 13px;
}

.vjs-next-episode-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 30;
    align-items: center;
    justify-content: center;
}

.vjs-next-episode-overlay.visible {
    display: flex;
}

.vjs-next-episode-panel {
    display: grid;
    gap: 12px;
    width: min(92%, 760px);
    max-height: 90%;
    overflow: auto;
}

.vjs-next-episode-card {
    display: flex;
    gap: 16px;
    background: #1e1e1e;
    border-radius: 8px;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
}

.vjs-next-episode-card img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 4px;
}

.vjs-next-episode-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #fff;
}

.vjs-next-episode-countdown {
    color: #f3c669;
    font-size: 14px;
}

.vjs-next-episode-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.vjs-next-episode-actions button {
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
}

.vjs-next-cancel {
    background: #444;
    color: #fff;
}

.vjs-next-play {
    background: #f3c669;
    color: #111;
    font-weight: 600;
}

.vjs-next-suggestions {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 12px;
    color: #fff;
}

.vjs-next-suggestions-title {
    color: #f3c669;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
}

.vjs-next-suggestions-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.vjs-next-suggestion {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 8px;
    align-items: center;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.vjs-next-suggestion img {
    width: 72px;
    height: 42px;
    object-fit: cover;
    border-radius: 4px;
    background: #111;
}

.vjs-next-suggestion span {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.mio-single-retention-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1.05fr) minmax(260px, 1.4fr);
    gap: 10px;
    margin: 10px 0 12px;
    align-items: stretch;
}

.mio-next-primary,
.mio-continue-nudge,
.mio-because-watched {
    background: #202020;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.mio-next-primary-link,
.mio-continue-nudge-link,
.mio-retention-card {
    color: #fff;
    text-decoration: none;
}

.mio-next-primary-link {
    display: grid;
    grid-template-columns: 112px 1fr auto;
    gap: 10px;
    align-items: center;
    min-height: 72px;
    padding: 8px;
}

.mio-next-primary-link img,
.mio-retention-card img {
    width: 100%;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    background: #111;
}

.mio-next-primary-copy,
.mio-retention-card-copy,
.mio-continue-nudge-copy {
    min-width: 0;
}

.mio-next-primary-copy span,
.mio-retention-card-label,
.mio-continue-nudge-copy span,
.mio-retention-row-title {
    display: block;
    color: #f3c669;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
}

.mio-next-primary-copy strong,
.mio-retention-card-copy strong,
.mio-continue-nudge-copy strong {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.mio-next-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 32px;
    background: #f3c669;
    color: #111;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
}

.mio-because-watched {
    padding: 8px;
}

.mio-retention-card-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.mio-retention-card {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 7px;
    align-items: center;
    min-width: 0;
}

.mio-retention-card img {
    height: 74px;
}

.mio-continue-nudge {
    grid-column: 1 / -1;
}

.mio-continue-nudge-link {
    display: grid;
    grid-template-columns: 1fr 132px;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
}

.mio-continue-nudge-progress {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.mio-continue-nudge-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: #f3c669;
}

@media screen and (max-width: 980px) {
    .mio-single-retention-panel {
        grid-template-columns: 1fr;
    }

    .mio-retention-card-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 520px) {
    .vjs-next-episode-panel {
        width: 94%;
        max-height: 94%;
    }

    .vjs-next-episode-card,
    .vjs-next-suggestions-row {
        grid-template-columns: 1fr;
    }

    .vjs-next-episode-card {
        display: grid;
        gap: 10px;
    }

    .vjs-next-episode-card img {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .vjs-next-suggestion {
        grid-template-columns: 84px 1fr;
    }

    .vjs-next-suggestion img {
        width: 84px;
        height: 48px;
    }

    .mio-next-primary-link {
        grid-template-columns: 92px 1fr;
    }

    .mio-next-primary-action {
        grid-column: 1 / -1;
        width: 100%;
    }

    .mio-retention-card-row {
        grid-template-columns: 1fr;
    }

    .mio-continue-nudge-link {
        grid-template-columns: 1fr;
    }
}

body.mio-premium .vjs-ad-playing,
body.mio-premium .paused-ad-container {
    display: none !important;
}

/* Paused-ad overlay: base rules duplicated from style.css (not loaded on the
   embed page, templates/embed/embed-video.php) so the paused ad still shows
   up centered on top of the player there instead of rendering unstyled in
   normal document flow. Keep in sync with style.css if either changes. */
.paused-ad-container {
    display: none;
    position: absolute;
    width: 36%;
    max-width: 310px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.paused-ad-container.in {
    display: block;
    z-index: 10;
    background-color: #424242;
    border-radius: 8px;
}

/* VAST playback always owns the player surface, including during pause/source
   events emitted internally by Video.js. */
.video-js.vjs-ad-playing .paused-ad-container,
.video-js.vjs-ad-playing .paused-ad-container.in {
    display: none !important;
}

@media (min-width: 680px) {
    .paused-ad-container.in {
        width: 310px;
    }
}

.paused-ad-close {
    position: absolute;
    top: -13px;
    right: -13px;
    width: 32px;
    height: 32px;
    line-height: 32px !important;
    text-align: center;
    font-size: 18px !important;
    font-weight: bold;
    color: #fff !important;
    background: rgb(0 0 0 / 83%) !important;
    border: none !important;
    border-radius: 50%;
    text-decoration: none !important;
    cursor: pointer;
    z-index: 5;
}

.close-container {
    display: flex;
    justify-content: space-between;
}

.close-container span {
    padding: 4px;
    color: #bfbc5d;
    font-size: 14px;
}

.ad-slot {
    height: 250px;
}

.paused-ad-placeholder {
    display: none;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 250px;
    background: transparent;
    border: 2px dashed #555;
    border-radius: 8px;
    color: #888;
}

.content-support-placeholder {
    border: none;
    border-radius: 0;
    padding: 20px;
    text-align: center;
    color: #fff;
    max-width: 100%;
    box-shadow: none;
    position: relative;
}

.content-support-placeholder h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.content-support-placeholder p {
    font-size: 13px;
    line-height: 1.4;
    margin: 0 0 6px 0;
    color: #ccc;
}

.content-support-placeholder p strong {
    color: #e74c3c;
    font-weight: 600;
}

.support-icon {
    font-size: 24px;
    margin-bottom: 12px;
    color: #e74c3c;
    opacity: 0.9;
}

.support-help {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.support-help small {
    color: #888;
    font-size: 11px;
}

.support-help a {
    color: #e74c3c;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.support-help a:hover {
    color: #c0392b;
    text-decoration: underline;
}

@media (max-width: 767px) {
    .paused-ad-container {
        top: 44%;
    }

    .paused-ad-container .close-container {
        display: none;
    }
}

@media (max-width: 679px) {
    .paused-ad-placeholder {
        height: auto;
    }

    .paused-ad-placeholder .content-support-placeholder {
        padding: 2px;
    }

    .paused-ad-container {
        width: 54%;
        max-width: 220px;
    }

    .paused-ad-container .ad-slot {
        width: 100%;
        height: auto;
        aspect-ratio: 300/250;
    }

    .paused-ad-container .ad-slot iframe,
    .paused-ad-container .ad-slot img,
    .paused-ad-container .ad-slot video,
    .paused-ad-container .ad-slot ins,
    .paused-ad-container .ad-slot div {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
    }
}

/* Cache-safe device layouts: render sidebar rails + mobile carousel in HTML, toggle with CSS. */
.up-next-mobile-carousel {
    display: none;
}

#sidebar-right .sidebar-rails-desktop {
    display: block;
}

@media (max-width: 768px) {
    .up-next-mobile-carousel {
        display: block;
    }

    #sidebar-right .sidebar-rails-desktop {
        display: none;
    }
}

/* ── Up Next rail ──────────────────────────────────────────────
   Sidebar scrolls with the page; no sticky pinning. */

.up-next-rail .is-next-up-container {
    position: relative;
    width: 100%;
}

.up-next-rail .tag-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #2a2a2a !important;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28) !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
}

.up-next-rail .is-next-up-container:hover .up-next-badge {
    transform: translateY(-3px);
}

.up-next-rail .up-next-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    background: var(--user-primary, #E2B65C);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 4px;
    letter-spacing: .3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
    pointer-events: none;
    transition: transform 0.2s ease;
}

/* Keep the NEW status badge clear of the Plays next badge. */
.up-next-rail .new,
.up-next-mobile-carousel .new {
    left: auto;
    right: 8px;
}

.up-next-rail .tag-card .entry-content,
.up-next-rail .tag-card .entry-footer,
.up-next-rail .tag-card .layer,
.up-next-rail .tag-card .star-parent {
    display: none !important;
}

html.lightson .up-next-rail .tag-card {
    background: var(--light-bg-elevated) !important;
    box-shadow: 0 2px 10px var(--light-shadow) !important;
}
