* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 防止所有元素导致横向滚动 */
* {
    max-width: 100%;
}

img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

/* Toast提示样式 */
.toast-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    pointer-events: none;
}

/* iOS全屏横屏提示 */
@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a1a2e;
    color: #ffffff;
    min-height: 100vh;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    /* 防止横向滚动 */
    width: 100%;
    max-width: 100vw;
}

.app {
    max-width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* 防止横向滚动 */
}

/* 播放页面特定样式 */
.app.player-page {
    overflow: hidden;
    /* 完全隐藏溢出 */
    width: 100vw;
    max-width: 100vw;
}

/* 确保所有主要容器都不溢出 */
.main-content,
.player-content,
.video-container,
.video-controls,
.danmaku-container,
.fullscreen-episodes-panel,
.episode-list,
.episode-grid,
.source-list,
.recommend-grid,
.detail-section {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
}

/* 确保视频相关元素不溢出 */
.video-player {
    width: 100%;
    max-width: 100%;
    object-fit: contain;
}

.header {
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* UniApp Android WebView 使用沉浸式宿主窗口，普通页面需要自行避开系统状态栏。
   全屏播放时会移除这段额外顶部距离，避免左侧/顶部出现保留区。 */
body.android-app:not(.android-native-fullscreen) .app:not(.player-page) .header,
body.android-app:not(.android-native-fullscreen) .app.player-page .header,
html.android-app body:not(.android-native-fullscreen) .app:not(.player-page) .header,
html.android-app body:not(.android-native-fullscreen) .app.player-page .header {
    padding-top: calc(env(safe-area-inset-top, 0px) + 28px) !important;
}

/* 个人中心没有 header，剧集管理使用独立全屏浮层，需要分别补齐状态栏安全距离。 */
html.android-app body:not(.android-native-fullscreen) .profile-page {
    padding-top: calc(24px + env(safe-area-inset-top, 0px) + 28px) !important;
}

html.android-app body:not(.android-native-fullscreen) .diy-panel .diy-tip {
    padding-top: calc(10px + env(safe-area-inset-top, 0px) + 28px) !important;
}

.header-title {
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6px;
}

.header-search {
    display: flex;
    gap: 8px;
}

.header-search input {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.app.player-page .header-actions {
    display: none;
}

.profile-page {
    flex: 1;
    padding: 24px 16px calc(90px + env(safe-area-inset-bottom, 0px));
    background: #1a1a2e;
}

.profile-card {
    max-width: 560px;
    margin: 0 auto;
}

.profile-nickname {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    opacity: .96;
}

.profile-card .points-panel {
    display: flex;
    position: relative;
    max-width: none;
    margin: 0;
    padding: 16px;
    border-radius: 14px;
    background: #202a46;
    border: 1px solid rgba(255, 255, 255, .08);
}

.profile-card .diy-points-avatar {
    display: block;
    width: 62px;
    height: 62px;
    border: 0;
    background: rgba(255, 255, 255, .12);
}

.profile-card .diy-points-header {
    width: 100%;
    box-sizing: border-box;
}

.profile-card .diy-points-info {
    padding-right: 0;
}

.profile-user-name {
    margin-bottom: 5px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.profile-stat-line {
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
    line-height: 1.65;
}

.profile-points-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-card .points-contact {
    display: inline-block;
    margin: 0;
    padding: 3px 0;
    white-space: nowrap;
}

.profile-settings-list {
    margin-top: 14px;
    overflow: hidden;
    border-radius: 14px;
    background: #202a46;
}

.profile-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #fff;
    background: transparent;
    font-size: 14px;
    text-align: left;
}

.profile-setting-row:last-child {
    border-bottom: 0;
}

.profile-setting-row>b {
    color: #60a5fa;
    font-size: 13px;
}

.profile-theme-value {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #9ca3af;
    font-size: 12px;
}

.theme-switch {
    width: 38px;
    height: 22px;
    padding: 2px;
    border-radius: 12px;
    background: #667eea;
}

.theme-switch b {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transform: translateX(16px);
}

.theme-switch.light-active b {
    transform: translateX(0);
}

.profile-logout-action {
    display: block;
    width: auto;
    min-height: 44px;
    margin: 14px auto 0;
    padding: 10px 18px;
    border: 0;
    color: #ef4444;
    background: transparent;
    font-size: 15px;
    cursor: pointer;
}

.profile-logout-action:active {
    opacity: 0.65;
}

.profile-card .points-contact {
    color: #aebcff;
    background: transparent;
}

.bottom-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    display: flex;
    height: calc(58px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(22, 33, 62, .98);
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.bottom-tab {
    flex: 1;
    border: 0;
    color: #9ca3af;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.bottom-tab span {
    display: block;
    font-size: 22px;
    line-height: 23px;
    margin-bottom: 3px;
}

.bottom-tab .profile-tab-icon {
    height: 21px;
}

.profile-tab-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bottom-tab .home-tab-icon {
    height: 21px;
}

.home-tab-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bottom-tab em {
    font-style: normal;
}

.bottom-tab.active {
    color: #fff;
}

body.light-mode .bottom-tabbar {
    background: #fff;
    border-top-color: #e5e7eb;
}

body.light-mode .bottom-tab.active {
    color: #667eea;
}

body.light-mode .bottom-tab {
    color: #9ca3af;
}

body.light-mode .profile-card {
    color: #333;
}

body.light-mode .profile-page {
    background: #f5f7fb;
}

body.light-mode .profile-card .points-panel {
    background: #fff;
    border-color: #e5e7eb;
}

body.light-mode .profile-card .profile-settings-list {
    background: #fff;
}

body.light-mode .profile-setting-row {
    color: #333;
    border-bottom-color: #e5e7eb;
}

body.light-mode .profile-user-name {
    color: #333;
}

body.light-mode .profile-stat-line {
    color: #6b7280;
}

.header-search input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-btn {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.nav-tabs {
    display: flex;
    background: #16213e;
    padding: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    flex-shrink: 0;
    padding: 14px 18px;
    color: #a0a0a0;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.tab-item.active {
    color: #fff;
    font-weight: bold;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.main-content {
    flex: 1;
    padding: 12px 12px calc(78px + env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    /* 防止横向滚动 */
    width: 100%;
    max-width: 100%;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #888;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #333;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.video-card {
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.video-card:active {
    transform: scale(0.98);
}

.video-card .poster {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: #0f0f23;
}

.video-card .info {
    padding: 8px;
}

.video-card .title {
    font-size: 13px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-card .meta {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

.video-card .rating {
    color: #ffd700;
}

.load-more {
    text-align: center;
    padding: 20px;
}

.load-more-btn {
    padding: 12px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.player-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px 10px;
}

.back-btn,
.share-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
}

.back-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.back-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.light-mode .app.player-page .back-btn {
    color: #374151;
}

.featured-section {
    display: none;
    margin: 0 0 16px;
}

.featured-card {
    position: relative;
    min-height: 190px;
    overflow: hidden;
    border-radius: 12px;
    background: #111827;
    cursor: pointer;
}

.featured-cover {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
}

.featured-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 7px;
    padding: 18px;
    background: linear-gradient(180deg, transparent 25%, rgba(0, 0, 0, .82) 100%);
    color: #fff;
}

.featured-label {
    font-size: 20px;
    font-weight: 700;
}

.featured-meta {
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

.featured-play {
    align-self: flex-start;
    padding: 8px 18px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    font-size: 13px;
    cursor: pointer;
}

.featured-play:active {
    background: #596bd6;
    transform: scale(0.98);
}

.diy-landscape-upload {
    min-height: 110px;
}

body.light-mode .featured-card {
    box-shadow: 0 4px 14px rgba(31, 41, 55, .12);
}

.player-header .header-title {
    position: absolute;
    left: 50%;
    max-width: calc(100% - 110px);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateX(-50%);
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    aspect-ratio: 16/9;
}

.video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-player::-webkit-media-controls {
    display: none !important;
}

.video-player::-webkit-media-controls-enclosure {
    display: none !important;
}

.video-player::-webkit-media-controls-panel {
    display: none !important;
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 5;
}

.video-play-overlay.hidden {
    display: none;
}

.video-play-overlay .play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.video-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.video-controls.hidden {
    opacity: 0;
    pointer-events: none;
}

.video-controls.hidden .controls-top,
.video-controls.hidden .controls-bottom {
    pointer-events: none;
}

.fullscreen-side-lock {
    display: none;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 120;
    width: 32px;
    height: 32px;
    padding: 4px;
    border: 0;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.28);
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.fullscreen-side-lock img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.video-container:fullscreen .fullscreen-side-lock,
.video-container:-webkit-full-screen .fullscreen-side-lock {
    display: flex;
}

.video-container:fullscreen,
.video-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    background: #000 !important;
}

.video-container:fullscreen .video-player,
.video-container:-webkit-full-screen .video-player {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.video-container:fullscreen .video-controls,
.video-container:-webkit-full-screen .video-controls {
    position: absolute !important;
    inset: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.video-container:fullscreen .controls-top,
.video-container:-webkit-full-screen .controls-top {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 30 !important;
    display: flex !important;
}

.video-container:fullscreen .controls-bottom,
.video-container:-webkit-full-screen .controls-bottom {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 30 !important;
}

.video-container.controls-locked .video-controls {
    opacity: 0;
    pointer-events: none;
}

.video-container.controls-locked .fullscreen-side-lock {
    background: rgba(0, 0, 0, 0.58);
}

.controls-top {
    background: linear-gradient(rgba(0, 0, 0, 0.8), transparent);
    padding: 12px;
    display: none;
    align-items: center;
    pointer-events: auto;
}

.controls-top.show {
    display: flex;
}

.fullscreen-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 10px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.video-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    min-width: 0;
}

.fullscreen-back-btn img {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.video-title {
    flex-shrink: 1;
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-episode {
    flex-shrink: 0;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.controls-bottom {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 30px 16px 12px;
    pointer-events: auto;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    max-width: 100%;
}

.progress-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.progress-row {
    gap: 12px;
}

.control-row {
    display: none;
}

.small-screen-only {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 32px;
}

.video-container:fullscreen .control-row,
.video-container:-webkit-full-screen .control-row {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 12px;
}

.video-container:fullscreen .small-screen-only,
.video-container:-webkit-full-screen .small-screen-only {
    display: none;
}

.video-container:fullscreen .controls-bottom,
.video-container:-webkit-full-screen .controls-bottom {
    padding-top: 18px;
}

.video-container:fullscreen .episodes-btn,
.video-container:fullscreen .episodes-btn:hover,
.video-container:-webkit-full-screen .episodes-btn,
.video-container:-webkit-full-screen .episodes-btn:hover {
    background: transparent !important;
    box-shadow: none !important;
}

.control-row .image-control {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.image-control img {
    display: block;
    width: 27px;
    height: 27px;
    object-fit: contain;
}

.seek-back-btn img {
    width: 26px;
    height: 26px;
}

.play-icon-glyph {
    color: #fff;
    font-size: 24px;
    line-height: 1;
}

.play-btn .pause-state-icon {
    display: none;
}

.play-btn.is-playing .play-icon-glyph {
    display: none;
}

.play-btn.is-playing .pause-state-icon {
    display: block;
}

.danmaku-toggle-btn.is-off {
    opacity: 0.45;
}

.danmaku-container.danmaku-disabled {
    display: none !important;
}

.image-control:active,
.text-control:active {
    transform: translateY(1px);
}

.control-row .text-control {
    flex: 0 0 auto;
    min-width: 42px;
    height: 32px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.danmaku-input-player {
    flex: 0 0 200px;
    width: 200px;
    min-width: 120px;
    margin: 0;
}

.settings-btn {
    margin-right: 6px;
}

.control-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.exit-fullscreen-image {
    display: block;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.danmaku-input-player input {
    display: block;
    width: 100%;
    height: 32px;
    box-sizing: border-box;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    outline: none;
    background: #fff;
    color: #222;
    font-size: 12px;
}

.danmaku-input-player input::placeholder {
    color: #777;
}

.danmaku-input-player input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

@media (max-width: 420px) {
    .controls-bottom {
        padding-left: 8px;
        padding-right: 8px;
        gap: 6px;
    }

    .control-row {
        gap: 7px;
    }

    .control-row .image-control {
        flex-basis: 28px;
        width: 28px;
        height: 30px;
    }

    .image-control img {
        width: 24px;
        height: 24px;
    }

    .seek-back-btn img {
        width: 26px;
        height: 26px;
    }

    .control-row .text-control {
        min-width: 38px;
        padding-left: 5px;
        padding-right: 5px;
        font-size: 12px;
    }

    .settings-btn {
        margin-right: 3px;
    }

    .control-actions {
        gap: 4px;
    }

    .danmaku-input-player {
        flex-basis: 120px;
        width: 120px;
        min-width: 72px;
    }
}

@media (min-width: 768px) {
    .controls-bottom {
        padding: 30px 40px 12px;
    }
}

@media (min-width: 1024px) {
    .controls-bottom {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    flex: 1;
    min-width: 0;
}

.progress-played {
    height: 100%;
    background: #667eea;
    border-radius: 2px;
    width: 0%;
}

.progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}

.time-display {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.episodes-btn {
    font-size: 14px;
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
    padding: 6px 12px;
    transition: background 0.3s;
}

.episodes-btn.hidden {
    display: none;
}

.episodes-btn:hover {
    background: rgba(102, 126, 234, 0.8);
}

.fullscreen-episodes-panel {
    position: absolute;
    top: 0;
    right: -100%;
    left: auto;
    width: 40%;
    max-width: 420px;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    opacity: 0;
}

.fullscreen-episodes-panel.show {
    right: 0;
    left: auto;
    pointer-events: auto;
    opacity: 1;
}

.episodes-panel-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.episodes-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

.episodes-panel-close {
    display: none;
}

.episodes-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.episodes-panel-body::-webkit-scrollbar {
    width: 4px;
}

.episodes-panel-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.episodes-panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.fullscreen-episodes-panel .episode-grid .episode-item {
    text-align: center;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: #fff;
    padding: 10px 8px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.5;
}

.fullscreen-episodes-panel .episode-grid .episode-item.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    color: #4ade80;
}

.fullscreen-episodes-panel .episode-grid .playing-indicator {
    height: 16px;
}

.fullscreen-episodes-panel .episode-grid .playing-indicator i {
    width: 4px;
    background: #4ade80;
    border-radius: 3px;
}

.fullscreen-episodes-panel .episode-grid .episode-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.danmaku-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 40px;
    overflow: hidden;
    pointer-events: none;
}

.danmaku-item {
    position: absolute;
    white-space: nowrap;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    animation: danmakuMove linear forwards;
    pointer-events: none;
}

@keyframes danmakuMove {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(-100%);
    }
}

.player-tabs {
    display: flex;
    background: #16213e;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    align-items: center;
    max-width: 100%;
    /* 防止超出父容器 */
    width: 100%;
}

.danmaku-input-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.danmaku-input-inline input {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    outline: none;
    width: 120px;
}

.danmaku-input-inline input::placeholder {
    color: #666;
}

.danmaku-icon {
    font-size: 18px;
    cursor: default;
}

.player-tabs::-webkit-scrollbar {
    display: none;
}

.ptab-item {
    flex-shrink: 0;
    padding: 12px 16px;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.ptab-item.active {
    color: #fff;
    border-bottom: 2px solid #667eea;
}

.player-content {
    padding: 12px;
    padding-bottom: 20px;
    overflow-x: hidden;
    /* 防止横向滚动 */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.detail-info {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.detail-poster {
    width: 100px;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    background: #0f0f23;
}

.detail-meta {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.detail-title {
    font-size: 18px;
    margin: 0;
    line-height: 1.4;
}

.detail-title-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-episodes {
    font-size: 13px;
    color: #667eea;
    font-weight: normal;
}

.detail-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0;
    min-width: 0;
    max-width: 100%;
}

.intro-toggle {
    font-size: 14px;
    color: #888;
    cursor: default;
    flex: 0 0 auto;
    white-space: nowrap;
    margin-left: 8px;
}

.detail-actions {
    display: flex;
    margin-top: 12px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px 4px;
}

.action-btn {
    font-size: 11px;
    color: #a0b0ff;
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1 1 44px;
    min-width: 40px;
    max-width: 64px;
    white-space: nowrap;
}

.action-btn .icon {
    font-size: 16px;
}

/* 手机上的详情信息区必须在海报右侧收缩，避免简介和操作项把页面撑出视口。 */
@media (max-width: 600px) {
    .detail-info {
        align-items: flex-start;
    }

    .detail-poster {
        flex: 0 0 100px;
    }

    .detail-title-row {
        display: block;
    }

    .detail-title-group {
        width: 100%;
    }

    .intro-toggle {
        display: block;
        margin: 6px 0 0;
    }

    .detail-desc {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .detail-actions {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px 2px;
    }

    .action-btn {
        width: auto;
        min-width: 0;
        max-width: none;
        font-size: 10px;
    }
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.detail-tags .tag {
    padding: 2px 8px;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
    font-size: 11px;
    color: #a0b0ff;
}

.detail-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #888;
}

.detail-stats strong {
    color: #ffd700;
}

.detail-desc {
    font-size: 12px;
    color: #aaa;
    line-height: 1.6;
}

.detail-section {
    margin-top: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 0;
    padding-bottom: 8px;
}

.comment-input,
.danmaku-input {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.comment-input input,
.danmaku-input input {
    flex: 1;
    padding: 10px 14px;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.danmaku-input select {
    padding: 10px;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    color: #fff;
    outline: none;
}

.send-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #16213e;
    border-radius: 8px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-user {
    font-size: 13px;
    color: #a0b0ff;
    margin-bottom: 4px;
}

.comment-text {
    font-size: 14px;
    color: #ddd;
    line-height: 1.5;
}

.comment-time {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

.danmaku-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.danmaku-history-item {
    padding: 10px 12px;
    background: #16213e;
    border-radius: 8px;
    font-size: 13px;
}

.danmaku-history-item .time {
    color: #667eea;
    margin-right: 8px;
}

.intro-content {
    font-size: 14px;
    color: #ccc;
    line-height: 1.8;
}

.source-list {
    display: flex;
    gap: 10px;
}

.source-item {
    padding: 14px 16px;
    background: #16213e;
    border-radius: 8px;
    cursor: pointer;
    max-width: 200px;
}

.source-item.active {
    border: 1px solid #667eea;
}

.source-name {
    font-size: 14px;
}

.source-quality {
    font-size: 12px;
    color: #ffd700;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.expand-btn {
    font-size: 12px;
    color: #a0b0ff;
    cursor: pointer;
    padding: 4px 12px;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 20px;
}

.episode-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
}

.episode-list::-webkit-scrollbar {
    display: none;
}

.episode-item {
    padding: 10px 16px;
    background: #16213e;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.episode-grid .episode-item {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 12px 16px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.playing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    vertical-align: middle;
    height: 12px;
}

.playing-indicator i {
    display: inline-block;
    width: 3px;
    height: 100%;
    background: currentColor;
    border-radius: 2px;
    animation: playingWave 0.8s ease-in-out infinite;
}

.playing-indicator i:nth-child(1) {
    animation-delay: 0s;
    height: 40%;
}

.playing-indicator i:nth-child(2) {
    animation-delay: 0.15s;
    height: 80%;
}

.playing-indicator i:nth-child(3) {
    animation-delay: 0.3s;
    height: 60%;
}

@keyframes playingWave {

    0%,
    100% {
        transform: scaleY(0.5);
        opacity: 0.6;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.episode-item.vip {
    position: relative;
}

.episode-item.vip::after {
    content: 'VIP';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    background: #ffd700;
    color: #000;
    padding: 1px 3px;
    border-radius: 2px;
}

.episode-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.episode-modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border-radius: 20px 20px 0 0;
    max-height: calc(100vh - 300px);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2a4a;
}

.modal-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.sort-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #888;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sort-btn.active {
    color: #667eea;
}

.sort-icon {
    width: 18px;
    height: 18px;
}

.layout-icon {
    width: 22px;
    height: 22px;
    display: block;
    pointer-events: none;
}

.modal-close {
    font-size: 24px;
    color: #888;
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.episode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.episode-grid.layout-double {
    grid-template-columns: 1fr 1fr;
}

.episode-grid .episode-item {
    width: 100%;
    text-align: center;
    padding: 12px 16px;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.recommend-card {
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.recommend-card .poster {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: #0f0f23;
}

.recommend-card .title {
    padding: 8px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden {
    display: none !important;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-top .header-title {
    margin-bottom: 0;
    font-size: 18px;
}

.header-actions {
    position: relative;
    display: flex;
    gap: 8px;
}

.settings-menu-btn {
    width: 38px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: transparent;
    font-size: 22px;
    line-height: 36px;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.settings-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    z-index: 3000;
    display: none;
    min-width: 190px;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: #252525;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.settings-dropdown.show {
    display: block;
}

.settings-item {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 11px 12px;
    border: 0;
    border-radius: 8px;
    color: #f5f5f5;
    background: transparent;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.settings-item-icon {
    width: 20px;
    text-align: center;
}

body.light-mode .settings-dropdown {
    background: #fff;
    border-color: #e5e7eb;
}

body.light-mode .settings-item {
    color: #333;
}

body.light-mode .settings-item:hover {
    background: #f3f4f6;
}

body.light-mode .settings-menu-btn {
    color: #374151;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

body.light-mode .header-search input {
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(31, 41, 55, 0.06);
}

body.light-mode .header-search input::placeholder {
    color: #9ca3af;
}

body.light-mode .search-btn {
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(15deg);
}

body.light-mode {
    background-color: #f5f5f5;
    color: #333333;
}

body.light-mode .nav-tabs {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-mode .tab-item {
    color: #888888;
}

body.light-mode .tab-item.active {
    color: #667eea;
}

body.light-mode .main-content {
    background: #f5f5f5;
}

body.light-mode .video-card {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .video-card .title {
    color: #333;
}

body.light-mode .video-card .meta {
    color: #888;
}

body.light-mode .ptab-item {
    color: #888;
}

body.light-mode .ptab-item.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

body.light-mode .player-content {
    background: #f5f5f5;
}

body.light-mode .detail-poster {
    background: #e0e0e0;
}

body.light-mode .detail-tags .tag {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

body.light-mode .detail-stats {
    color: #888;
}

body.light-mode .detail-desc {
    color: #666;
}

body.light-mode .comment-input input,
body.light-mode .danmaku-input input,
body.light-mode .danmaku-input select {
    background: #ffffff;
    border-color: #e0e0e0;
    color: #333;
}

body.light-mode .comment-item {
    background: #ffffff;
}

body.light-mode .comment-user {
    color: #667eea;
}

body.light-mode .comment-text {
    color: #333;
}

body.light-mode .comment-time {
    color: #aaa;
}

body.light-mode .danmaku-history-item {
    background: #ffffff;
    color: #333;
}

body.light-mode .intro-content {
    color: #555;
}

body.light-mode .source-item {
    background: #ffffff;
    color: #333;
}

body.light-mode .source-item.active {
    border-color: #667eea;
}

body.light-mode .episode-item {
    background: #ffffff;
    color: #333;
}

body.light-mode .episode-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

body.light-mode .episodes-btn {
    background: rgba(102, 126, 234, 0.3);
    color: #333;
}

body.light-mode .episodes-btn:hover {
    background: rgba(102, 126, 234, 0.5);
}

body.light-mode .expand-btn {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

body.light-mode .recommend-card {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .recommend-card .poster {
    background: #e0e0e0;
}

body.light-mode .recommend-card .title {
    color: #333;
}

body.light-mode .loading {
    color: #888;
}

body.light-mode .loading-spinner {
    border-color: #e0e0e0;
    border-top-color: #667eea;
}

body.light-mode .load-more-btn {
    background: #667eea;
    color: #fff;
}

body.light-mode .modal-content {
    background: #ffffff;
}

body.light-mode .modal-header {
    border-bottom: 1px solid #e0e0e0;
}

body.light-mode .modal-title {
    color: #333;
}

body.light-mode .sort-btn {
    color: #666;
}

body.light-mode .sort-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

body.light-mode .sort-btn.active {
    color: #667eea;
}

body.light-mode .episode-grid .episode-item {
    background: #f5f5f5;
    color: #333;
}

body.light-mode .episode-grid .episode-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* iOS CSS 全屏模式 */
body.ios-fullscreen-active {
    overflow: hidden;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: #000;
    overflow: hidden;
}

/* 隐藏非视频区域 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen>*:not(.video-container) {
    display: none !important;
}

/* 视频容器填满屏幕 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    background: #000;
    z-index: 10000;
    overflow: hidden;
}

/* 视频元素 - 铺满整个屏幕 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    z-index: 1;
    background: #000;
}

/* 自定义控件 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls {
    display: block !important;
    position: absolute;
    z-index: 100;
    width: 100%;
    left: 0;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999998 !important;
    width: 100%;
    padding-top: env(safe-area-inset-top, 20px);
    padding-left: 12px;
    padding-right: 12px;
    background: transparent;
    flex-direction: row !important;
    align-items: center !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999999 !important;
    width: 100%;
    padding: 12px 16px;
    padding-bottom: env(safe-area-inset-bottom, 20px);
    background: transparent;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
}

/* iOS全屏模式 - 底部控件元素对齐 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .play-btn,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .episodes-btn,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .fullscreen-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 36px !important;
    min-height: 36px !important;
    height: 36px !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .progress-bar {
    display: flex !important;
    align-items: center !important;
    height: 4px !important;
    min-height: 4px !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom .time-display {
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

/* 横屏优化 */
@media screen and (orientation: landscape) {

    /* 顶部控件 - 横屏时确保flex布局 */
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top {
        padding-top: env(safe-area-inset-top, 10px);
    }

    /* 视频元素高度 - 铺满整个屏幕 */
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
        height: 100vh !important;
        max-height: 100vh !important;
    }

    /* 底部控件 - 横屏时强制在最上层 */
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 70px !important;
        padding: 0 16px !important;
        padding-bottom: env(safe-area-inset-bottom, 10px) !important;
        background: rgba(0, 0, 0, 0.9) !important;
        z-index: 99999 !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
    }

    /* 弹幕容器高度调整 */
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
        height: 100vh !important;
        max-height: 100vh !important;
    }
}

/* 微信浏览器全屏模式特殊处理 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-player {
    /* 微信环境下额外调整 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

/* 微信环境下确保控件在最上层 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: transparent;
    z-index: 9999 !important;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .controls-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999 !important;
    background: transparent;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* 微信环境下强制重绘，确保控件显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-controls .control-btn,
body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-controls .progress-bar {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* 详情页集数信息 - 浅色模式 */
body.light-mode .detail-episodes {
    color: #667eea;
}

/* iOS横屏模式 - 确保进度条和控件元素可见 */
@media screen and (orientation: landscape) {

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .control-btn,
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .progress-bar,
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .time-display {
        position: relative !important;
        z-index: 100000 !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        transform: translate3d(0, 0, 0) !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .progress-bar {
        flex: 1 !important;
        height: 4px !important;
        min-height: 4px !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .controls-bottom {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        gap: 12px !important;
    }
}

/* iOS横屏模式 - 微信环境额外优化 */
@media screen and (orientation: landscape) {
    body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-controls {
        position: fixed !important;
        bottom: 0 !important;
        z-index: 999999 !important;
        background: transparent !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .video-player {
        height: 100vh !important;
        max-height: 100vh !important;
    }
}

/* iOS全屏模式 - video-info布局优化 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    min-width: 0;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-title {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-episode {
    flex-shrink: 0;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

/* iOS横屏模式 - video-info布局优化 */
@media screen and (orientation: landscape) {
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-info {
        flex: 1;
        display: flex;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px;
        min-width: 0;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-title {
        flex-shrink: 1;
        font-size: 13px;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-episode {
        flex-shrink: 0;
        font-size: 13px;
        margin-top: 0;
    }
}

/* iOS全屏模式 - 强制隐藏所有非视频元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .header,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .header.player-header,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .main-content,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .player-tabs,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .player-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* iOS全屏模式 - 确保video-container的子元素正常显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container>* {
    display: block !important;
}

/* iOS全屏模式 - 控件和弹幕容器可见 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-bottom,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* iOS全屏模式 - 选集面板默认隐藏 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    left: auto !important;
    width: 40% !important;
    max-width: 420px !important;
    height: 100% !important;
    z-index: 1000 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: right 0.3s ease, opacity 0.3s ease !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-episodes-panel.show {
    right: 0 !important;
    left: auto !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* video-play-overlay 只在暂停时显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px;
    z-index: 50;
    background: transparent;
    pointer-events: auto;
}

/* 隐藏播放图标 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-play-overlay .play-icon {
    display: none !important;
}

/* 隐藏播放覆盖层 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-play-overlay.hidden {
    display: none !important;
    pointer-events: none;
}

/* iOS全屏模式 - 移除所有间距和滚动 */
body.ios-fullscreen-active {
    overflow: hidden !important;
    width: 100vh !important;
    height: 100vw !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen {
    margin: 0 !important;
    padding: 0 !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* iOS全屏模式 - 确保body没有滚动条 */
body.ios-fullscreen-active html,
body.ios-fullscreen-active body {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* iOS全屏模式 - 完全固定页面，禁止滚动 */
body.ios-fullscreen-active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: hidden !important;
    z-index: 9999 !important;
}

/* iOS全屏模式 - 超强力隐藏规则 */
body.ios-fullscreen-active header,
body.ios-fullscreen-active .header,
body.ios-fullscreen-active .header.player-header,
body.ios-fullscreen-active .player-tabs,
body.ios-fullscreen-active .player-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* 确保video-container是唯一可见的顶层元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen> :not(.video-container) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* video-container内部元素显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container>* {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
}

/* iOS环境 - 页面加载时就隐藏header（可选） */
.is-ios-device .header.player-header {
    /* 如果想一开始就隐藏header，取消下面的注释 */
    /* display: none !important; */
}

/* ========================================
   iOS 全屏模式 - 终极修复方案
   ======================================== */

/* 方案1: 使用否定选择器 - 但排除video-container内的元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen {
    display: flex !important;
    flex-direction: column !important;
}

/* 只隐藏video-container的兄弟元素，不影响其内部元素 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen>.header,
body.ios-fullscreen-active .app.player-page.ios-fullscreen>.player-tabs,
body.ios-fullscreen-active .app.player-page.ios-fullscreen>.player-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -10000px !important;
    top: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* 确保video-container及其子元素可见 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen>.video-container,
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container>* {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    top: auto !important;
}

/* 方案2: 直接针对要隐藏的元素 */
body.ios-fullscreen-active header,
body.ios-fullscreen-active .header,
body.ios-fullscreen-active .player-tabs,
body.ios-fullscreen-active main.player-content {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    left: -100vw !important;
    top: -100vh !important;
    z-index: -9999 !important;
}

/* 方案3: 确保video-container可见 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1 !important;
}

/* 方案4: 强制覆盖可能的inline样式 */
body.ios-fullscreen-active header[style],
body.ios-fullscreen-active .header[style] {
    display: none !important;
}

/* iOS全屏模式 - 确保controls-top始终在顶部 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    z-index: 99998 !important;
    margin: 0 !important;
    padding: 12px !important;
    padding-top: calc(env(safe-area-inset-top, 20px) + 12px) !important;
}

/* 确保controls-top的子元素正确显示 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top>* {
    position: relative !important;
    display: inline-block !important;
}

/* 返回按钮固定在左侧 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .fullscreen-back-btn {
    position: relative !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
    /* background: rgba(255, 255, 255, 0.2) !important; */
    pointer-events: auto !important;
    touch-action: manipulation !important;
    z-index: 10002 !important;
}

/* 全屏状态下按钮透明背景 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .control-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .episodes-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .fullscreen-btn {
    background: transparent !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .play-btn {
    background: transparent !important;
}

/* video-info占据剩余空间 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .controls-top .video-info {
    flex: 1 !important;
    min-width: 0 !important;
    position: relative !important;
}

/* iOS全屏模式 - video-controls不应该影响controls-top的定位 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    z-index: 99999 !important;
}

/* iOS全屏模式 - controls-top独立定位，不受video-controls影响 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .controls-top {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    z-index: 99999 !important;
}

/* iOS全屏模式 - controls-bottom保持在底部 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .controls-bottom {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
}

/* iOS微信环境 - 确保controls-top在顶部 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen.wechat-env .controls-top {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 999999 !important;
    -webkit-transform: none !important;
    transform: none !important;
}

/* 确保层级关系正确 */
body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 1 !important;
}

body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 100vh !important;
    z-index: 2 !important;
}

/* 横屏模式 - 确保controls-top始终在顶部 */
@media screen and (orientation: landscape) {
    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-controls .controls-top {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        z-index: 99999 !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .video-player {
        height: 100vh !important;
        z-index: 1 !important;
    }

    body.ios-fullscreen-active .app.player-page.ios-fullscreen .danmaku-container {
        height: 100vh !important;
        z-index: 2 !important;
    }
}

.diy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.diy-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.diy-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.diy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
}

.diy-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: #1a1a2e;
    overflow-y: auto;
    z-index: 1;
}

.diy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 16px 0;
    border-bottom: 1px solid #2a2a4a;
    background: #1a1a2e;
}

.diy-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-align: center;
}

.diy-clear-cache-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.diy-clear-cache-btn:hover {
    background: rgba(255, 107, 107, 0.25);
    border-color: rgba(255, 107, 107, 0.5);
}

.diy-tip {
    padding: 10px 16px;
    background: rgba(102, 126, 234, 0.1);
    color: #a0b0ff;
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid #2a2a4a;
}

.diy-close {
    font-size: 24px;
    color: #888;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.diy-body {
    padding: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.diy-form-item {
    margin-bottom: 18px;
}

.diy-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 8px;
}

.diy-input {
    width: 100%;
    padding: 12px 14px;
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.diy-input:focus {
    border-color: #667eea;
}

.diy-input::placeholder {
    color: #555;
}

.diy-upload-area {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border: 2px dashed #2a2a4a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.3s;
}

.diy-upload-row {
    display: flex;
    gap: 16px;
}

.diy-upload-row .diy-form-item {
    flex: 1;
}

.diy-upload-area:hover {
    border-color: #667eea;
}

.diy-upload-placeholder {
    color: #666;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.diy-preview-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.diy-video-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

.diy-video-name {
    color: #a0b0ff;
    font-size: 13px;
    word-break: break-all;
    padding: 12px;
}

.diy-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.3s, transform 0.2s;
    text-align: center;
}

.diy-submit-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

.diy-skip-btn {
    background: transparent;
    border: 1px solid #667eea;
    color: #667eea;
    margin-top: 12px;
}

.diy-skip-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.diy-field-tip {
    margin-top: 6px;
    color: #8a8f98;
    font-size: 12px;
    line-height: 1.5;
}

.diy-video-url-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.diy-video-url-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
}

.diy-video-url-order {
    color: #aeb4c0;
    font-size: 13px;
    white-space: nowrap;
}

.diy-remove-url-btn,
.diy-add-url-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #3a4160;
    border-radius: 6px;
    background: #202947;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.diy-remove-url-btn {
    color: #ff8b8b;
}

.diy-add-url-btn {
    margin-top: 10px;
    margin-left: 56px;
    color: #9eafff;
}

.diy-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.diy-upload-grid .diy-upload-area {
    aspect-ratio: auto;
    min-height: 136px;
    border: 1px solid #2a2a4a;
    border-radius: 10px;
    background: #16213e;
}

.diy-upload-grid .diy-upload-video-tile {
    grid-column: 1 / -1;
    min-height: 136px;
}

.diy-upload-grid .diy-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 14px 8px;
}

.diy-upload-grid .diy-upload-placeholder b {
    color: #eb6b52;
    font-size: 25px;
    font-weight: 300;
    line-height: 1;
}

.diy-upload-grid .diy-upload-placeholder strong {
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.diy-upload-grid .diy-upload-placeholder small {
    display: block;
    margin-top: 3px;
    color: #a3a3a3;
    font-size: 11px;
    font-weight: 400;
}

.diy-upload-grid .diy-upload-placeholder span {
    color: #777;
    font-size: 12px;
}

.diy-upload-grid .diy-reupload-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 2;
    display: none;
    width: auto;
    margin: 0;
    padding: 5px 9px;
    font-size: 11px;
}

.diy-upload-grid .diy-preview-img:not([style*="display:none"])~.diy-reupload-btn,
.diy-upload-grid .diy-video-preview:not([style*="display:none"])~.diy-reupload-btn {
    display: block;
}

body.light-mode .diy-upload-grid .diy-upload-area {
    background: #f8fafc;
    border-color: #d1d5db;
}

body.light-mode .diy-upload-grid .diy-upload-placeholder strong {
    color: #374151;
}

.diy-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.diy-form-actions {
    display: flex;
    gap: 10px;
}

.diy-form-actions .diy-submit-btn {
    flex: 1;
}

.diy-manage-list {
    display: none;
    padding: 12px 16px;
    background: #1a1a2e;
}

.diy-empty-list {
    padding: 28px 12px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

.diy-manage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
}

.diy-manage-item img {
    width: 42px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    background: #2a2a4a;
}

.diy-manage-info {
    flex: 1;
    min-width: 0;
}

.diy-manage-info strong {
    display: block;
    color: #fff;
    font-size: 14px;
}

.diy-manage-info span {
    color: #9ca3af;
    font-size: 12px;
}

.diy-feature-btn {
    padding: 6px 9px;
    border: 1px solid #667eea;
    border-radius: 5px;
    color: #a0b0ff;
    background: transparent;
    font-size: 12px;
}

.diy-feature-btn.active {
    color: #fff;
    background: #667eea;
}

body.light-mode .diy-manage-list {
    background: #fff;
}

body.light-mode .diy-manage-item {
    border-color: #e5e7eb;
}

body.light-mode .diy-manage-info strong {
    color: #333;
}

.diy-add-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: #fff;
    background: rgba(102, 126, 234, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    cursor: pointer;
}

.diy-add-btn.disabled,
.diy-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.diy-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.diy-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    color: #fff;
    background: transparent;
    cursor: pointer;
}

.diy-back-btn svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

body.light-mode .diy-back-btn {
    color: #374151;
}

/* 浅色主题：剧集管理表单、上传区域和详情弹层 */
body.light-mode .diy-content,
body.light-mode .diy-header {
    background: #f5f7fb;
    color: #333;
}

body.light-mode .diy-header {
    border-bottom-color: #e5e7eb;
}

body.light-mode .diy-header h3,
body.light-mode .diy-label {
    color: #374151;
}

body.light-mode .diy-tip {
    color: #667eea;
    background: rgba(102, 126, 234, .08);
    border-bottom-color: #e5e7eb;
}

body.light-mode .diy-input {
    color: #1f2937;
    background: #fff;
    border-color: #d1d5db;
}

body.light-mode .diy-input::placeholder {
    color: #9ca3af;
}

body.light-mode .diy-upload-area {
    border-color: #d1d5db;
    background: #fff;
}

body.light-mode .diy-upload-placeholder {
    color: #6b7280;
}

body.light-mode .diy-video-url-row {
    background: #fff;
}

body.light-mode .diy-video-url-input {
    color: #1f2937;
    background: #fff;
    border-color: #d1d5db;
}

body.light-mode .diy-field-tip {
    color: #6b7280;
}

body.light-mode .diy-skip-btn {
    color: #667eea;
    border-color: #667eea;
}

/* Android WebView 横屏兜底：系统不旋转时，在竖屏视口内模拟横屏画面。 */
body.android-css-fullscreen {
    overflow: hidden !important;
}

body.android-css-fullscreen .app.player-page {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: 100vh !important;
    height: 100vw !important;
    min-height: 0 !important;
    overflow: hidden !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    transform-origin: center center !important;
    background: #000 !important;
}

body.android-css-fullscreen .app.player-page .header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    background: transparent !important;
}

body.android-css-fullscreen .app.player-page .header-actions,
body.android-css-fullscreen .app.player-page .player-content,
body.android-css-fullscreen .app.player-page .player-tabs {
    display: none !important;
}

body.android-css-fullscreen .app.player-page .video-container {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
}

body.android-css-fullscreen .app.player-page .video-player {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

body.android-css-fullscreen .app.player-page .video-controls {
    position: absolute !important;
    inset: 0 !important;
    z-index: 10 !important;
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.android-css-fullscreen .app.player-page .controls-top {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 30 !important;
    display: flex !important;
    pointer-events: auto !important;
}

body.android-css-fullscreen .app.player-page .controls-bottom {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 30 !important;
    display: flex !important;
    pointer-events: auto !important;
}

body.android-css-fullscreen .app.player-page .controls-bottom .progress-row,
body.android-css-fullscreen .app.player-page .controls-bottom .control-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.android-css-fullscreen .app.player-page .controls-bottom .control-btn,
body.android-css-fullscreen .app.player-page .controls-bottom .episodes-btn,
body.android-css-fullscreen .app.player-page .controls-bottom .fullscreen-btn {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.android-css-fullscreen .app.player-page .fullscreen-side-lock {
    display: flex !important;
    z-index: 40 !important;
}

/* Android App 原生横屏布局：宿主负责旋转 Activity，网页不再旋转自身。 */
body.android-native-fullscreen {
    overflow: hidden !important;
}

body.android-fullscreen-preparing::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background: #000;
    pointer-events: none;
}

html.android-native-fullscreen,
html.android-native-fullscreen body {
    width: 100vw !important;
    height: 100vh !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
}

body.android-native-fullscreen .app.player-page {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    background: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    left: 0 !important;
}

body.android-native-fullscreen .app.player-page .header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    background: transparent !important;
}

body.android-native-fullscreen .app.player-page .header-actions,
body.android-native-fullscreen .app.player-page .player-content,
body.android-native-fullscreen .app.player-page .player-tabs {
    display: none !important;
}

body.android-native-fullscreen .app.player-page .video-container {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    aspect-ratio: auto !important;
    background: #000 !important;
}

body.android-native-fullscreen .app.player-page .video-player {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

body.android-native-fullscreen .app.player-page .video-controls,
body.android-native-fullscreen .app.player-page .controls-top,
body.android-native-fullscreen .app.player-page .controls-bottom {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.android-native-fullscreen .app.player-page .video-controls.hidden,
body.android-native-fullscreen .app.player-page .controls-top.hidden,
body.android-native-fullscreen .app.player-page .controls-bottom.hidden {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.android-native-fullscreen .app.player-page .video-controls {
    position: absolute !important;
    inset: 0 !important;
    z-index: 20 !important;
    pointer-events: auto !important;
}

body.android-native-fullscreen .app.player-page .controls-top {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 30 !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 30 !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom .progress-row,
body.android-native-fullscreen .app.player-page .controls-bottom .control-row,
body.android-native-fullscreen .app.player-page .controls-bottom .control-actions,
body.android-native-fullscreen .app.player-page .controls-bottom .control-btn,
body.android-native-fullscreen .app.player-page .controls-bottom .episodes-btn,
body.android-native-fullscreen .app.player-page .controls-bottom .fullscreen-btn,
body.android-native-fullscreen .app.player-page .controls-bottom .danmaku-input-player {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom .progress-row #inlinePlayBtn,
body.android-native-fullscreen .app.player-page .controls-bottom .progress-row #inlineFullscreenBtn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* APK 横屏时，弹幕输入框左侧的播放控制图标保持更舒适的间距。 */
body.android-native-fullscreen .app.player-page .controls-bottom .control-row {
    gap: 16px !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom .control-row .image-control {
    margin-right: 2px !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom .control-actions {
    align-items: center !important;
}

body.android-native-fullscreen .app.player-page .controls-bottom .episodes-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff !important;
    line-height: 1 !important;
    text-align: center !important;
    vertical-align: middle !important;
}
