/* 与 Boboji Next 项目 globals.css 一致：补充预编译 tailwind.css 未覆盖的动画与滚动条 */

html {
    scroll-behavior: smooth;
}

body {
    background: #000000;
    color: #ffffff;
    overflow-x: hidden;
    min-height: 100vh;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

button,
[role="button"],
a,
select,
input[type="checkbox"],
input[type="radio"],
input[type="submit"],
input[type="button"],
label[for] {
    cursor: pointer;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scroll-smooth {
    scroll-behavior: smooth;
}

.bj-hero-dots {
    position: absolute;
    left: 50%;
    bottom: 2rem;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transform: translateX(-50%);
    pointer-events: auto;
}

.bj-hero-dot {
    display: block;
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: width 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
}

.bj-hero-dot:hover {
    background: rgba(255, 255, 255, 0.75);
}

.bj-hero-dot.is-active,
.bj-hero-dot[aria-selected="true"] {
    width: 2rem;
    background: #ffffff;
}

.bj-hero-play-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
}

@media (min-width: 768px) {
    .bj-hero-play-btn {
        width: 4rem;
        height: 4rem;
    }
}

.bj-poster-fallback {
    z-index: 0;
}

/* JS 动态插入的卡片占位 logo（构建时见 tailwind.config.js content） */
.bj-poster-fallback img[data-bj-poster-fallback-logo],
[data-bj-poster-fallback-logo] {
    width: 6rem;
    height: 6rem;
    opacity: 0.3;
    object-fit: contain;
}

[data-bj-history-list] [data-bj-poster-fallback-logo] {
    width: 2.5rem;
    height: 2.5rem;
}

[data-bj-poster-wrap]:not(.absolute) {
    position: relative;
}

img[data-bj-poster-failed="1"] {
    display: none;
}

/* 全局隐藏滚动条，保留滚动能力 */
html,
body,
* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes pulse-slow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse-slow {
    animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-shimmer {
    animation: shimmer 2s infinite linear;
}

.pt-safe-area-inset-top {
    padding-top: env(safe-area-inset-top, 0px);
}

.pb-safe-area-inset-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@supports not (height: 100dvh) {
    .h-\[100dvh\] {
        height: 100vh;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 热度榜序号（top 页），不依赖模板 add 函数 */
.boboji-rank-grid {
    counter-reset: boboji-rank;
}

.boboji-rank-card {
    position: relative;
}

/* 播放器层叠：避免滚动时盖住固定顶栏（z-[100]） */
[data-bj-player] {
    position: relative;
    z-index: 0;
    isolation: isolate;
    container-type: size;
    container-name: bj-player;
}

[data-bj-player] .artplayer-app,
[data-bj-player] .artplayer {
    width: 100%;
    height: 100%;
    z-index: 1 !important;
}

/* 进度条拖拽/点击时的时间气泡（ArtPlayer 无关闭选项） */
[data-bj-player] .art-progress-tip {
    display: none !important;
}

.bj-vod-qr-popover {
    background-color: #1a1a1a;
    opacity: 1;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

[data-bj-player] .bj-player-video {
    z-index: 1;
    display: block;
    outline: none;
    -webkit-focus-ring-color: transparent;
}

/* 原生控件进度条/滑块聚焦时不显示蓝色边框 */
[data-bj-player] .bj-player-video::-webkit-media-controls-enclosure {
    outline: none;
    border: none;
    box-shadow: none;
}

[data-bj-player] .bj-player-video::-webkit-media-controls-timeline,
[data-bj-player] .bj-player-video::-webkit-media-controls-timeline-container,
[data-bj-player] .bj-player-video::-webkit-media-controls-volume-slider,
[data-bj-player] .bj-player-video::-webkit-media-controls-mute-button,
[data-bj-player] .bj-player-video::-webkit-media-controls-play-button,
[data-bj-player] .bj-player-video::-webkit-media-controls-fullscreen-button {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

[data-bj-player] .bj-player-video::-webkit-slider-thumb,
[data-bj-player] .bj-player-video::-webkit-slider-runnable-track {
    outline: none;
    box-shadow: none;
}

[data-bj-player] .bj-player-video:focus,
[data-bj-player] .bj-player-video:focus-visible {
    outline: none;
    box-shadow: none;
}

[data-bj-player]:focus,
[data-bj-player]:focus-visible,
[data-bj-player]:focus-within {
    outline: none;
    box-shadow: none;
}

/* 播放器加载态：深色底 + 红色氛围渐变 */
.bj-player-stage-loading {
    background: linear-gradient(145deg, #050505 0%, #121212 42%, #1a0808 100%);
}

.bj-player-loading {
    background: linear-gradient(160deg, #080808 0%, #151515 38%, #220c0c 72%, #0a0a0a 100%);
}

.bj-player-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 22% 18%, rgba(220, 38, 38, 0.14) 0%, transparent 58%),
        radial-gradient(ellipse 70% 55% at 78% 82%, rgba(127, 29, 29, 0.1) 0%, transparent 52%);
    pointer-events: none;
}

.bj-player-pause-logo {
    background: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(0, 0, 0, 0.35) 0%, transparent 72%);
}

.bj-player-logo-breath {
    opacity: 0.32;
    animation: bj-player-logo-breath 2.4s ease-in-out infinite;
}

@keyframes bj-player-logo-breath {
    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.94);
    }

    50% {
        opacity: 0.42;
        transform: scale(1);
    }
}

/* 播放器错误态 */
.bj-player-error {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    padding: clamp(0.5rem, 3vw, 1rem);
    overflow: hidden;
    box-sizing: border-box;
}

.bj-player-error__panel {
    width: min(92%, 22rem);
    max-height: 100%;
    padding: 1.75rem 1.5rem 1.375rem;
    text-align: center;
    border-radius: 0.875rem;
    border: 1px solid rgb(63 63 70 / 0.9);
    background: rgb(24 24 27 / 0.96);
    box-sizing: border-box;
    overflow: hidden;
}

.bj-player-error__icon {
    width: 3.75rem;
    height: 3.75rem;
    margin: 0 auto 1rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgb(127 29 29 / 0.35);
    color: #f0a8a8;
}

.bj-player-error__icon svg {
    width: 1.75rem;
    height: 1.75rem;
}

.bj-player-error__title {
    margin: 0 0 0.625rem;
    font-size: 1.125rem;
    line-height: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.bj-player-error__desc {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5rem;
    color: #a1a1aa;
}

.bj-player-error__actions {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
}

.bj-player-error__btn {
    min-width: 7.5rem;
    padding: 0.5625rem 1.25rem;
    border-radius: 0.625rem;
    border: 1px solid rgb(82 82 91 / 0.95);
    background: rgb(39 39 42 / 0.95);
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.bj-player-error__btn:hover {
    background: rgb(63 63 70 / 0.95);
    border-color: #71717a;
}

.bj-player-error__btn:active {
    background: rgb(63 63 70 / 0.95);
    border-color: #71717a;
}

/* 移动端：播放器内错误提示平铺展示，避免卡片在矮屏里溢出 */
@media (max-width: 1023px) {
    .bj-player-error {
        padding: 0.75rem 1rem;
    }

    .bj-player-error__panel {
        width: min(100%, 20rem);
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .bj-player-error__icon {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0.75rem;
    }

    .bj-player-error__icon svg {
        width: 1.5rem;
        height: 1.5rem;
    }

    .bj-player-error__title {
        font-size: 1rem;
        line-height: 1.375rem;
        margin-bottom: 0.5rem;
    }

    .bj-player-error__desc {
        font-size: 0.75rem;
        line-height: 1.375rem;
        padding: 0 0.25rem;
    }

    .bj-player-error__actions {
        margin-top: 0.875rem;
    }

    .bj-player-error__btn {
        min-width: 6.5rem;
        padding: 0.5rem 1.125rem;
        font-size: 0.8125rem;
    }
}

/* 按播放器实际高度缩放（横屏/窄高区域） */
@container bj-player (max-height: 260px) {
    .bj-player-error {
        padding: 0.5rem 0.75rem;
    }

    .bj-player-error__panel {
        width: min(100%, 18rem);
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .bj-player-error__icon {
        width: 2.25rem;
        height: 2.25rem;
        margin-bottom: 0.375rem;
    }

    .bj-player-error__icon svg {
        width: 1.125rem;
        height: 1.125rem;
    }

    .bj-player-error__title {
        font-size: 0.875rem;
        line-height: 1.25rem;
        margin-bottom: 0.25rem;
    }

    .bj-player-error__desc {
        font-size: 0.6875rem;
        line-height: 1.3;
        padding: 0 0.125rem;
    }

    .bj-player-error__actions {
        margin-top: 0.5rem;
    }

    .bj-player-error__btn {
        min-width: 5.75rem;
        padding: 0.375rem 0.875rem;
        font-size: 0.75rem;
        line-height: 1.125rem;
        border-radius: 0.5rem;
    }
}

@container bj-player (max-height: 200px) {
    .bj-player-error {
        padding: 0.375rem 0.625rem;
    }

    .bj-player-error__icon {
        width: 1.875rem;
        height: 1.875rem;
        margin-bottom: 0.25rem;
    }

    .bj-player-error__icon svg {
        width: 0.9375rem;
        height: 0.9375rem;
    }

    .bj-player-error__title {
        font-size: 0.8125rem;
        line-height: 1.125rem;
        margin-bottom: 0.125rem;
    }

    .bj-player-error__desc {
        font-size: 0.625rem;
        line-height: 1.25;
    }

    .bj-player-error__actions {
        margin-top: 0.375rem;
    }

    .bj-player-error__btn {
        min-width: 5.25rem;
        padding: 0.3125rem 0.75rem;
        font-size: 0.6875rem;
    }
}

/* 选集区：默认折叠为两行高度，超出可在此区域内滚动定位当前集 */
[data-bj-episodes-list].bj-episodes-list--collapsed {
    max-height: calc(2 * (1.875rem + 2px) + 0.5rem);
    overflow-x: hidden;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

[data-bj-episodes-list].bj-episodes-list--collapsed::-webkit-scrollbar {
    display: none;
}

[data-bj-episodes-toggle].bj-episodes-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    margin-top: 0;
    padding: 0.75rem 0;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 400;
    color: #9ca3af;
    background: transparent;
    border: 0;
    border-top: 1px solid rgb(39 39 42 / 0.85);
    border-radius: 0;
    box-shadow: none;
    transition: color 0.2s ease;
}

[data-bj-episodes-toggle].bj-episodes-toggle:hover {
    color: #f87171;
}

[data-bj-episodes-toggle][data-expanded="1"] [data-bj-episodes-chevron] {
    transform: rotate(180deg);
}

/* 移动端：播放线路默认收起，点击标题栏按钮展开 */
@media (max-width: 1023px) {
    [data-bj-sources-panel][data-sources-expanded="0"] [data-bj-sources-body] {
        display: none;
    }
}

[data-bj-sources-toggle].bj-sources-header {
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transition: background-color 0.2s ease;
}

@media (max-width: 1023px) {
    [data-bj-sources-toggle].bj-sources-header {
        cursor: pointer;
    }

    [data-bj-sources-toggle].bj-sources-header:active {
        background-color: rgb(39 39 42 / 0.45);
    }
}

@media (min-width: 1024px) {
    [data-bj-sources-toggle].bj-sources-header {
        pointer-events: none;
        cursor: default;
    }
}

[data-bj-sources-panel][data-sources-expanded="1"] .bj-sources-chevron {
    transform: rotate(180deg);
}

.boboji-rank-card::before {
    counter-increment: boboji-rank;
    content: counter(boboji-rank);
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 20;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    background: #f59e0b;
    color: #000;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
