:root {
    --vp-ink: var(--neon);
}

.pink-mode {
    --vp-ink: #ff4da6;
}

/* --- Card de vídeo --- */
.card[data-video] {
    cursor: pointer;
}

.video-thumb:not(.is-ready) {
    border: 1px solid var(--dim);
    background: linear-gradient(110deg, var(--card-bg) 30%, rgba(var(--neon-rgb), 0.08) 50%, var(--card-bg) 70%);
    background-size: 200% 100%;
    animation: video-skeleton 1.4s linear infinite;
}

.video-thumb.is-failed {
    animation: none;
    background: var(--card-bg);
}

.video-thumb img:not([src]) {
    visibility: hidden;
}

.video-play,
.vp-center {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--neon);
    background: rgba(var(--bg-rgb), 0.72);
    border: 1px solid var(--neon);
    box-shadow: 0 0 18px var(--glow);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.2, 1, 0.3, 1),
        opacity 0.25s ease;
}

.video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.video-play svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
}

.card:hover .video-play,
.card:focus-visible .video-play {
    background: var(--neon);
    color: var(--bg);
    box-shadow: 0 0 25px var(--neon);
    transform: translate(-50%, -50%) scale(1.08);
}

.video-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--vp-ink);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--dim);
    pointer-events: none;
}

.video-duration[hidden] {
    display: none;
}

/* --- Player --- */
.video-modal {
    --vp-chrome: 120px;
}

.vp {
    --ar: 1.7778;
    position: relative;
    width: min(95vw, 1200px, calc((100vh - var(--vp-chrome)) * var(--ar)));
    width: min(95vw, 1200px, calc((100dvh - var(--vp-chrome)) * var(--ar)));
    aspect-ratio: var(--ar);
    background: #000;
    border: 1px solid var(--dim);
    box-shadow: 0 0 30px rgba(var(--neon-rgb), 0.15);
    overflow: hidden;
    color: var(--vp-ink);
    outline: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 1, 0.3, 1), opacity 0.25s ease, border-color 0.3s ease;
}

.video-modal.active .vp {
    transform: scale(1);
    opacity: 1;
}

.vp:hover,
.vp:focus-within {
    border-color: var(--neon);
}

.vp--fs {
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: auto;
    border: 0;
    box-shadow: none;
    transform: none;
}

.vp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #000;
}

.vp-surface {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.vp--idle {
    cursor: none;
}

/* --- Título --- */
.vp-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 14px 16px 28px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.vp-title {
    display: block;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 0 10px var(--glow);
}

.vp-title::before {
    content: "> ";
}

/* --- Botão central --- */
.vp-center {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 72px;
    height: 72px;
    padding: 0;
    cursor: pointer;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.vp-center svg {
    width: 30px;
    height: 30px;
    margin-left: 3px;
}

.vp--paused:not(.vp--loading):not(.vp--error):not(.vp--idle) .vp-center {
    opacity: 1;
    pointer-events: auto;
}

.vp-center:hover,
.vp-center:focus-visible {
    background: var(--neon);
    color: var(--bg);
    box-shadow: 0 0 25px var(--neon);
    transform: translate(-50%, -50%) scale(1.08);
}

/* --- Carregando / erro --- */
.vp-status {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    max-width: 90%;
    transform: translate(-50%, -50%);
    padding: 8px 14px;
    font-size: 0.8rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--dim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.vp--loading .vp-status,
.vp--error .vp-status {
    opacity: 1;
}

.vp--loading:not(.vp--error) .vp-status::after {
    content: "_";
    animation: toast-popup-blink 1s step-end infinite;
}

/* --- Feedback de pulo --- */
.vp-seekfx {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    width: 30%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
}

.vp-seekfx-left {
    left: 0;
}

.vp-seekfx-right {
    right: 0;
}

.vp-seekfx span {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid var(--neon);
    box-shadow: 0 0 15px var(--glow);
}

.vp-seekfx.is-on {
    animation: vp-seekfx 0.7s ease-out;
}

/* --- Barra de controles --- */
.vp-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 36px 12px 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.55) 55%, transparent);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.vp-progress,
.vp-row {
    pointer-events: auto;
}

.vp-btn[hidden] {
    display: none;
}

.vp--idle .vp-bar {
    opacity: 0;
    transform: translateY(8px);
}

.vp--idle .vp-progress,
.vp--idle .vp-row {
    pointer-events: none;
}

.vp--idle .vp-top {
    opacity: 0;
    transform: translateY(-8px);
}

.vp-progress {
    --p: 0;
    --b: 0;
    position: relative;
    height: 22px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    outline: none;
}

.vp-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(var(--neon-rgb), 0.22);
    transition: height 0.15s ease;
}

.vp-buffered,
.vp-played {
    position: absolute;
    inset: 0;
    transform-origin: left center;
}

.vp-buffered {
    background: rgba(var(--neon-rgb), 0.35);
    transform: scaleX(var(--b));
}

.vp-played {
    background: var(--neon);
    box-shadow: 0 0 8px var(--neon);
    transform: scaleX(var(--p));
}

.vp-thumb {
    position: absolute;
    top: 50%;
    left: calc(var(--p) * 100%);
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    background: var(--neon);
    box-shadow: 0 0 8px var(--neon);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.vp-progress:hover .vp-track,
.vp-progress:focus-visible .vp-track,
.vp-progress.is-scrubbing .vp-track {
    height: 6px;
}

.vp-progress:hover .vp-thumb,
.vp-progress:focus-visible .vp-thumb,
.vp-progress.is-scrubbing .vp-thumb {
    opacity: 1;
}

.vp-progress:focus-visible {
    outline: 1px solid var(--neon);
    outline-offset: 2px;
}

.vp-tip {
    position: absolute;
    bottom: 20px;
    left: 0;
    padding: 1px 8px;
    font-size: 0.7rem;
    line-height: 1.6;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--dim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.vp-progress:hover .vp-tip,
.vp-progress.is-scrubbing .vp-tip {
    opacity: 1;
}

.vp-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.vp-spacer {
    flex: 1;
}

.vp-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--vp-ink);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: 0.3s;
}

.vp-btn svg {
    width: 22px;
    height: 22px;
}

.vp-btn:hover,
.vp-btn:focus-visible {
    background: var(--neon);
    color: var(--bg);
    box-shadow: 0 0 15px var(--neon);
    outline: none;
}

.vp-time {
    padding: 0 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    text-shadow: 0 0 8px var(--glow);
}

.vp-sep {
    opacity: 0.6;
}

/* --- Volume --- */
.vp-vol {
    display: flex;
    align-items: center;
}

.vp-vol-range {
    --v: 100%;
    -webkit-appearance: none;
    appearance: none;
    width: 0;
    height: 20px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: width 0.25s ease, opacity 0.25s ease, margin 0.25s ease;
}

.vp-vol:hover .vp-vol-range,
.vp-vol:focus-within .vp-vol-range {
    width: 72px;
    margin: 0 8px 0 4px;
    opacity: 1;
}

.vp-vol-range::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(to right, var(--neon) var(--v), rgba(var(--neon-rgb), 0.22) var(--v));
}

.vp-vol-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    margin-top: -3px;
    background: var(--neon);
    border: 0;
    border-radius: 0;
    box-shadow: 0 0 8px var(--neon);
}

.vp-vol-range::-moz-range-track {
    height: 4px;
    background: rgba(var(--neon-rgb), 0.22);
}

.vp-vol-range::-moz-range-progress {
    height: 4px;
    background: var(--neon);
}

.vp-vol-range::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--neon);
    border: 0;
    border-radius: 0;
    box-shadow: 0 0 8px var(--neon);
}

.vp-vol-range:focus-visible {
    outline: 1px solid var(--neon);
    outline-offset: 2px;
}

/* --- Celular / toque --- */
@media (pointer: coarse) {
    .vp-btn {
        min-width: 44px;
        height: 44px;
    }

    .vp-vol-range {
        display: none;
    }
}

@media (max-width: 600px) {
    .vp-top {
        padding: 10px 12px 22px;
    }

    .vp-title {
        font-size: 0.72rem;
    }

    .vp-center {
        width: 60px;
        height: 60px;
    }

    .vp-center svg {
        width: 26px;
        height: 26px;
    }

    .vp-bar {
        padding: 30px 6px 4px;
        padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }

    .vp-time {
        padding: 0 4px;
        font-size: 0.7rem;
    }

    .vp-btn {
        padding: 0 4px;
    }

    .vp-vol-range {
        display: none;
    }
}

@media (max-height: 500px) {
    .video-modal {
        --vp-chrome: 90px;
    }
}

.vp--fs .vp-top {
    padding: 18px 24px 36px;
}

.vp--fs .vp-title {
    font-size: 0.95rem;
}

.vp--fs .vp-bar {
    padding-left: 20px;
    padding-right: 20px;
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* --- Animações --- */
@keyframes video-skeleton {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

@keyframes vp-seekfx {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    20% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {

    .video-thumb:not(.is-ready),
    .vp-seekfx.is-on {
        animation: none;
    }

    .vp,
    .vp-bar,
    .vp-top,
    .vp-vol-range {
        transition: none;
    }
}
