html { font-size: 16px !important; }
html, body { background: var(--bg); color: var(--text); max-width: none; font-family: var(--font-body); }
body.reel-media-page { background: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tb-tabbar { display: none !important; }

/* 媒体页：全屏视频 + 深色信息卡片 */
.ep-root, .fd-root, body #app:has(.fd-root) { background: var(--bg); }
.ep-bottom {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 50;
    padding: 16px;
    background: rgba(11, 15, 25, .92);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px #0009;
    backdrop-filter: blur(14px);
}
.fd-card .ep-bottom { bottom: 16px; }
.ep-bottom-hidden {
    transform: translate3d(0, calc(100% + 32px), 0);
    -webkit-transform: translate3d(0, calc(100% + 32px), 0);
    pointer-events: none;
    opacity: 0;
}
.ep-info { padding: 0; }
.ep-title-row { margin-bottom: 6px; }
.ep-title { color: var(--text); font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1.25; }
.ep-desc { color: var(--muted); font-family: var(--font-body); margin-bottom: 10px; }
.ep-progress { background: #ffffff1f; margin: 0 0 12px; border-radius: 999px; }
.ep-progress::before { top: -10px; bottom: -10px; }
.ep-progress-fill, .ep-progress-fill::after, .ep-progress-thumb { background: var(--accent); }
.ep-watchbar {
    height: 46px;
    padding: 0 16px;
    background: var(--gradient);
    color: var(--ink);
    border-radius: 12px;
    box-shadow: 0 0 25px -4px rgba(22, 132, 91, .45);
}
.ep-watchbar-text { color: var(--ink); font-family: var(--font-display); font-size: 13px; font-weight: 700; }

/* 操作区 */
.ep-side {
    right: 16px;
    bottom: calc(190px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.fd-card .ep-side { bottom: 190px; }
.ep-side-btn {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: #e8f3ec;
    border: 1px solid rgba(51, 65, 85, .8);
    border-radius: 999px;
    color: var(--text);
    backdrop-filter: blur(8px);
}
.ep-side-btn-save { width: 16px; height: 16px; }
.ep-side-label { color: var(--text); font-family: var(--font-body); font-size: 11px; }
.ep-side-label-saved { color: var(--accent-hover); }
.ep-side-icon-hd { width: auto; height: auto; padding: 0; background: transparent; color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.ep-side-icon-rate { width: auto; height: auto; border: 0; color: var(--text); font-family: var(--font-body); font-size: 11px; }

/* 剧集抽屉 */
.ep-drawer, .ep-quality-sheet { background: var(--surface); border-color: var(--line); color: var(--text); border-radius: 20px 20px 0 0; box-shadow: 0 -18px 60px #000a; }
.ep-drawer-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px 24px; display: flex; flex-direction: column; }
.ep-drawer-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 18px 0 10px; font-size: 12px; color: var(--muted); }
.ep-drawer-crumb a { color: var(--muted); }
.ep-drawer-crumb a:hover { color: var(--accent-hover); }
.ep-drawer-crumb .ep-drawer-crumb-series { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-drawer-summary { padding: 0 0 14px; align-items: flex-start; gap: 12px; }
.ep-plot { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.ep-plot h3, .ep-episodes-head h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--text); }
.ep-episodes-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.ep-episodes-head span { font-size: 12px; color: var(--muted); }
.ep-episodes { padding: 0; overflow: visible; }
.ep-drawer-cover { border: 1px solid var(--line); border-radius: 6px; }
.ep-drawer-title { color: var(--text); font-family: var(--font-display); font-size: 20px; font-weight: 800; line-height: 1.3; padding-top: 0; }
.ep-drawer-save { border: 1px solid rgba(22, 132, 91, .4); border-radius: 999px; color: var(--accent-hover); background: var(--accent-soft); font-family: var(--font-body); }
.ep-drawer-saved { color: var(--ink); background: var(--accent); border-color: transparent; }
.ep-tab, .ep-ep-tab { color: var(--muted); background: transparent; border: 0; font-family: var(--font-body); }
.ep-tab-active, .ep-ep-tab-active { color: var(--text); }
.ep-tab-active::after, .ep-ep-tab-active::after { background: var(--accent); }
.ep-ep-tab-active { color: var(--accent-hover); }
.ep-ep-tab:not(:last-child)::after { background: var(--line); }
.ep-syn-desc, .ep-ep-empty { color: var(--muted); font-family: var(--font-body); }
.ep-ep-cell { background: var(--raised); border: 1px solid transparent; color: var(--text); font-family: var(--font-body); }
.ep-ep-cell-on { background: var(--accent); color: var(--ink); }
.ep-ep-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.ep-ep-playing { background: none; }
.ep-ep-playing::before { content: ''; position: absolute; inset: 0; background:
        linear-gradient(currentColor, currentColor) 0 100% / 0.12rem 0.28rem no-repeat,
        linear-gradient(currentColor, currentColor) 50% 100% / 0.12rem 0.44rem no-repeat,
        linear-gradient(currentColor, currentColor) 100% 100% / 0.12rem 0.62rem no-repeat;
}
.ep-quality-item { background: var(--raised); color: var(--text); }
.ep-quality-item-on { background: var(--accent); color: var(--ink); }
.ep-quality-check { background: radial-gradient(circle, #16845b 0%, #16845b 100%); }
.ep-stage .ep-top-back { cursor: pointer; background: #e8f3ec; border: 1px solid rgba(22, 132, 91, .4); border-radius: 999px; padding: 8px; box-sizing: border-box; backdrop-filter: blur(12px); }
.ep-slide-ghost { background: var(--bg); }
.ep-episode-step { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 8px; margin: 4px 12px 16px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--text); }
.player-arrow { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 999px; background: #e8f3ec; cursor: pointer; }
.player-arrow img { width: 16px; height: 16px; object-fit: contain; }
.player-arrow.previous img { transform: rotate(180deg); }
.player-arrow:disabled { cursor: default; opacity: .42; }
.fd-empty { position: absolute; z-index: 1; inset: 16px; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text); }
.fd-empty p { margin: 0; }
.fd-empty a { color: var(--accent-hover); }
.fd-card, .fd-ad-card { height: 100%; min-height: 0; }
.fd-navigation { display: none; }

/* 收藏 / 我的 */
.cl-root, .pf-root, .lg-head, .reel-legacy #app:has(.cl-root, .pf-root) { background: var(--bg); color: var(--text); }
.cl-tab, .collection-back, .pf-item { border: 0; background: transparent; color: var(--text); font-family: inherit; cursor: pointer; }
.cl-tabs { padding: 0; gap: 22px; background: none; border: 0; border-radius: 0; }
.cl-tab { padding: 8px 0; border-radius: 0; font-size: 13px; color: var(--muted); }
.cl-tab-active { color: var(--text); background: none; border-bottom: 2px solid var(--accent); }
.cl-tab-active::after { display: none; }
.collection-back { padding: 0; width: 40px; height: 40px; }
.collection-back img { display: block; width: 22px; margin: auto; }
.cl-empty-title { color: var(--text); font-family: var(--font-display); font-weight: 800; }
.cl-empty-text { color: var(--muted); }
.pf-user { border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.pf-name { margin-block: 0; font-family: var(--font-display); font-weight: 800; }
.pf-item { width: 100%; text-align: left; border-radius: 12px; }
.pf-item:hover { background: var(--raised); }
.pf-item:hover .pf-item-title { color: var(--accent-hover); }
.pf-item-title { color: var(--text); font-weight: 600; font-size: 16px; }
.pf-preview-title { color: var(--text); }
.pf-preview-sub { color: var(--muted); }
.pf-preview-ep, .cl-ep, .lg-body a { color: var(--accent-hover); }
.pf-version, .pf-copy { color: var(--muted); }
.pf-pwa-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--text); }
.pf-pwa-title { color: var(--text); font-family: var(--font-display); font-weight: 800; }
.pf-pwa-desc { color: var(--muted); }
.pf-pwa-btn { background: var(--gradient); color: var(--ink); border-radius: 10px; font-weight: 700; }
.lg-text { color: var(--muted); overflow-wrap: anywhere; }
.reel-empty { color: var(--muted); }

@media (min-width: 900px) {
    .ep-root { --episode-sidebar: 380px; background: var(--bg); }
    .ep-stage { right: var(--episode-sidebar); }
    .ep-bottom { right: calc(var(--episode-sidebar) + 16px); }
    .ep-side { right: calc(var(--episode-sidebar) + 16px); bottom: 140px; }
    .fd-card .ep-side { bottom: 140px; }
    .ep-drawer, .ep-drawer-open { width: var(--episode-sidebar); border-left: 1px solid var(--line); border-radius: 0; }
    .ep-drawer-cover { display: none; }
    .ep-drawer-summary { padding: 0 0 14px; }
    .ep-ep-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .ep-watchbar { display: none; }
    .fd-root { background: var(--bg); }
    .fd-empty { color: var(--text); }
    .fd-empty a { color: var(--accent-hover); }
    .fd-feed { left: 50%; transform: translateX(-50%); width: min(440px, 100%); box-shadow: 0 24px 60px #000a; border: 1px solid var(--line); border-radius: 16px; }
    .fd-navigation { display: flex; flex-direction: column; gap: 10px; position: absolute; top: 50%; left: calc(50% + 236px); transform: translateY(-50%); }
    .fd-navigation .player-arrow { width: 44px; height: 44px; }
    .fd-navigation img { transform: rotate(90deg); }
    .fd-navigation .previous img { transform: rotate(-90deg); }
    .fd-root { top: var(--header-h, 80px); }
    .ep-root { top: var(--header-h, 80px); bottom: 0; height: auto; }
}
@media (min-width: 600px) and (max-width: 899px) {
    .fd-feed { width: min(480px, 100%); margin-inline: auto; }
}
@media (max-width: 899px) {
    .ep-drawer:not(.ep-drawer-open) { visibility: hidden; }
    .ep-episodes { order: 2; }
    .ep-plot { order: 3; border-bottom: 0; border-top: 1px solid var(--line); margin: 18px 0 0; padding: 18px 0 0; }
    .reel-media-page #app { height: calc(100vh - var(--header-h, 64px)); }
    .fd-root { top: var(--header-h, 64px); }
    .ep-root { top: var(--header-h, 64px); bottom: 0; height: auto; }
}

.reel-media-page .ep-bottom, .reel-media-page .ep-side-btn { background: var(--surface); }
.reel-media-page .ep-progress { background: var(--line); }
.reel-media-page .ep-stage, .reel-media-page .fd-player { background: #131914; }
