@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@200;400;600&display=swap');

:root {
    --bg-deep: #000000;
    --accent: #DE3520;
    --glass: rgba(15, 15, 15, 0.6);
    --border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.5);
    --easing: cubic-bezier(0.23, 1, 0.32, 1);
    /* 强力锁定主题，消灭蓝色 */
    --art-theme: #DE3520 !important;
}

html {
    background-color: #000;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

body {
    background-color: #000;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden; /* 防止双滚动条 */
}

/* 统一滚动条样式 */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) #000;
}

::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

::-webkit-scrollbar-track {
    background: #000000 !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 10px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent) !important;
}

/* 核心布局：回归 ArtPlayer 默认，仅对中心区域做限制 */
.art-controls {
    padding: 0 5px !important;
}

.art-controls-left,
.art-controls-right {
    background: transparent !important;
    white-space: nowrap !important;
}

/* 响应式控制已移除，全部保持可见 */
.art-controls-center {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-width: 0 !important;
    max-width: 350px !important;
    z-index: 10 !important;
    padding: 0 40px !important;
}

.artplayer-plugin-danmuku {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 300px !important;
}

.apd-emitter {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    height: 32px !important;
    overflow: hidden !important;
}

.apd-input {
    flex: 1 !important;
    height: 100% !important;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 13px !important;
}

.apd-send {
    height: 100% !important;
    background: var(--accent) !important;
    color: #fff !important;
    padding: 0 15px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    white-space: nowrap !important;
}

/* 蓝色覆盖 */
#artplayer .art-progress-played,
#artplayer .art-volume-panel-handle,
#artplayer .art-switch.art-checked .art-switch-inner,
#artplayer [style*="background-color: rgb(0, 161, 214)"] {
    background-color: var(--art-theme) !important;
}

/* ── 终极全局响应式锁定 (挂在 body 上) ── */
/* 大屏强制显示 */
body[data-player-small="false"] .art-control-episodes,
body[data-player-small="false"] .art-control-next {
    display: flex !important;
}

/* 小屏强制隐藏 */
body[data-player-small="true"] .art-control-episodes,
body[data-player-small="true"] .art-control-next {
    display: none !important;
}

body[data-player-tiny="true"] .art-control-danmuku {
    display: none !important;
}

body[data-player-small="true"] .art-controls-center {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(circle at center, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.8) 100%),
        linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
        url('/images/poster-wall.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    animation: pageIn 1s var(--easing) forwards;
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.99);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.page-out {
    opacity: 0 !important;
    transform: translateY(-10px) !important;
    filter: blur(10px) !important;
    transition: 0.5s var(--easing) !important;
}

header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    box-sizing: border-box !important;
}

#announcement-bar {
    position: fixed;
    top: 100px;
    left: 0;
    width: 100%;
    z-index: 2000; /* 调高 z-index 确保在最顶层 */
    padding: 10px 40px;
    display: flex;
    justify-content: center;
    pointer-events: none; /* 防止遮挡下方点击 */
}

.announcement-content {
    pointer-events: auto; /* 让公告栏本身可以点击 */
    background: rgba(20, 20, 20, 0.8); /* 颜色加深一点，防止被亮背景盖住 */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    animation: slideDown 0.8s var(--easing) forwards;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.announcement-icon {
    color: var(--accent);
    flex-shrink: 0;
}

#announcement-text {
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    #announcement-bar {
        top: 70px;
        padding: 10px 20px;
    }
    .announcement-content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    header {
        height: auto;
        min-height: 76px;
        padding: 14px 16px 12px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .brand {
        font-size: 16px !important;
        letter-spacing: 2px !important;
    }

    .nav-links {
        display: flex !important;
        width: 100%;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        margin-left: 0 !important;
        padding: 8px 12px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.06);
        font-size: 12px;
    }

    .nav-links a.active {
        background: rgba(222, 53, 32, 0.18);
        border-color: rgba(222, 53, 32, 0.6);
    }

    .nav-links a::after {
        display: none;
    }
}

.brand {
    font-size: 24px;
    font-weight: 200;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: #fff;
    flex-shrink: 0;
}

.brand b {
    font-weight: 600;
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 13px;
    letter-spacing: 1px;
    margin-left: 30px;
    transition: 0.3s;
    text-transform: uppercase;
    white-space: nowrap;
    position: relative;
    padding: 5px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: 0.4s var(--easing);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-links a.active {
    color: #fff !important;
    opacity: 1 !important;
}

.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover {
    color: #fff;
}

@media (max-width: 1000px) {
    header {
        padding: 0 20px;
    }

    .nav-links a {
        margin-left: 15px;
    }
}

@media (max-width: 768px) {
    header {
        height: auto;
        min-height: 76px;
        padding: 14px 16px 12px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .brand {
        font-size: 16px !important;
        letter-spacing: 2px !important;
    }

    .nav-links {
        display: flex !important;
        width: 100%;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        margin-left: 0 !important;
        padding: 8px 12px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.06);
        font-size: 12px;
    }

    .nav-links a.active {
        background: rgba(222, 53, 32, 0.18);
        border-color: rgba(222, 53, 32, 0.6);
    }

    .nav-links a::after,
    .nav-links a.active::after {
        display: none;
    }
}

.hero {
    height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: height 1s var(--easing);
}

.hero.active {
    height: 300px;
    min-height: 300px;
    padding-top: 100px;
    /* 避开 100px 的 Header */
    justify-content: flex-end;
    /* 靠下对齐，贴近播放器 */
    padding-bottom: 0;
}

@media (max-width: 768px) {
    .hero.active {
        padding-top: 70px;
        height: 250px;
        min-height: 250px;
    }
}

.hero.active .search-title {
    margin-bottom: 10px;
    font-size: 48px;
}

.hero.active .bg-image {
    opacity: 0;
    /* 完全隐藏旧背景，改用全局海报墙 */
}

.search-container {
    width: 100%;
    max-width: 660px;
    padding: 0 20px;
    z-index: 10;
    text-align: center;
    transition: var(--transition);
}

.hero.active .search-container {
    transform: scale(0.8);
    opacity: 0.6;
}

.search-title {
    font-size: 64px;
    font-weight: 200;
    margin-bottom: 40px;
    letter-spacing: -2px;
    -webkit-text-fill-color: transparent;
    opacity: 0.9;
    background: linear-gradient(rgb(255, 255, 255) 0%, rgb(170, 170, 170) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.search-bar {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 100px;
    padding: 10px;
    display: flex;
    align-items: center;
    transition: 0.5s var(--easing);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.05),
        0 15px 45px rgba(0, 0, 0, 0.4);
}

.search-bar:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.5);
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 0 20px;
    font-size: 17px;
    font-family: inherit;
    font-weight: 500;
}

#parse-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    color: #000;
    border: none;
    padding: 10px 28px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: 0.4s var(--easing);
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

#parse-btn:hover {
    transform: scale(1.05);
    background: #ffffff;
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

#parse-btn:active {
    transform: scale(0.98);
}

#parse-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.05);
}

.history-section {
    width: min(100%, 660px);
    margin: 24px auto 0;
    text-align: left;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    letter-spacing: 2px;
}

.history-head button {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.38);
    cursor: pointer;
    font: inherit;
    letter-spacing: 1px;
}

.history-head button:hover {
    color: #fff;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-card {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(15, 15, 15, 0.62);
    color: #fff;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    backdrop-filter: blur(24px);
}

.history-title {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    margin-top: 3px;
}

.history-action {
    align-self: center;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .search-title {
        font-size: 46px;
        margin-bottom: 26px;
    }

    .search-bar {
        flex-direction: column;
        border-radius: 20px;
        padding: 10px;
    }

    #url-input {
        padding: 15px;
        text-align: center;
        width: 100%;
    }

    #parse-btn {
        width: 100%;
        margin-top: 10px;
    }

    .history-section {
        margin-top: 18px;
    }

    .history-card {
        grid-template-columns: 1fr;
    }

    .history-action {
        align-self: start;
    }
}

.content-area {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto 10px;
    padding: 0 20px;
    opacity: 0;
    transform: translateY(30px);
    transition: 0.8s var(--easing);
    display: none;
}

.content-area.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.player-box {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .player-box {
        border-radius: 0;
        border: none;
        aspect-ratio: auto;
        height: 56.25vw;
    }
}

/* 动态幕布类：由 JS 控制开关 */
.has-theater-bg,
.has-theater-bg .art-mask {
    background:
        radial-gradient(circle at center, rgba(0, 0, 0, 0.7) 0%, #000 100%),
        linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
        url('/images/background.jpg') center/cover no-repeat !important;
}

/* 播放器基础容器背景：只在最底层保留黑色 */
#artplayer {
    background-color: #000;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
}

/* 内部层级必须透明，否则会遮挡视频 */
.art-video-player,
.art-video,
.art-mask:not(.has-theater-bg) {
    background: transparent !important;
}

/* 加载图标高亮 */
.art-loading svg,
.art-icon-loading svg {
    fill: #fff !important;
    color: #fff !important;
}

/* ── 极致纯净播放模式 (针对带有 ?url= 的直接跳转场景) ── */
html.pure-mode,
body.pure-mode {
    scrollbar-gutter: auto !important;
    overflow: hidden !important;
}

body.pure-mode header,
body.pure-mode .hero {
    display: none !important;
}

body.pure-mode .content-area {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
}

body.pure-mode .player-wrap,
body.pure-mode .player-box,
body.pure-mode #artplayer {
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    border: none !important;
    border-radius: 0 !important;
    aspect-ratio: auto !important;
    background: #000 !important;
}

/* ── 系统全屏状态兼容 ── */
#artplayer:fullscreen,
#artplayer:-webkit-full-screen {
    background: #000;
}

/* 强制让 ArtPlayer 内部所有层级撑满高度 */
.art-video-player,
.art-poster,
.art-video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    /* 保持比例但撑满容器，不留黑边（如果是 cover 会裁剪，这里建议用 contain 但确保容器本身是 16/9） */
}

#ep-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    max-width: 80%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    transform: translateX(100%);
    transition: 0.3s var(--easing);
    display: none;
    flex-direction: column;
}

#ep-panel.active {
    display: flex;
    transform: translateX(0);
}

.ep-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ep-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff !important;
}

.close-panel {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close-panel:hover {
    color: #fff;
}

#ep-list {
    padding: 15px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    /* 隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#ep-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.ep-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text-dim);
}

.ep-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.ep-item.current {
    background: var(--accent);
    color: white;
}

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#loading-overlay.active {
    display: flex;
}

.loading-bar {
    width: 200px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 50%;
    background: var(--accent);
    animation: loading 1.5s infinite var(--easing);
}

@keyframes loading {
    from {
        left: -50%;
    }

    to {
        left: 100%;
    }
}

#loading-text {
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.loading-bar {
    width: 200px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 50%;
    background: var(--accent);
    animation: loading 1.5s infinite var(--easing);
}

@keyframes loading {
    from {
        left: -50%;
    }

    to {
        left: 100%;
    }
}

#loading-text {
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.art-video-player {
    --art-padding: 0px !important;
}

/* ── Danmaku Click Fix (仅追加不改原有样式) ── */
.apd-emitter {
    overflow: visible !important;
}

.apd-style,
.apd-input,
.apd-send {
    pointer-events: auto !important;
    cursor: pointer !important;
}

.apd-input {
    cursor: text !important;
}
