:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --ink: #333333;
    --ink-2: #555555;
    --ink-3: #999999;
    --line: #e0e0e0;
    --line-2: #bbbbbb;
    --accent: #4a90d9;
    --accent-dark: #3a7bc8;
    --accent-soft: rgba(74, 144, 217, 0.1);
    --ok: #27ae60;
    --radius: 3px;
    --radius-lg: 6px;
    --shell: 1680px;
    --gutter: 32px;
    --head-h: 64px;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: Consolas, "Courier New", monospace;
}

html[data-theme-resolved="dark"] {
    --bg: #17181a;
    --surface: #202124;
    --surface-2: #26272b;
    --ink: #e6e7ea;
    --ink-2: #b7bac0;
    --ink-3: #868a92;
    --line: #32343a;
    --line-2: #464a52;
    --accent: #5b9fe3;
    --accent-dark: #4a8ed2;
    --accent-soft: rgba(91, 159, 227, 0.16);
    --ok: #34b26a;
    color-scheme: dark;
}

html[data-theme-resolved="dark"] .drama-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    display: block;
    border: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- 站点顶栏 ---------- */

.site-head {
    position: sticky;
    top: 0;
    z-index: 60;
    flex: 0 0 auto;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-head-inner {
    width: min(var(--shell), calc(100% - var(--gutter) * 2));
    height: var(--head-h);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-mark svg {
    width: 15px;
    height: 15px;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 内联 logo：直接写在 .brand 里的 svg，统一尺寸与外框 */
.brand > svg {
    width: 30px;
    height: 30px;
    padding: 2px;
    flex-shrink: 0;
    box-sizing: border-box;
    border-radius: 8px;
}

.brand-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-shrink: 0;
    font-size: 13.5px;
    color: var(--ink-2);
}

.site-nav a {
    position: relative;
    padding: 4px 0;
    transition: color 0.18s;
}

.site-nav a:hover {
    color: var(--accent);
}

.site-nav a.active {
    color: var(--ink);
    font-weight: 600;
}

.site-nav a.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: translateX(-50%);
}

/* ---------- 首页 ---------- */

body.home-page:not(.searched) {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.home-page.searched {
    height: auto;
    overflow-y: auto;
}

.home {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.home-page:not(.searched) .home {
    overflow: hidden;
}

/* ---------- 页面骨架 ---------- */

.page-shell {
    flex: 1 1 auto;
    width: min(var(--shell), calc(100% - var(--gutter) * 2));
    min-height: 0;
    margin: 0 auto;
    padding: 32px 0 14px;
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 20px;
}

body.searched .page-shell {
    display: none;
}

.page-main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ---------- 侧边导航 ---------- */

.side-nav {
    min-height: 0;
    margin: 0;
    padding: 18px 10px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    scrollbar-width: none;
}

.side-nav::-webkit-scrollbar {
    display: none;
}

.side-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-group:empty {
    display: none;
}

.side-title {
    margin: 0 0 8px 12px;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}

.side-link {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink-2);
    text-align: left;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}

.side-link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    opacity: 0.7;
}

.side-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-link:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.side-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.side-link.active svg {
    opacity: 1;
}

.side-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

/* ---------- 搜索框 ---------- */

.search-box {
    display: flex;
    align-items: center;
    min-width: 0;
    width: min(390px, 36vw);
    margin-left: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.search-box:focus-within {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.search-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-left: 14px;
    color: var(--ink-3);
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 0;
    background: transparent;
    font-family: var(--sans);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
}

.search-input::placeholder {
    color: var(--ink-3);
}

.search-btn {
    flex-shrink: 0;
    height: 32px;
    margin: 4px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 12.5px;
    letter-spacing: 0.08em;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--accent-dark);
}

.search-btn:active {
    transform: translateY(1px);
}

.search-notice {
    flex: 0 0 auto;
    width: 100%;
    margin: 12px 0 0;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
    animation: fadeUp 0.3s ease;
}

/* ---------- 首页榜单 ---------- */

.rank-panel {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    margin: 0;
    padding: 20px 24px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    animation: fadeUp 0.35s ease;
}

body.home-page:not(.searched) .rank-panel::after {
    content: '';
    position: absolute;
    left: 1px;
    right: 1px;
    bottom: 1px;
    height: 30px;
    background: linear-gradient(to top, var(--surface) 22%, rgba(0, 0, 0, 0));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    pointer-events: none;
}

body.home-page:not(.searched) .rank-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 0;
}

body.searched .rank-panel {
    display: none;
}

.rank-bar,
.rank-boards,
.rank-loading,
.rank-status,
.rank-notice {
    flex: 0 0 auto;
}

.rank-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 30px;
}

.rank-meta {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
}

.rank-boards {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

.rank-boards button {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--ink-3);
    font-size: 12.5px;
    transition: color 0.18s, background 0.18s;
}

.rank-boards button:hover {
    background: var(--surface-2);
    color: var(--ink-2);
}

.rank-boards button.active {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--accent);
}

.rank-list {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 4px;
    padding: 16px 8px 14px 2px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    align-content: start;
    gap: 22px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
}

.rank-list::-webkit-scrollbar {
    width: 6px;
}

.rank-list::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 3px;
}

.rank-list::-webkit-scrollbar-track {
    background: transparent;
}

.rank-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
    cursor: pointer;
}

.rank-card:hover .rank-thumb {
    border-color: var(--line-2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.rank-thumb {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(160deg, var(--surface-2), var(--line));
    border: 1px solid var(--line);
    transition: box-shadow 0.22s, border-color 0.22s;
}

.rank-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.rank-card:hover .rank-thumb img {
    transform: scale(1.04);
}

.rank-thumb::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.rank-thumb.no-img::before {
    content: attr(data-initial);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 600;
    color: var(--ink-3);
}

.rank-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: rgba(24, 28, 36, 0.62);
    color: #fff;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.rank-badge.top {
    background: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.rank-score {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 7px;
    z-index: 2;
    color: #fff;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}

.rank-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rank-name {
    min-width: 0;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.rank-sub {
    min-width: 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-change {
    flex-shrink: 0;
    padding: 0 4px;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 15px;
    white-space: nowrap;
}

.rank-change.up {
    border-color: var(--ok);
    color: var(--ok);
}

.rank-change.down {
    border-color: #d9534f;
    color: #d9534f;
}

.rank-change.new {
    border-color: var(--accent);
    color: var(--accent);
}

.rank-card.is-actor .rank-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--accent-soft), var(--surface-2));
}

.rank-card.is-actor .rank-thumb img {
    width: 72%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--surface);
    object-fit: cover;
    transition: transform 0.35s ease;
}

.rank-card.is-actor .rank-thumb::after {
    display: none;
}

.rank-card.is-actor .rank-score {
    left: 8px;
    right: 8px;
    bottom: 8px;
    color: var(--ink-2);
    text-align: center;
    text-shadow: none;
}

.rank-card.is-actor .rank-thumb.no-img::before {
    font-size: 40px;
}

.rank-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}

.rank-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 8px;
    font-size: 12px;
    color: var(--ink-3);
}

.spinner-sm {
    width: 14px;
    height: 14px;
}

.rank-notice {
    flex: 0 0 auto;
    margin-top: 10px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
}

/* ---------- 结果区 ---------- */

.results {
    width: min(var(--shell), calc(100% - var(--gutter) * 2));
    margin: 18px auto 56px;
    padding: 18px 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: none;
    animation: fadeUp 0.35s ease;
}

body.searched .results {
    display: block;
}

.results-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.results-head h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.results-head h2::before {
    content: '';
    width: 3px;
    height: 15px;
    border-radius: 1px;
    background: var(--accent);
}

.results-info {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    align-items: start;
    gap: 12px 14px;
}

.result-card {
    display: flex;
    gap: 14px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.result-card:hover {
    border-color: var(--line-2);
    background: var(--surface-2);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.result-thumb {
    position: relative;
    flex: 0 0 84px;
    width: 84px;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(160deg, var(--surface-2), var(--line));
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-initial {
    font-size: 26px;
    font-weight: 600;
    color: var(--ink-3);
}

.result-play {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 0;
    background: rgba(20, 24, 32, 0.62);
    color: #fff;
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.2s;
}

.result-card:hover .result-play {
    opacity: 1;
}

.result-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.drama-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    align-items: start;
    gap: 22px 16px;
}

.drama-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.drama-poster {
    position: relative;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(160deg, var(--surface-2), var(--line));
    border: 1px solid var(--line);
    transition: box-shadow 0.22s, border-color 0.22s;
}

.drama-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.drama-card:hover .drama-poster {
    border-color: var(--line-2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.drama-card:hover .drama-poster img {
    transform: scale(1.04);
}

.drama-poster.no-img::before {
    content: attr(data-initial);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 600;
    color: var(--ink-3);
}

.drama-poster::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));
    pointer-events: none;
}

.drama-poster.no-img::after {
    display: none;
}

.drama-play {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(20, 24, 32, 0.66);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.08em;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
    transition: opacity 0.2s, transform 0.2s;
}

.drama-card:hover .drama-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.drama-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.drama-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.drama-title {
    min-width: 0;
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drama-ep {
    flex-shrink: 0;
    padding: 0 5px;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 10.5px;
    line-height: 16px;
    white-space: nowrap;
}

.drama-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.7;
    color: var(--ink-3);
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.drama-desc.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.drama-desc-empty {
    color: var(--ink-3);
}

.drama-toggle {
    align-self: flex-start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: 11.5px;
    line-height: 1.6;
    cursor: pointer;
}

.drama-toggle:hover {
    text-decoration: underline;
}

/* ---------- 悬停提示 ---------- */

.hover-tip {
    position: fixed;
    z-index: 80;
    display: none;
    max-width: min(520px, calc(100vw - 24px));
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.65;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
}

/* ---------- 通用状态 ---------- */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty {
    text-align: center;
    padding: 64px 20px;
    color: var(--ink-3);
    font-size: 13px;
}

.empty p {
    margin: 0;
}

body.play-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 播放页 ---------- */

.play-page {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 64px 24px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: stretch;
    align-self: center;
}

.player-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.player-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 650px;
    background: #101014;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.video-container .loading,
.video-container .empty {
    width: 100%;
}

.video-container .loading .spinner {
    border-color: rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
}

.video-container .empty {
    color: rgba(255, 255, 255, 0.65);
}

.video-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #101014;
    z-index: 2;
    pointer-events: none;
}

.video-overlay .loading,
.video-overlay .empty {
    width: 100%;
}

.player-bar {
    padding: 16px 20px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
}

.player-bar-main {
    min-width: 0;
    flex: 1;
}

.play-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.play-meta {
    margin-top: 5px;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}

.player-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.autoplay-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 11.5px;
    transition: all 0.18s;
}

.autoplay-toggle svg {
    width: 11px;
    height: 11px;
    display: block;
    flex-shrink: 0;
}

.autoplay-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.autoplay-toggle[aria-pressed="true"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.player-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translate(-50%, 12px);
    padding: 9px 18px;
    background: rgba(20, 22, 26, 0.9);
    color: #fff;
    border-radius: var(--radius);
    font-size: 12.5px;
    letter-spacing: 0.02em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 90;
}

.player-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- 顶栏操作区 ---------- */

.top-actions {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 80;
    display: flex;
    align-items: center;
    gap: 10px;
    --ta-size: 30px;
    --ta-icon: 16px;
}

.site-head .top-actions {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    flex-shrink: 0;
    margin-left: 18px;
}

/* 演员页顶栏没有搜索框，操作区固定靠右 */
.actor-body .site-head .top-actions {
    margin-left: auto;
}

.top-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ta-size);
    height: var(--ta-size);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--ink-2);
    transition: all 0.18s;
}

.top-action:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.top-action svg,
.theme-switch button svg {
    width: var(--ta-icon);
    height: var(--ta-icon);
    display: block;
    flex-shrink: 0;
}

.theme-switch {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 2px;
    overflow: hidden;
}

.theme-switch button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--ta-size);
    height: var(--ta-size);
    min-width: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    color: var(--ink-3);
    overflow: hidden;
    transition: width 0.22s ease, opacity 0.16s ease, color 0.18s, background 0.18s;
}

.theme-switch button:not(.active) {
    width: 0;
    border-right-width: 0;
    opacity: 0;
}

.theme-switch button.active {
    border-right-width: 0;
}

.theme-switch:hover button,
.theme-switch:focus-within button {
    width: var(--ta-size);
    opacity: 1;
    border-right-width: 1px;
}

.theme-switch:hover button:last-child,
.theme-switch:focus-within button:last-child {
    border-right-width: 0;
}

.theme-switch button:hover {
    color: var(--accent);
}

.theme-switch button.active {
    background: var(--accent);
    color: #fff;
}

@media (hover: none) {
    .theme-switch button {
        width: var(--ta-size);
        opacity: 1;
        border-right-width: 1px;
    }

    .theme-switch button:last-child {
        border-right-width: 0;
    }
}

.auth-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-btn {
    padding: 0;
    cursor: pointer;
}

.auth-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 248px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    animation: fadeUp 0.18s ease;
    z-index: 90;
}

html[data-theme-resolved="dark"] .auth-panel {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}

.auth-panel[hidden] {
    display: none;
}

.auth-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.auth-state {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 2px;
    border: 1px solid transparent;
}

.auth-state.on {
    color: var(--ok);
    border-color: var(--ok);
}

.auth-account {
    margin-top: 10px;
    font-size: 12px;
    color: var(--ink-2);
    word-break: break-all;
}

.auth-user-out {
    color: var(--ink-3);
}

.auth-actions {
    margin-top: 12px;
}

.auth-logout,
.auth-login-link {
    display: block;
    width: 100%;
    padding: 8px 0;
    text-align: center;
    font-size: 12.5px;
    border-radius: var(--radius);
    border: 1px solid var(--line-2);
    background: transparent;
    color: var(--ink-2);
    transition: border-color 0.18s, color 0.18s;
}

.auth-logout:hover,
.auth-login-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.stream-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.stream-btn {
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 11.5px;
    transition: all 0.18s;
}

.stream-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.stream-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 14px;
}

.nav-btn {
    padding: 6px 16px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: 2px;
    color: var(--ink-2);
    font-size: 12.5px;
    transition: all 0.18s;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nav-pos {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
}

.info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-head {
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink-2);
    background: var(--surface-2);
}

.info-list {
    padding: 6px 18px 12px;
}

.info-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 12.5px;
}

.info-row:last-child {
    border-bottom: 0;
}

.info-row .k {
    width: 88px;
    flex-shrink: 0;
    color: var(--ink-3);
    font-size: 12px;
}

.info-row .v {
    color: var(--ink);
    font-family: var(--mono);
    font-size: 12px;
    word-break: break-all;
}

/* ---------- 侧栏 ---------- */

.side-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    contain: size;
}

.episode-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.episode-header {
    padding: 11px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink-2);
}

.ep-count {
    flex-shrink: 0;
    padding: 1px 8px;
    border: 1px solid var(--line-2);
    border-radius: 2px;
    background: var(--surface);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    line-height: 17px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.episode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
    gap: 8px;
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
}

.episode-grid::-webkit-scrollbar {
    width: 6px;
}

.episode-grid::-webkit-scrollbar-track {
    background: transparent;
}

.episode-grid::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 3px;
}

.episode-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.18s;
}

.episode-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.episode-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.notice-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 18px 16px;
}

.notice-card .title {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ink-2);
    padding-bottom: 9px;
    margin-bottom: 9px;
    border-bottom: 1px dashed var(--line);
}

.notice-card p {
    font-size: 12px;
    line-height: 1.9;
    color: var(--ink-3);
}

.notice-card p + p {
    margin-top: 6px;
}

/* ---------- 页脚 ---------- */

.footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--ink-3);
    font-family: var(--mono);
}

.footer-inner .f-left {
    letter-spacing: 0.03em;
}

.footer-inner .f-right {
    color: var(--ink-3);
}

/* ---------- 登录页 ---------- */

body.login-page {
    min-height: 100vh;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 20px 48px;
}

.login-card {
    width: min(400px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 34px 30px 26px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    animation: fadeUp 0.35s ease;
}

html[data-theme-resolved="dark"] .login-card {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: center;
    color: var(--ink);
}

.login-sub {
    margin-top: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    text-align: center;
    color: var(--ink-3);
}

.login-form {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field span {
    font-size: 12px;
    letter-spacing: 0.05em;
    color: var(--ink-2);
}

.login-field input {
    width: 100%;
    padding: 11px 13px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-field input::placeholder {
    color: var(--ink-3);
}

.login-field input:focus {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

.login-error {
    margin: 0;
    font-size: 12.5px;
    color: #d9534f;
}

.login-submit {
    margin-top: 4px;
    height: 42px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 13.5px;
    letter-spacing: 0.1em;
    transition: background 0.2s, opacity 0.2s;
}

.login-submit:hover:not(:disabled) {
    background: var(--accent-dark);
}

.login-submit:disabled {
    opacity: 0.65;
    cursor: default;
}

.login-back {
    display: block;
    margin-top: 18px;
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-3);
    transition: color 0.18s;
}

.login-back:hover {
    color: var(--accent);
}

/* ---------- 演员主页 ---------- */

.actor-page {
    width: min(var(--shell), calc(100% - var(--gutter) * 2));
    margin: 0 auto;
    padding: 20px 0 56px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.actor-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px;
    overflow: hidden;
    animation: fadeUp 0.35s ease;
}

.actor-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
}

.actor-card .loading {
    padding: 24px;
}

.actor-head {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.actor-avatar {
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-2);
    border: 2px solid var(--surface);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

.actor-avatar-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 600;
    color: var(--ink-3);
}

.actor-ident {
    min-width: 0;
}

.actor-name {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actor-meta {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.actor-tag {
    padding: 0 7px;
    border-radius: 2px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    line-height: 18px;
}

.actor-label {
    color: var(--ink-3);
    font-size: 11.5px;
}

.actor-stats {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--line);
    display: flex;
    gap: 42px;
}

.actor-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.actor-stat .v {
    font-family: var(--mono);
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.actor-stat .k {
    font-size: 11.5px;
    letter-spacing: 0.06em;
    color: var(--ink-3);
}

.actor-bio {
    margin-top: 14px;
    font-size: 12.5px;
    line-height: 1.85;
    color: var(--ink-2);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.actor-works {
    display: block;
}

.actor-page .results {
    width: 100%;
    margin: 0;
}

.actor-page .results .empty {
    padding: 36px 20px;
}

/* ---------- 无封面时的彩色占位 ---------- */

.rank-card,
.drama-card,
.result-card {
    --h: 212;
}

.rank-thumb.no-img,
.drama-poster.no-img,
.result-thumb.no-img {
    background:
        radial-gradient(120% 90% at 16% 6%, hsl(var(--h) 78% 64% / 0.3), transparent 64%),
        linear-gradient(160deg, hsl(var(--h) 60% 52% / 0.2), hsl(var(--h) 60% 52% / 0.05));
    border-color: hsl(var(--h) 52% 52% / 0.38);
}

.rank-thumb.no-img::before,
.drama-poster.no-img::before {
    color: hsl(var(--h) 58% 42%);
}

.result-initial {
    color: hsl(var(--h) 58% 42%);
    text-shadow: 0 1px 0 hsl(var(--h) 70% 78% / 0.45);
}

.result-card .drama-title {
    transition: color 0.18s;
}

.result-card:hover .drama-title {
    color: hsl(var(--h) 62% 42%);
}

.result-card .drama-ep {
    border-color: hsl(var(--h) 48% 52% / 0.45);
    background: hsl(var(--h) 70% 55% / 0.1);
    color: hsl(var(--h) 62% 42%);
}

.result-card:hover .result-thumb {
    border-color: hsl(var(--h) 52% 52% / 0.55);
}

html[data-theme-resolved="dark"] .rank-thumb.no-img::before,
html[data-theme-resolved="dark"] .drama-poster.no-img::before,
html[data-theme-resolved="dark"] .result-initial {
    color: hsl(var(--h) 68% 74%);
}

html[data-theme-resolved="dark"] .result-card:hover .drama-title,
html[data-theme-resolved="dark"] .result-card .drama-ep {
    color: hsl(var(--h) 68% 74%);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1024px) {
    .page-shell {
        grid-template-columns: 160px minmax(0, 1fr);
        gap: 16px;
    }

    .site-head-inner {
        gap: 18px;
    }

    .site-head .top-actions {
        margin-left: 12px;
    }
}

@media (max-width: 960px) {
    .play-page {
        grid-template-columns: minmax(0, 1fr);
        padding: 60px 16px 16px;
        gap: 16px;
    }

    .side-col {
        position: static;
        height: auto;
        contain: none;
    }

    .episode-section {
        flex: none;
    }

    .episode-grid {
        flex: none;
        max-height: 300px;
    }
}

@media (max-width: 900px) {
    :root {
        --gutter: 16px;
    }

    .site-head-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 9px 0;
        gap: 9px 12px;
    }

    .site-nav {
        display: none;
    }

    .site-head .search-box {
        order: 3;
        width: 100%;
        margin-left: 0;
        background: var(--surface-2);
    }

    .site-head .top-actions {
        order: 2;
        margin-left: auto;
    }

    .search-input {
        padding: 8px 10px;
    }

    .page-shell {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding-top: 12px;
    }

    .side-nav {
        flex-direction: row;
        align-items: center;
        gap: 4px;
        margin: 0;
        padding: 6px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .side-group {
        flex-direction: row;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .side-title {
        display: none;
    }

    .side-link {
        width: auto;
        padding: 7px 12px;
        font-size: 12.5px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .side-link svg {
        width: 14px;
        height: 14px;
    }

    .side-link.active::before {
        display: none;
    }

    .rank-panel {
        margin-top: 12px;
        padding: 14px 14px 8px;
    }

    .rank-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 14px 12px;
        padding: 12px 4px 10px 0;
    }

    .rank-name {
        font-size: 13px;
    }

    .actor-page {
        padding: 12px 0 32px;
        gap: 12px;
    }

    .actor-card {
        padding: 20px 16px 16px;
    }

    .actor-avatar {
        width: 68px;
        height: 68px;
    }

    .actor-avatar-empty {
        font-size: 24px;
    }

    .actor-name {
        font-size: 20px;
    }

    .actor-stats {
        gap: 30px;
    }

    .results {
        margin-top: 12px;
        margin-bottom: 32px;
        padding: 16px 14px 20px;
    }

    .drama-grid {
        grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
        gap: 18px 12px;
    }

    .drama-title {
        font-size: 13px;
    }

    .search-notice {
        margin-top: 12px;
    }
}

@media (max-height: 700px) and (min-width: 900px) {
    .page-shell {
        padding-top: 22px;
    }

    .rank-panel {
        margin-top: 0;
    }

    .rank-list {
        padding-top: 12px;
    }
}

@media (max-width: 480px) {
    .top-actions {
        top: 10px;
        right: 12px;
        gap: 8px;
        --ta-size: 28px;
        --ta-icon: 15px;
    }

    .site-head .top-actions {
        top: auto;
        right: auto;
    }

    .brand-name {
        font-size: 15px;
    }

    .side-link {
        padding: 6px 10px;
        font-size: 12px;
    }

    .rank-list {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 12px 10px;
    }

    .drama-grid {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
        gap: 16px 10px;
    }

    .login-main {
        padding: 60px 16px 40px;
    }

    .login-card {
        padding: 28px 20px 22px;
    }

    .auth-panel {
        width: 224px;
        right: -4px;
    }
}
