/* ── Branded Plyr theme ─────────────────────────────────────────────────────
   YouTube-like layout, PinayDay colours + Poppins. All control glyphs come from
   the self-hosted /plyr.svg sprite (no external requests). */

.plyr {
    --plyr-color-main: #dc2626;
    --plyr-font-family: "Poppins", system-ui, sans-serif;
    --plyr-font-weight-regular: 500;
    --plyr-font-weight-bold: 700;

    --plyr-video-background: #000;
    --plyr-video-control-color: #fff;
    --plyr-video-control-color-hover: #fff;
    --plyr-video-control-background-hover: #dc2626;

    --plyr-badge-background: #dc2626;
    --plyr-badge-text-color: #fff;

    /* Progress + volume rails */
    --plyr-range-fill-background: #dc2626;
    --plyr-range-thumb-background: #fff;
    --plyr-range-thumb-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --plyr-range-track-height: 4px;
    --plyr-range-thumb-height: 13px;

    --plyr-video-controls-background: linear-gradient(transparent, rgba(0, 0, 0, .75));
    --plyr-tab-focus-color: #dc2626;
    --plyr-menu-background: rgba(22, 22, 22, .96);
    --plyr-menu-color: #e5e5e5;
    --plyr-menu-radius: 12px;
    --plyr-control-radius: 8px;

    font-feature-settings: inherit;
}

/* Fill the 16:9 shell with no layout shift before/after init. */
.player-shell {
    position: relative;
    aspect-ratio: 16 / 9;
}

.player-shell .plyr {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.player-shell .plyr video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Larger, rounder center play button — closer to YouTube's tap target. */
.plyr__control--overlaid {
    background: rgba(220, 38, 38, .92);
    padding: calc(var(--plyr-control-spacing, 10px) * 1.4);
    border: 3px solid rgba(255, 255, 255, .15);
}

.plyr__control--overlaid:hover {
    background: #dc2626;
}

/* Settings / quality menu polish */
.plyr__menu__container {
    border: 1px solid rgba(255, 255, 255, .08);
}

/* Injected toggles (Loop Video, Picture-in-Picture) — set off from the built-in speed row.
   The divider sits above the first custom row only. */
.plyr__menu__container [data-x-toggle="loop"] {
    border-top: 1px solid rgba(255, 255, 255, .08);
    margin-top: 2px;
    padding-top: 6px;
}

/* On touch devices the inline volume slider is dead weight (users use the hardware buttons) and it
   was eating the whole control bar on phones — hide just the slider, keep the mute toggle, and give
   that width back to the timeline. */
@media (hover: none) {
    .plyr__volume {
        display: none;
    }
}

/* ── Loading / error overlay ─────────────────────────────────────────────── */
.player-msg {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .45);
    color: #e5e5e5;
    font-size: .875rem;
    font-weight: 600;
    pointer-events: none;
}

.player-msg.hidden {
    display: none;
}

.player-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid rgba(255, 255, 255, .25);
    border-top-color: #fff;
    border-radius: 9999px;
    animation: player-spin .7s linear infinite;
}

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

/* ── Server switcher (below the player, out of the video area) ───────────── */
.source-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: .75rem;
    border: 1px solid rgba(255, 255, 255, .08);
    background: var(--color-surface-card, #161616);
    padding: .45rem .85rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--color-muted-light, #aaa);
    cursor: pointer;
    transition: color .2s, background .2s, border-color .2s;
}

.source-btn:hover {
    color: #fff;
    border-color: rgba(220, 38, 38, .35);
}

.source-btn.is-active {
    border-color: rgba(220, 38, 38, .5);
    background: rgba(220, 38, 38, .14);
    color: #ef4444;
}

.source-btn svg {
    width: .9rem;
    height: .9rem;
}
