:root {
    color-scheme: dark;
    --bg: #0d0d0e;
    --surface: #171719;
    --surface-2: #202023;
    --line: #303035;
    --text: #f5f5f6;
    --muted: #9a9aa2;
    --accent: #ff3b3f;
    --accent-dark: #d8262c;
    --green: #36cc7a;
    --gold: #e2aa43;
    font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
    font-size: 15px;
    letter-spacing: 0;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body.dialog-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
    letter-spacing: 0;
}

button {
    color: inherit;
}

img {
    max-width: 100%;
}

.page-width,
.header-inner,
.site-footer {
    width: min(1320px, calc(100% - 48px));
    margin-right: auto;
    margin-left: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 72px;
    border-top: 4px solid var(--accent);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: rgba(14, 14, 15, .96);
    backdrop-filter: blur(14px);
}

.header-inner {
    display: grid;
    grid-template-columns: 190px auto minmax(240px, 420px) auto;
    align-items: center;
    gap: 24px;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    height: 56px;
    overflow: hidden;
}

.brand img {
    width: 176px;
    height: 48px;
    object-fit: contain;
    object-position: left center;
}

.main-nav {
    display: flex;
    align-items: stretch;
    align-self: stretch;
    gap: 2px;
}

.main-nav a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 13px;
    color: #adadb4;
    font-size: 14px;
    white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
    color: #fff;
}

.main-nav a.active::after {
    content: "";
    position: absolute;
    right: 13px;
    bottom: 0;
    left: 13px;
    height: 3px;
    background: var(--accent);
}

.global-search {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    height: 40px;
    border: 1px solid #39393e;
    border-radius: 6px;
    background: #19191b;
    padding: 0 10px;
    color: #7f7f87;
}

.global-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 59, 63, .13);
}

.global-search > span {
    font-size: 22px;
    line-height: 1;
}

.global-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
}

.global-search input::placeholder {
    color: #77777f;
}

kbd {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid #44444a;
    border-radius: 4px;
    background: #242427;
    color: #9999a0;
    font: 12px/1 Consolas, monospace;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    overflow: hidden;
    border: 1px solid #3a3a40;
    border-radius: 7px;
    background: #1a1a1d;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

.suggestion-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    border-bottom: 1px solid #2c2c31;
    padding: 7px 9px;
}

.suggestion-item:last-child {
    border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background: #252529;
    outline: 0;
}

.suggestion-item img {
    width: 40px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
}

.suggestion-item strong,
.suggestion-item span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-item strong {
    margin-bottom: 3px;
    font-size: 13px;
}

.suggestion-item span {
    color: var(--muted);
    font-size: 11px;
}

.suggestion-item > b {
    color: var(--green);
    font-size: 12px;
}

.suggestion-empty {
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 6px;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #d7d7db;
    cursor: pointer;
    font-size: 18px;
}

.icon-button:hover,
.icon-button:focus-visible {
    background: #2a2a2e;
    color: #fff;
    outline: 0;
}

.mobile-menu-button {
    display: none;
}

.featured {
    position: relative;
    min-height: 510px;
    max-height: 570px;
    height: 61vh;
    overflow: hidden;
    background-color: #111;
    background-position: center;
    background-size: cover;
}

.featured::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 6, .54);
}

.featured-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    height: 100%;
    padding-top: 18px;
}

.featured-kicker,
.section-heading > div > span,
.results-heading > div > span,
.detail-kicker {
    color: #ff777a;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.featured h1 {
    max-width: 760px;
    margin: 12px 0 13px;
    font-size: 54px;
    line-height: 1.08;
}

.featured-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #d3d3d8;
}

.featured-meta strong {
    color: var(--green);
}

.featured p {
    max-width: 620px;
    margin: 19px 0 24px;
    color: #c0c0c6;
    font-size: 16px;
    line-height: 1.8;
}

.featured-actions {
    display: flex;
    gap: 10px;
}

.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 18px;
    cursor: pointer;
    font-weight: 700;
}

.primary-action {
    border-color: var(--accent-dark);
    background: var(--accent);
    color: #fff;
}

.primary-action:hover {
    background: var(--accent-dark);
}

.secondary-action {
    border-color: rgba(255, 255, 255, .2);
    background: rgba(24, 24, 26, .82);
    color: #fff;
}

.secondary-action:hover {
    background: rgba(45, 45, 48, .9);
}

.catalog-section {
    padding-top: 44px;
    padding-bottom: 10px;
}

.continue-section {
    padding-top: 34px;
}

.section-heading,
.results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.section-heading h2,
.results-heading h1 {
    margin: 5px 0 0;
    font-size: 24px;
    line-height: 1.2;
}

.section-heading > a,
.section-heading > span,
.results-heading > strong {
    color: var(--muted);
    font-size: 13px;
}

.section-heading > a:hover {
    color: #fff;
}

.poster-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 24px 16px;
}

.poster-grid-all {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.video-card {
    position: relative;
    min-width: 0;
}

.poster-link {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 6px;
    background: #1d1d20;
}

.poster-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: inherit;
    pointer-events: none;
}

.poster-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease, opacity .25s ease;
}

.poster-link:hover img {
    transform: scale(1.035);
    opacity: .72;
}

.play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 50%;
    background: rgba(12, 12, 13, .76);
    color: #fff;
    opacity: 0;
    transform: translate(-50%, -46%);
    transition: opacity .2s ease, transform .2s ease;
}

.poster-link:hover .play-badge,
.poster-link:focus-visible .play-badge {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.watch-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, .2);
}

.watch-progress b {
    display: block;
    height: 100%;
    background: var(--accent);
}

.rating-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    min-width: 34px;
    height: 24px;
    border-radius: 4px;
    background: rgba(9, 9, 10, .86);
    color: var(--green);
    padding: 0 7px;
    font: 700 12px/24px Consolas, monospace;
    text-align: center;
}

.card-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 5px;
    background: rgba(9, 9, 10, .78);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
}

.card-favorite:hover,
.card-favorite.active {
    border-color: var(--gold);
    color: var(--gold);
}

.card-copy {
    padding-top: 10px;
}

.card-copy > a {
    display: block;
    overflow: hidden;
    margin-bottom: 5px;
    color: #eeeef0;
    font-size: 15px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-copy > a:hover {
    color: #ff777a;
}

.card-copy span {
    display: block;
    overflow: hidden;
    color: #808088;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muted-band {
    width: 100%;
    max-width: none;
    margin-top: 46px;
    padding: 38px max(24px, calc((100% - 1320px) / 2));
    background: #141416;
}

.landscape-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 34px;
}

.landscape-item {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 17px;
    align-items: center;
    min-width: 0;
}

.landscape-item > a {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    background: #222;
}

.landscape-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.landscape-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(12, 12, 13, .82);
    color: #fff;
}

.landscape-item > div {
    min-width: 0;
}

.landscape-item > div > span {
    color: #ff777a;
    font-size: 11px;
    font-weight: 800;
}

.landscape-item h3 {
    margin: 6px 0 7px;
    font-size: 17px;
}

.landscape-item h3 a:hover {
    color: #ff777a;
}

.landscape-item p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.filter-row {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-row a {
    flex: 0 0 auto;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 7px 12px;
    color: #a5a5ad;
}

.filter-row a:hover,
.filter-row a.active {
    border-color: #4b2d30;
    background: rgba(255, 59, 63, .12);
    color: #ff7e81;
}

.results-page {
    min-height: calc(100vh - 190px);
    padding-top: 54px;
    padding-bottom: 60px;
}

.results-heading {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.empty-state,
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 440px;
    text-align: center;
}

.empty-state > span,
.not-found > span {
    color: #4a4a50;
    font-size: 70px;
}

.empty-state h2,
.not-found h1 {
    margin: 14px 0 20px;
}

.empty-state a {
    color: #ff777a;
}

.watch-stage {
    background: #060607;
    padding-bottom: 24px;
}

.watch-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
}

.watch-topbar > div {
    display: flex;
    gap: 5px;
}

.back-link {
    color: #b0b0b7;
}

.back-link:hover {
    color: #fff;
}

.back-link span {
    margin-right: 8px;
}

.player-shell {
    position: relative;
    overflow: hidden;
    width: min(1180px, calc(100% - 48px));
    aspect-ratio: 16 / 9;
    border: 1px solid #28282c;
    border-radius: 6px;
    background: #000;
}

.player-shell video {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.player-loading,
.player-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    background: rgba(5, 5, 6, .9);
}

.player-loading > span {
    width: 38px;
    height: 38px;
    border: 3px solid #333338;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.player-error b {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-size: 22px;
}

.player-error button {
    min-height: 38px;
    border: 1px solid var(--accent-dark);
    border-radius: 5px;
    background: var(--accent);
    color: #fff;
    padding: 0 15px;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.detail-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 60px;
    padding-top: 38px;
    padding-bottom: 10px;
}

.detail-main h1 {
    margin: 8px 0 2px;
    font-size: 34px;
}

.original-title {
    margin: 0 0 17px;
    color: #73737b;
}

.detail-meta {
    display: flex;
    gap: 14px;
    color: #b0b0b7;
}

.detail-meta strong {
    color: var(--green);
}

.detail-description {
    max-width: 820px;
    margin: 19px 0;
    color: #b6b6bd;
    line-height: 1.85;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-row a {
    min-height: 30px;
    border: 1px solid #38383d;
    border-radius: 5px;
    padding: 5px 10px;
    color: #a6a6ad;
    font-size: 12px;
}

.tag-row a:hover {
    border-color: #5a5a62;
    color: #fff;
}

.detail-side {
    border-left: 1px solid var(--line);
    padding-left: 28px;
}

.detail-side > span {
    color: #777780;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.detail-side dl {
    margin: 15px 0 20px;
}

.detail-side dl div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #2a2a2e;
    padding: 11px 0;
}

.detail-side dt {
    color: #7d7d85;
}

.detail-side dd {
    margin: 0;
    color: #d7d7db;
}

.detail-side p {
    color: #ff777a;
    font-size: 13px;
}

.episode-section {
    padding-top: 30px;
    padding-bottom: 10px;
}

.episode-group {
    border-top: 1px solid var(--line);
    padding: 18px 0 2px;
}

.episode-source {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 13px;
}

.episode-source strong {
    color: #e9e9ed;
    font-size: 14px;
}

.episode-source span {
    color: var(--muted);
    font-size: 12px;
}

.episode-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.episode-button {
    min-width: 64px;
    min-height: 34px;
    border: 1px solid #36363c;
    border-radius: 4px;
    background: #1a1a1d;
    color: #b6b6bd;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 12px;
}

.episode-button:hover,
.episode-button.active {
    border-color: var(--accent);
    background: rgba(255, 59, 63, .14);
    color: #fff;
}

.network-empty p,
.not-found p {
    max-width: 620px;
    margin: 0 0 24px;
    color: var(--muted);
    text-align: center;
}

.diagnostic-link {
    margin: -8px 0 18px;
    color: #ff777a;
    font-size: 13px;
}

.diagnostic-link:hover {
    color: #fff;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    min-height: 110px;
    margin-top: 60px;
    border-top: 1px solid var(--line);
    color: #696970;
    font-size: 12px;
}

.site-footer strong,
.site-footer span {
    display: block;
}

.site-footer strong {
    margin-bottom: 5px;
    color: #b8b8be;
    font-size: 14px;
}

.library-dialog {
    width: min(900px, calc(100vw - 40px));
    max-height: min(720px, calc(100vh - 40px));
    border: 1px solid #3b3b41;
    border-radius: 8px;
    background: #18181b;
    color: var(--text);
    padding: 0;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .6);
}

.library-dialog::backdrop {
    background: rgba(0, 0, 0, .76);
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    border-bottom: 1px solid var(--line);
    padding: 14px 20px;
}

.library-header span {
    color: #ff777a;
    font-size: 11px;
    font-weight: 800;
}

.library-header h2 {
    margin: 4px 0 0;
    font-size: 20px;
}

.library-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px 14px;
    max-height: 580px;
    overflow-y: auto;
    padding: 20px;
}

.library-list .card-copy > a {
    font-size: 13px;
}

.library-empty {
    grid-column: 1 / -1;
    padding: 80px 20px;
    color: var(--muted);
    text-align: center;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    max-width: min(360px, calc(100vw - 44px));
    border-left: 4px solid var(--green);
    border-radius: 5px;
    background: #28282c;
    color: #fff;
    padding: 12px 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1120px) {
    .header-inner {
        grid-template-columns: 160px auto minmax(210px, 320px) auto;
        gap: 14px;
    }

    .brand img {
        width: 150px;
    }

    .main-nav a {
        padding: 0 9px;
    }

    .poster-grid,
    .poster-grid-all {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-width,
    .header-inner,
    .site-footer {
        width: min(100% - 32px, 1320px);
    }

    .header-inner {
        grid-template-columns: 150px minmax(180px, 1fr) auto;
    }

    .main-nav {
        position: absolute;
        top: 68px;
        right: 16px;
        left: 16px;
        display: none;
        height: auto;
        border: 1px solid #3a3a40;
        border-radius: 7px;
        background: #1b1b1e;
        padding: 8px;
        box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    }

    .main-nav.open {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
    }

    .main-nav a {
        justify-content: center;
        min-height: 42px;
    }

    .main-nav a.active::after {
        right: 20%;
        left: 20%;
    }

    .mobile-menu-button {
        display: grid;
        order: 4;
    }

    .header-actions {
        display: none;
    }

    .featured h1 {
        font-size: 44px;
    }

    .poster-grid,
    .poster-grid-all {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .landscape-list {
        grid-template-columns: 1fr;
    }

    .detail-section {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .detail-side {
        border-top: 1px solid var(--line);
        border-left: 0;
        padding-top: 22px;
        padding-left: 0;
    }

    .library-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .site-header {
        height: auto;
    }

    .header-inner {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 12px;
        height: auto;
        padding: 8px 0 10px;
    }

    .brand {
        height: 42px;
    }

    .brand img {
        width: 144px;
        height: 40px;
    }

    .global-search {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .main-nav {
        top: 104px;
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .featured {
        height: 500px;
        min-height: 500px;
        background-position: 58% center;
    }

    .featured-content {
        justify-content: flex-end;
        padding-bottom: 42px;
    }

    .featured h1 {
        font-size: 37px;
    }

    .featured p {
        display: -webkit-box;
        overflow: hidden;
        font-size: 14px;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .featured-actions {
        width: 100%;
    }

    .primary-action,
    .secondary-action {
        flex: 1;
        padding: 0 12px;
    }

    .catalog-section {
        padding-top: 34px;
    }

    .poster-grid,
    .poster-grid-all {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 12px;
    }

    .muted-band {
        padding: 30px 16px;
    }

    .landscape-item {
        grid-template-columns: 132px minmax(0, 1fr);
        gap: 12px;
    }

    .landscape-item p {
        -webkit-line-clamp: 1;
    }

    .player-shell {
        width: 100%;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .watch-topbar {
        min-height: 52px;
    }

    .detail-main h1 {
        font-size: 28px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 12px;
    }

    .library-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
