/* HTML5 视频播放器插件样式（多平台） */

.kkxy-h5p-block {
    border-radius: 0.5rem;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-top: 1.25rem;
}

[data-bs-theme="dark"] .kkxy-h5p-block {
    border: 1px solid var(--bs-border-color, rgba(255, 255, 255, 0.08));
}

/* 16:9 响应式播放器容器（iframe 用） */
.kkxy-h5p-player-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    overflow: hidden;
    border-radius: 0.5rem;
}

/* xgplayer / video 容器：不固定比例，自适应横竖屏 */
.kkxy-h5p-player-wrap-video {
    padding-top: 0;
    min-height: 200px;
}

.kkxy-h5p-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    z-index: 1;
}

/* xgplayer 容器 */
.kkxy-h5p-xgplayer {
    position: relative;
    width: 100%;
    min-height: 200px;
    background: #000;
    z-index: 1;
}

.kkxy-h5p-xgplayer > div {
    width: 100% !important;
}

/* HTML5 video 元素（回退方案） */
.kkxy-h5p-video {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 80vh;
    display: block;
    z-index: 1;
    background: #000;
}

/* ---- 点击播放封面 ---- */
.kkxy-h5p-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.kkxy-h5p-cover:hover {
    opacity: 0.92;
}

.kkxy-h5p-cover.kkxy-h5p-cover-hidden {
    display: none;
}

.kkxy-h5p-play-btn {
    width: 48px;
    height: 48px;
    opacity: 0.9;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.kkxy-h5p-cover:hover .kkxy-h5p-play-btn {
    transform: scale(1.15);
    opacity: 1;
}

.kkxy-h5p-play-btn svg {
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.kkxy-h5p-cover-label {
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.kkxy-h5p-cover-label i {
    font-size: 1rem;
}

/* 占位符状态 */
.kkxy-h5p-pending .kkxy-h5p-cover {
    cursor: default;
}

.kkxy-h5p-pending .kkxy-h5p-cover:hover {
    opacity: 1;
}

.kkxy-h5p-pending .kkxy-h5p-cover:hover .kkxy-h5p-play-btn {
    transform: none;
    opacity: 0.5;
}

.kkxy-h5p-pending .kkxy-h5p-play-btn {
    opacity: 0.5;
    animation: kkxy-h5p-pulse 1.5s ease-in-out infinite;
}

@keyframes kkxy-h5p-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

/* 隐藏原帖中的纯视频链接 */
a.kkxy-h5p-source-hidden {
    display: none !important;
}

/* ---- 修复 iframe 全屏（移动端全屏无效问题） ---- */
/* 当 iframe 内的播放器（如哔哩哔哩官方播放器）调用 requestFullscreen() 时，
   浏览器会将 iframe 元素本身置为全屏。但 iframe 默认 position:absolute，
   在移动端会导致全屏后尺寸/位置异常。以下样式强制全屏状态下的 iframe
   以 fixed 定位填满整个视口，确保移动端全屏正常显示。 */
.kkxy-h5p-iframe:fullscreen,
.kkxy-h5p-iframe:-webkit-full-screen,
.kkxy-h5p-iframe:-moz-full-screen,
.kkxy-h5p-iframe:-ms-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 99999 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
}

/* 容器在全屏时也需要解除 overflow:hidden 和 padding-top 限制 */
.kkxy-h5p-player-wrap:fullscreen,
.kkxy-h5p-player-wrap:-webkit-full-screen,
.kkxy-h5p-player-wrap:-moz-full-screen,
.kkxy-h5p-player-wrap:-ms-fullscreen {
    overflow: visible !important;
    padding-top: 0 !important;
    border-radius: 0 !important;
    height: 100% !important;
    background: #000 !important;
}

.kkxy-h5p-block:fullscreen,
.kkxy-h5p-block:-webkit-full-screen,
.kkxy-h5p-block:-moz-full-screen,
.kkxy-h5p-block:-ms-fullscreen {
    overflow: visible !important;
    border-radius: 0 !important;
    margin-top: 0 !important;
}

/* 移动端适配 */
@media (max-width: 575.98px) {
    .kkxy-h5p-block {
        margin-top: 1rem;
    }
}
