/* =========================================================
   AiDrama – giao diện dựa theo phong cách dramaflix.net
   Font: Inter (body) + Plus Jakarta Sans (display)
   ========================================================= */
@font-face {
    font-family: "Inter Fallback";
    src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
    ascent-override: 90.44%;
    descent-override: 22.52%;
    line-gap-override: 0%;
    size-adjust: 107.12%;
}
@font-face {
    font-family: "Plus Jakarta Sans Fallback";
    src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
    ascent-override: 98.88%;
    descent-override: 21.15%;
    line-gap-override: 0%;
    size-adjust: 104.98%;
}

:root {
    --c-bg-0: 8 8 10;
    --c-bg-1: 17 17 20;
    --c-bg-2: 26 26 31;
    --c-bg-3: 36 36 42;
    --c-fg-0: 245 245 247;
    --c-fg-1: 180 180 190;
    --c-fg-2: 139 139 150;
    --c-accent: 229 9 20;
    --c-accent-hi: 255 45 58;
    --c-accent-lo: 178 7 16;
    --c-vip: 245 194 76;
    --c-ok: 62 207 142;

    --bg-0: rgb(var(--c-bg-0));
    --bg-1: rgb(var(--c-bg-1));
    --bg-2: rgb(var(--c-bg-2));
    --bg-3: rgb(var(--c-bg-3));
    --fg-0: rgb(var(--c-fg-0));
    --fg-1: rgb(var(--c-fg-1));
    --fg-2: rgb(var(--c-fg-2));
    --accent: rgb(var(--c-accent));
    --accent-hi: rgb(var(--c-accent-hi));
    --line: rgba(255, 255, 255, .08);
    --line-2: rgba(255, 255, 255, .14);

    /* Giống chữ hiển thị thực tế trên dramaflix.net: Arial đã căn chỉnh metric theo Inter / Plus Jakarta Sans */
    --font-sans: "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Plus Jakarta Sans Fallback", "Inter Fallback", ui-sans-serif, system-ui, sans-serif;

    --r-tag: 6px;
    --r-chip: 10px;
    --r-card: 14px;
    --r-panel: 22px;
    --r-pill: 999px;

    --shadow-float: 0 16px 40px rgb(0 0 0 / .5);
    --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
    --header-h: 68px;
    --bottombar-h: 64px;
    --gutter: clamp(16px, 3.2vw, 96px);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--fg-0);
    background: var(--bg-0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
.icon { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px;
    background: var(--fg-0); color: var(--bg-0); border-radius: var(--r-pill); font-weight: 700;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: 1840px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Buttons / tags ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 44px; padding: 0 22px; border-radius: var(--r-pill);
    font-weight: 700; font-size: 15px; white-space: nowrap;
    transition: transform .14s, background-color .22s, box-shadow .22s;
}
.btn:active { transform: scale(.97); }
.btn-lg { height: 48px; padding: 0 28px; font-size: 16px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; gap: 8px; }
.btn-white { background: #fff; color: var(--bg-0); font-weight: 800; }
.btn-white:hover { box-shadow: 0 0 40px rgba(255, 255, 255, .4); }
.btn-ghost { background: rgba(255, 255, 255, .1); color: var(--fg-0); backdrop-filter: blur(10px); }
.btn-ghost:hover { background: rgba(255, 255, 255, .18); }
.btn-dark { background: var(--bg-2); color: var(--fg-0); font-size: 13px; }
.btn-dark:hover { background: var(--bg-3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hi); }

.tag {
    display: inline-block; border-radius: var(--r-tag); padding: 2px 6px;
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .025em; line-height: 15px;
}
.tag-accent { background: var(--accent); color: #fff; }
.tag-dub { background: rgba(255, 255, 255, .92); color: var(--bg-0); }

.pill-badge {
    display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .1); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
a.pill-badge:hover { background: rgba(255, 255, 255, .18); }
.pill-gold { background: rgba(var(--c-vip) / .14); color: rgb(var(--c-vip)); }
.pill-ok { background: rgba(var(--c-ok) / .14); color: rgb(var(--c-ok)); }
.pill-sm {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
    border-radius: var(--r-pill); background: var(--bg-2); font-size: 12px; font-weight: 700;
}
a.pill-sm:hover { background: var(--bg-3); }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
    border-radius: var(--r-pill); background: rgba(var(--c-bg-2) / .8); border: 1px solid var(--line);
    font-size: 13px; font-weight: 500; color: var(--fg-0); transition: background-color .22s, border-color .22s;
}
.chip small { color: var(--fg-2); font-weight: 600; font-size: 12px; }
.chip:hover, .chip.is-active { background: var(--bg-3); border-color: var(--line-2); }
.chip-list-sm .chip { height: 32px; font-size: 13px; }
.chip-dark { background: var(--bg-1); }

.link-btn { color: var(--fg-0); font-weight: 600; font-size: 14px; margin-top: 6px; }
.link-btn:hover { text-decoration: underline; }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; margin-top: 14px; }
.link-arrow:hover { color: var(--accent-hi); }

.icon-btn {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-chip);
    background: var(--bg-2); color: var(--fg-0); transition: background-color .22s;
}
.icon-btn:hover { background: var(--bg-3); }
.round-btn {
    display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-pill);
    background: rgba(var(--c-bg-2) / .85); border: 1px solid var(--line); color: var(--fg-0);
}
.round-btn:hover { background: var(--bg-3); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50; height: var(--header-h);
    background: linear-gradient(to bottom, rgba(8, 8, 10, .92), rgba(8, 8, 10, .6) 70%, rgba(8, 8, 10, 0));
    transition: background-color .22s;
}
.site-header.is-scrolled { background: rgba(8, 8, 10, .92); backdrop-filter: saturate(160%) blur(16px); box-shadow: 0 1px 0 var(--line); }
.page-home .site-header { position: fixed; left: 0; right: 0; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 100%; }
.logo { display: inline-flex; align-items: center; flex-shrink: 0; padding: 8px 4px 8px 0; }
.logo-text {
    font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1;
    letter-spacing: -.04em; color: var(--accent); text-transform: uppercase;
    transform: scaleY(1.12); transform-origin: center;
}
.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.nav-link {
    position: relative; display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px;
    border-radius: var(--r-pill); font-size: 14px; font-weight: 600; color: var(--fg-1); white-space: nowrap;
    transition: color .14s;
}
.nav-link:hover, .nav-link.is-active { color: var(--fg-0); }
.nav-link.is-active::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: -6px; height: 3px;
    border-radius: 3px; background: var(--accent);
}
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.lang-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
    border-radius: var(--r-pill); background: var(--bg-2); font-size: 13px; font-weight: 700;
}
.lang-btn:hover { background: var(--bg-3); }
.lang-code { display: inline-grid; place-items: center; min-width: 28px; height: 20px; padding: 0 4px; border-radius: var(--r-tag); background: var(--bg-3); font-size: 10px; font-weight: 800; color: var(--fg-1); }

.nav-dropdown { position: relative; }
.dd-menu {
    position: absolute; top: calc(100% + 10px); left: 0; min-width: 220px; max-height: 70vh; overflow: auto;
    padding: 8px; border-radius: var(--r-card); background: rgba(var(--c-bg-1) / .97);
    border: 1px solid var(--line-2); box-shadow: var(--shadow-float); backdrop-filter: blur(16px);
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .18s, transform .18s, visibility .18s;
}
.dd-right { left: auto; right: 0; min-width: 180px; }
.nav-dropdown.is-open .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd-menu a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px;
    border-radius: var(--r-chip); font-size: 14px; font-weight: 600; color: var(--fg-1);
}
.dd-menu a:hover, .dd-menu a.is-active { background: var(--bg-2); color: var(--fg-0); }
.dd-menu a small { color: var(--fg-2); font-weight: 500; }
.dd-menu .dd-all { justify-content: flex-start; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-chip) var(--r-chip); color: var(--fg-0); }
.lang-dd .dd-menu a { justify-content: flex-start; }

/* ---------- Hero (home) ---------- */
.hero { position: relative; height: clamp(560px, 82vh, 860px); overflow: hidden; background: var(--bg-0); }
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .7s var(--ease-out-expo), visibility .7s; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(28px) saturate(1.15) brightness(.55); transform: scale(1.15); }
.hero-fade-x { position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg-0) 0, rgba(var(--c-bg-0) / .86) 34%, rgba(var(--c-bg-0) / 0) 70%); }
.hero-fade-y { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg-0) 0, rgba(var(--c-bg-0) / .6) 30%, rgba(var(--c-bg-0) / 0) 65%); }
.hero-inner {
    position: relative; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 40px;
    padding-top: var(--header-h); padding-bottom: 110px;
}
.hero-content { max-width: 640px; }
.hero-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.hero-title {
    font-family: var(--font-display); font-weight: 800; font-size: clamp(34px, 4.2vw, 64px);
    line-height: 1.04; letter-spacing: -.025em; text-wrap: balance;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-meta { display: flex; gap: 14px; margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--fg-0); }
.hero-meta span + span::before { content: "·"; margin-right: 14px; color: var(--fg-2); }
.hero-desc {
    margin-top: 16px; max-width: 520px; color: var(--fg-1); font-size: 15px; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-poster {
    flex-shrink: 0; width: clamp(220px, 20vw, 330px); aspect-ratio: 2 / 3; border-radius: var(--r-panel);
    overflow: hidden; background: var(--bg-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .65); border: 1px solid var(--line-2);
    transform: translateY(10px); transition: transform .7s var(--ease-out-expo);
}
.hero-slide.is-active .hero-poster { transform: none; }
.hero-poster img { width: 100%; height: 100%; object-fit: cover; }
.hero-thumbs { position: absolute; left: 0; right: 0; bottom: 26px; display: flex; align-items: center; gap: 14px; z-index: 2; }
.hero-thumbs .round-btn:last-child { margin-left: auto; }
.hero-thumb-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.hero-thumb-list::-webkit-scrollbar { display: none; }
.hero-thumb {
    flex-shrink: 0; width: 54px; height: 72px; border-radius: var(--r-chip); overflow: hidden;
    opacity: .55; outline: 2px solid transparent; outline-offset: 0; transition: opacity .22s, outline-color .22s, transform .22s;
}
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-thumb:hover { opacity: .85; }
.hero-thumb.is-active { opacity: 1; outline-color: var(--accent); transform: translateY(-2px); }

/* ---------- Intro + filter ---------- */
.intro { padding-top: 28px; padding-bottom: 8px; }
.page-home .intro { padding-top: 8px; }
.page-h1 { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.5; letter-spacing: -.025em; }
.intro-text { margin-top: 4px; color: var(--fg-1); font-size: 15px; }
.filter-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; padding: 10px;
    border-radius: var(--r-card); background: var(--bg-1); border: 1px solid var(--line);
}
.filter-label { font-weight: 700; font-size: 14px; padding: 0 8px; }
.filter-field {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 14px;
    border-radius: var(--r-pill); background: var(--bg-2); font-size: 13px; color: var(--fg-2);
}
.filter-field select {
    appearance: none; -webkit-appearance: none; background: transparent; border: 0; outline: 0; cursor: pointer;
    font-weight: 700; color: var(--fg-0); padding: 0 26px 0 2px; height: 100%; max-width: 190px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b4b4be' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}
.filter-field select option { background: var(--bg-1); color: var(--fg-0); }

/* ---------- Dropdown lọc tuỳ biến (filters.js) ---------- */
.filter-field.cs-ready { position: relative; padding-right: 0; cursor: pointer; transition: background-color .14s, box-shadow .14s; }
.filter-field.cs-ready:hover, .filter-field.is-open { background: var(--bg-3); }
.filter-field.is-open { box-shadow: 0 0 0 1px var(--line-2); }
.filter-field.cs-ready select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cs-trigger {
    display: inline-flex; align-items: center; gap: 8px; height: 100%; padding: 0 14px 0 2px; max-width: 220px;
    font-weight: 700; font-size: 13px; color: var(--fg-0);
}
.cs-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-caret { flex-shrink: 0; color: var(--fg-1); transition: transform .2s var(--ease-out-expo); }
.filter-field.is-open .cs-caret { transform: rotate(180deg); }
.ff-label { white-space: nowrap; }

.cs-panel {
    position: absolute; top: calc(100% + 10px); left: 0; z-index: 40; width: 320px; max-width: calc(100vw - 32px);
    padding: 10px; border-radius: 18px; cursor: default;
    background: rgba(var(--c-bg-1) / .98); border: 1px solid var(--line-2);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .65); backdrop-filter: blur(18px);
    animation: csIn .18s var(--ease-out-expo);
}
.cs-panel.cs-up { top: auto; bottom: calc(100% + 10px); }
.cs-panel[hidden] { display: none; }
@keyframes csIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.cs-search {
    display: flex; align-items: center; gap: 10px; height: 46px; margin-bottom: 8px; padding: 0 16px;
    border-radius: var(--r-pill); background: var(--bg-2); border: 1px solid var(--line); color: var(--fg-2);
}
.cs-search:focus-within { border-color: var(--line-2); }
.cs-search input { flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0; color: var(--fg-0); font-size: 15px; }
.cs-search input::placeholder { color: var(--fg-2); }

.cs-list {
    max-height: 300px; overflow-y: auto; overscroll-behavior: contain; outline: 0; padding-right: 4px;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .28) transparent;
}
.cs-list::-webkit-scrollbar { width: 8px; }
.cs-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, .05); border-radius: 8px; }
.cs-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .3); border-radius: 8px; }
.cs-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .45); }
.cs-list [role=option] {
    display: flex; align-items: center; gap: 12px; min-height: 41px; padding: 0 12px; border-radius: 10px;
    font-size: 15px; font-weight: 700; color: var(--fg-0); cursor: pointer; user-select: none;
}
.cs-list [role=option][hidden] { display: none; }
.cs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-count { flex-shrink: 0; font-size: 13px; font-weight: 500; color: var(--fg-2); }
.cs-check { flex-shrink: 0; display: none; color: var(--accent-hi); }
.cs-list .is-active { background: var(--bg-2); }
.cs-list .is-selected { background: rgba(var(--c-accent) / .2); }
.cs-list .is-selected.is-active { background: rgba(var(--c-accent) / .28); }
.cs-list .is-selected .cs-check { display: block; }
.cs-list .is-selected .cs-count { display: none; }
.cs-empty { padding: 18px 12px; text-align: center; font-size: 14px; color: var(--fg-2); }

/* ---------- Icon tiêu đề mục ---------- */
.section-title, .section-title-sm, .cmt-title, .watch-side-title { display: flex; align-items: center; gap: 10px; }
.section-title .count, .watch-side-title .count { margin-left: 0; }
.st-icon { flex-shrink: 0; stroke-width: 2.25; }
.st-accent { color: var(--accent-hi); }
.st-vip { color: rgb(var(--c-vip)); }
.watch-side-title { gap: 8px; }

/* ---------- Rails ---------- */
.rail-section { padding-top: 28px; }
.rail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.rail-head-flat { padding: 0; }
.section-title {
    font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.25; letter-spacing: -.025em;
}
.section-title .count { margin-left: 10px; font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: var(--fg-2); letter-spacing: 0; }
.section-title-sm { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.section-sub { margin-top: 2px; color: var(--fg-2); font-size: 14px; }
.see-all {
    display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; padding: 6px 12px; border-radius: var(--r-pill);
    font-size: 13px; font-weight: 600; color: var(--fg-1); transition: color .14s, background-color .14s;
}
.see-all:hover { color: var(--fg-0); background: var(--bg-2); }

.rail { position: relative; }
.rail-track {
    display: flex; gap: 16px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    padding: 4px var(--gutter) 8px; scroll-padding-inline: var(--gutter); scrollbar-width: none;
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-item { flex-shrink: 0; scroll-snap-align: start; width: 40vw; }
.rail-arrow {
    position: absolute; top: 0; bottom: 50px; z-index: 3; width: var(--gutter); min-width: 40px;
    display: grid; place-items: center; color: #fff; opacity: 0; transition: opacity .22s;
}
.rail-prev { left: 0; background: linear-gradient(90deg, rgba(8, 8, 10, .9), transparent); }
.rail-next { right: 0; background: linear-gradient(270deg, rgba(8, 8, 10, .9), transparent); }
.rail:hover .rail-arrow:not([disabled]) { opacity: 1; }
.rail-arrow[disabled] { pointer-events: none; }

.rail-wide .rail-item { width: min(88vw, 470px); }

/* ---------- Poster card ---------- */
.card { position: relative; }
.card-link { display: block; outline: none; }
.card-poster {
    position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--r-card); background: var(--bg-2);
    box-shadow: 0 0 0 1px var(--line); transition: transform .3s var(--ease-out-expo), box-shadow .3s var(--ease-out-expo);
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-out-expo); }
.poster-fade {
    position: absolute; inset: 0; pointer-events: none; opacity: .7; transition: opacity .22s;
    background: linear-gradient(0deg, rgba(0, 0, 0, .86) 0, rgba(0, 0, 0, .38) 36%, rgba(0, 0, 0, 0) 62%);
}
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.card-eps {
    position: absolute; left: 8px; bottom: 8px; padding: 2px 6px; border-radius: var(--r-tag);
    background: rgba(8, 8, 10, .8); box-shadow: 0 0 0 1px var(--line); font-size: 11px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.card-eps-ongoing { display: flex; flex-direction: column; line-height: 1.3; padding: 3px 7px; }
.card-eps-ongoing small { font-size: 9.5px; font-weight: 800; text-transform: uppercase; color: rgb(var(--c-vip)); letter-spacing: .03em; }
.card-play { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .3s; }
.card-play > span {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .95); color: var(--bg-0); box-shadow: var(--shadow-float);
    transform: scale(.9); transition: transform .3s var(--ease-out-expo);
}
.card-play svg { margin-left: 3px; }
.card-link:hover .card-poster, .card-link:focus-visible .card-poster { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--line-2), var(--shadow-float); }
.card-link:focus-visible .card-poster { box-shadow: 0 0 0 2px var(--accent); }
.card-link:hover .card-poster img { transform: scale(1.05); }
.card-link:hover .poster-fade { opacity: .9; }
.card-link:hover .card-play { opacity: 1; }
.card-link:hover .card-play > span { transform: scale(1); }
.card-title {
    margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--fg-0);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: 2px; font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rank card (Most Watched): huy hiệu số hạng ở góc dưới trái, số tập chuyển sang phải */
.rank-badge {
    position: absolute; left: 8px; bottom: 8px; display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px;
    border-radius: var(--r-chip); font-family: var(--font-display); font-size: 19px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
}
.rank-gold { background: linear-gradient(135deg, rgb(255, 215, 114), rgb(245, 194, 76) 50%, rgb(201, 151, 31)); color: rgb(26, 18, 0); }
.rank-red { background: var(--accent); color: #fff; }
.rank-white { background: #fff; color: var(--bg-0); }
.card-rank .card-eps { left: auto; right: 8px; }

/* Wide card */
.card-wide {
    display: flex; gap: 16px; height: 100%; padding: 14px; border-radius: var(--r-panel);
    background: var(--bg-1); border: 1px solid var(--line); transition: border-color .22s, background-color .22s;
}
.card-wide:hover { border-color: var(--line-2); background: rgba(var(--c-bg-2) / .7); }
.card-wide-poster { flex-shrink: 0; width: 132px; aspect-ratio: 2 / 3; border-radius: var(--r-card); overflow: hidden; background: var(--bg-2); }
.card-wide-poster img { width: 100%; height: 100%; object-fit: cover; }
.card-wide-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.card-wide-tags { display: flex; gap: 6px; align-items: center; }
.card-wide-tags .pill-sm { height: 22px; font-size: 11px; padding: 0 9px; }
.card-wide-title {
    margin-top: 10px; font-family: var(--font-display); font-weight: 800; font-size: 18px; line-height: 1.25; letter-spacing: -.01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-wide-title a:hover { text-decoration: underline; }
.card-wide-eps { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--fg-2); }
.card-wide-desc {
    margin: 8px 0 14px; font-size: 13px; line-height: 1.5; color: var(--fg-1);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-wide .btn { margin-top: auto; }

/* ---------- Generic sections ---------- */
.block-section { padding-top: 44px; }
.platform-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.platform-card {
    display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    padding: 14px; border-radius: var(--r-card); background: var(--bg-1); border: 1px solid var(--line);
    transition: border-color .22s, transform .22s, background-color .22s;
}
.platform-card:hover { border-color: var(--line-2); background: var(--bg-2); transform: translateY(-2px); }
.platform-avatar {
    grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; object-fit: cover;
    background: linear-gradient(135deg, var(--accent), var(--accent-lo, #b20710)); font-family: var(--font-display); font-weight: 800; font-size: 20px;
}
.platform-name { font-weight: 700; font-size: 15px; }
.platform-count { font-size: 12px; color: var(--fg-2); }

.faq-list { display: grid; gap: 10px; margin-top: 16px; max-width: 920px; }
.faq-item { border-radius: var(--r-card); background: var(--bg-1); border: 1px solid var(--line); }
.faq-item summary {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px;
    cursor: pointer; font-weight: 700; font-size: 15px; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { transition: transform .22s; color: var(--fg-2); }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item p { padding: 0 18px 16px; color: var(--fg-1); font-size: 14px; line-height: 1.65; }

/* ---------- Page head / grids ---------- */
.page-head { padding-top: 28px; padding-bottom: 22px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-2); }
.breadcrumb li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumb a:hover { color: var(--fg-0); }
.breadcrumb [aria-current] { color: var(--fg-1); max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title { margin-top: 14px; font-family: var(--font-display); font-weight: 800; font-size: clamp(28px, 3.4vw, 44px); line-height: 1.12; letter-spacing: -.025em; }
.page-intro { margin-top: 8px; color: var(--fg-1); font-size: 15px; max-width: 720px; }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 16px; }
.poster-grid .card-title { font-size: 14px; }
.empty-state { padding: 60px 0; text-align: center; color: var(--fg-2); }

.search-inline {
    display: flex; align-items: center; gap: 10px; margin-top: 18px; max-width: 640px; height: 52px; padding: 0 6px 0 18px;
    border-radius: var(--r-pill); background: var(--bg-2); border: 1px solid var(--line); color: var(--fg-2);
}
.search-inline input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg-0); font-size: 15px; }

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.page-btn {
    display: grid; place-items: center; min-width: 42px; height: 42px; padding: 0 12px; border-radius: var(--r-chip);
    background: var(--bg-2); font-weight: 700; font-size: 14px;
}
.page-btn:hover { background: var(--bg-3); }
.page-btn.is-active { background: var(--accent); color: #fff; }
.page-gap { display: grid; place-items: center; width: 24px; color: var(--fg-2); }

.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.genre-card {
    display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: var(--r-card);
    background: linear-gradient(135deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--line);
    transition: border-color .22s, transform .22s;
}
.genre-card:hover { border-color: rgba(var(--c-accent) / .6); transform: translateY(-2px); }
.genre-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.genre-count { font-size: 12px; color: var(--fg-2); }

/* Leaderboard */
.board { display: grid; gap: 10px; }
.board-row {
    display: grid; grid-template-columns: 56px 64px 1fr auto auto; align-items: center; gap: 16px;
    padding: 10px 16px 10px 10px; border-radius: var(--r-card); background: var(--bg-1); border: 1px solid var(--line);
}
.board-row:hover { border-color: var(--line-2); }
.board-rank { text-align: center; font-family: var(--font-display); font-weight: 800; font-size: 30px; color: var(--fg-2); }
.board-row.is-top .board-rank { color: var(--accent); }
.board-poster { width: 64px; aspect-ratio: 2 / 3; border-radius: var(--r-chip); overflow: hidden; background: var(--bg-2); }
.board-poster img { width: 100%; height: 100%; object-fit: cover; }
.board-title { font-size: 16px; font-weight: 700; line-height: 1.35; }
.board-title a:hover { text-decoration: underline; }
.board-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-size: 13px; color: var(--fg-2); }
.board-views { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: var(--fg-1); }

/* ---------- Drama detail ---------- */
.drama-hero { position: relative; overflow: hidden; }
.drama-hero-bg { position: absolute; inset: 0; }
.drama-hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(36px) brightness(.45) saturate(1.2); transform: scale(1.2); }
.drama-hero-inner { position: relative; padding-top: 28px; padding-bottom: 40px; }
.drama-head { display: flex; gap: 48px; margin-top: 22px; align-items: flex-start; }
.drama-poster {
    flex-shrink: 0; width: 280px; aspect-ratio: 2 / 3; border-radius: var(--r-panel); overflow: hidden; background: var(--bg-2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px var(--line-2);
}
.drama-poster img { width: 100%; height: 100%; object-fit: cover; }
.drama-info { min-width: 0; flex: 1; max-width: 860px; }
.drama-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 3.6vw, 52px); line-height: 1.06; letter-spacing: -.025em; }
.drama-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: 14px; font-weight: 600; color: var(--fg-1); }
.drama-meta span { display: inline-flex; align-items: center; gap: 6px; }
.drama-info .hero-actions { margin-top: 22px; }
.synopsis { margin-top: 22px; max-width: 760px; }
.synopsis p { color: var(--fg-1); font-size: 16px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.synopsis.is-open p { -webkit-line-clamp: unset; display: block; }
.synopsis .link-btn[hidden] { display: none; }
.drama-info .chip-list { margin-top: 20px; }

.ep-wrap { margin-top: 14px; }
#episodes .notice-box { margin-top: 14px; }
.ep-ranges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ep-range {
    height: 36px; padding: 0 16px; border-radius: var(--r-pill); background: var(--bg-2);
    font-size: 13px; font-weight: 700; color: var(--fg-1); font-variant-numeric: tabular-nums; transition: background-color .14s, color .14s;
}
.ep-range:hover { background: var(--bg-3); color: var(--fg-0); }
.ep-range.is-active { background: #fff; color: var(--bg-0); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, 55px); gap: 6px; }
.ep-grid[hidden] { display: none; }
.ep-btn {
    position: relative; display: grid; place-items: center; width: 100%; height: 48px; border-radius: var(--r-chip);
    background: var(--bg-2); border: 1px solid transparent; color: var(--fg-0);
    font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; transition: background-color .14s, border-color .14s;
}
a.ep-btn:hover { background: var(--bg-3); border-color: var(--line-2); }
.ep-btn.is-locked { background: var(--bg-1); border-color: var(--line); color: var(--fg-2); font-weight: 600; }
a.ep-btn.is-locked:hover { color: var(--fg-0); background: var(--bg-2); }
.ep-crown { position: absolute; top: 3px; right: 4px; color: rgb(var(--c-vip)); line-height: 0; }
.ep-crown .icon { fill: rgb(var(--c-vip)); stroke-width: 1.5; }
.ep-btn.is-soon { background: transparent; border: 1px dashed var(--line-2); color: var(--fg-2); opacity: .55; cursor: not-allowed; font-weight: 600; }
.ep-btn.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }
.ep-sm .ep-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); max-height: 46vh; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.ep-sm .ep-btn { height: 44px; }
.ep-sm .ep-range { height: 32px; padding: 0 12px; font-size: 12px; }
.notice-box {
    display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-radius: var(--r-panel);
    background: var(--bg-1); border: 1px solid var(--line); color: var(--fg-1);
}

.about-box { padding: 24px; border-radius: var(--r-panel); background: var(--bg-1); border: 1px solid var(--line); }
.about-text { margin-top: 12px; color: var(--fg-1); font-size: 15px; line-height: 1.65; }
.info-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; margin: 18px 0 0; }
.info-list dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-2); }
.info-list dd { margin: 4px 0 0; font-weight: 600; }
.info-list dd a:hover { text-decoration: underline; }
.about-box .faq-list { max-width: none; margin-top: 24px; }
.about-box .faq-item { background: var(--bg-2); }

/* ---------- Watch page ---------- */
.watch-wrap { padding-top: 20px; }
.watch-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 24px 28px; margin-top: 18px; align-items: start;
}
.watch-player { grid-column: 1; grid-row: 1; }
.wd { grid-column: 1; grid-row: 2; min-width: 0; }
.watch-episodes { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 12px); min-width: 0; }
.watch-title a:hover { text-decoration: underline; }

/* Khung sân khấu quanh trình phát: nền poster làm mờ lấp khoảng trống hai bên video dọc */
.watch-player {
    position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center;
    padding: 24px; border-radius: var(--r-panel); background: var(--bg-1); border: 1px solid var(--line);
}
.watch-backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; }
.watch-backdrop img { width: 100%; height: 100%; object-fit: cover; filter: blur(44px) brightness(.38) saturate(1.25); transform: scale(1.2); }

/* Thông tin phim dưới trình phát */
.wd { container-type: inline-size; padding: 24px; border-radius: var(--r-panel); background: var(--bg-1); border: 1px solid var(--line); }
.wd-head { display: flex; gap: 20px; align-items: flex-start; }
.wd-poster {
    flex-shrink: 0; width: 120px; aspect-ratio: 2 / 3; border-radius: var(--r-card); overflow: hidden; background: var(--bg-2);
    box-shadow: 0 0 0 1px var(--line-2), 0 14px 36px rgba(0, 0, 0, .45); transition: transform .2s var(--ease-out-expo);
}
.wd-poster:hover { transform: translateY(-3px); }
.wd-poster img { width: 100%; height: 100%; object-fit: cover; }
.wd-main { flex: 1; min-width: 0; }
.wd-badges { flex-wrap: wrap; margin-bottom: 10px; }
.wd-meta { gap: 6px 16px; margin-top: 10px; color: var(--fg-2); }
.wd-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wd-body { display: grid; gap: 22px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.wd-about { min-width: 0; }
.wd-synopsis { margin-top: 10px; max-width: none; }
.wd-synopsis p { font-size: 15px; line-height: 1.7; -webkit-line-clamp: 3; }
.wd-genres { margin-top: 16px; gap: 6px; }
.wd-facts { align-content: start; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin: 0; padding: 18px; border-radius: var(--r-card); background: var(--bg-2); }
.wd-facts dd { overflow-wrap: anywhere; font-size: 14px; }
.wd-fact-wide { grid-column: 1 / -1; }
@container (min-width: 720px) {
    .wd-body { grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); }
}
@container (max-width: 460px) {
    .wd-head { gap: 14px; }
    .wd-poster { width: 92px; }
    .watch-title { font-size: 20px; }
    .wd .wd-meta { justify-content: flex-start; }
    .wd-actions { margin-inline: -106px 0; }
}
.player-frame {
    position: relative; width: 100%; max-width: calc((100vh - var(--header-h) - 210px) * 9 / 16); min-width: 280px;
    aspect-ratio: 9 / 16; border-radius: var(--r-panel); overflow: hidden; background: #000;
    box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px rgba(0, 0, 0, .6);
}
.player-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.player-empty img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px) brightness(.4); }
.player-empty p { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-pill); background: rgba(0, 0, 0, .6); font-weight: 600; font-size: 14px; }
.player-nav { display: flex; gap: 10px; width: 100%; max-width: 560px; margin-top: 16px; }
.player-nav .nav-card { min-width: 0; }
.nav-card {
    display: flex; align-items: center; gap: 10px; flex: 1; min-height: 56px; padding: 0 18px; border-radius: var(--r-card);
    background: var(--bg-1); border: 1px solid var(--line); font-weight: 700; font-size: 14px; transition: background-color .14s;
}
.nav-card:hover { background: var(--bg-2); }
.nav-card-next { justify-content: space-between; }
.nav-card-prev small, .nav-card-next small { display: block; font-size: 12px; font-weight: 600; color: var(--fg-2); }
.nav-card-prev b, .nav-card-next b { display: block; white-space: nowrap; }

.watch-side-title { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.watch-side-title .count { font-size: 14px; font-weight: 500; color: var(--fg-2); margin-left: 6px; }
.watch-side-sub { font-size: 14px; margin-top: 22px; }
.autoplay {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px;
    padding: 12px 14px; border-radius: var(--r-chip); background: var(--bg-1); font-size: 13px; font-weight: 600; cursor: pointer;
}
.switch {
    appearance: none; -webkit-appearance: none; flex-shrink: 0; position: relative; width: 40px; height: 24px; margin: 0;
    border-radius: var(--r-pill); background: var(--bg-3); cursor: pointer; transition: background-color .22s;
}
.switch::after {
    content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--fg-0); transition: transform .22s var(--ease-out-expo);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.up-next { display: grid; gap: 6px; }
.up-next a { display: flex; align-items: center; gap: 12px; padding: 6px; border-radius: var(--r-card); transition: background-color .14s; }
.up-next a:hover { background: var(--bg-1); }
.up-thumb { flex-shrink: 0; width: 44px; height: 64px; border-radius: var(--r-tag); overflow: hidden; background: var(--bg-2); }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-text { min-width: 0; }
.up-text b { display: block; font-size: 14px; }
.up-text small { display: block; font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 404 ---------- */
.not-found { padding-top: 80px; padding-bottom: 20px; text-align: center; }
.not-found .page-intro { margin-inline: auto; }
.nf-code { font-family: var(--font-display); font-weight: 800; font-size: clamp(90px, 14vw, 180px); line-height: 1; color: var(--accent); letter-spacing: -.05em; }
.nf-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- Footer ---------- */
.site-main { min-height: 60vh; padding-bottom: 60px; }
.site-footer { border-top: 1px solid var(--line); background: var(--bg-0); padding: 48px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.footer-brand p { margin-top: 14px; color: var(--fg-2); font-size: 14px; line-height: 1.6; max-width: 340px; }
.footer-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.site-footer ul { display: grid; gap: 9px; }
.site-footer nav a { font-size: 14px; color: var(--fg-2); transition: color .14s; }
.site-footer nav a:hover { color: var(--fg-0); }
.footer-bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 40px; padding-top: 22px;
    border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-2);
}

/* ---------- Search overlay ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); padding: 80px 16px 16px; }
.search-overlay[hidden] { display: none; }
.search-panel { max-width: 680px; margin: 0 auto; border-radius: var(--r-panel); background: var(--bg-1); border: 1px solid var(--line-2); box-shadow: var(--shadow-float); overflow: hidden; }
.search-form { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); color: var(--fg-2); }
.search-form input { flex: 1; min-width: 0; height: 44px; background: transparent; border: 0; outline: 0; font-size: 17px; color: var(--fg-0); }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-results { max-height: 60vh; overflow-y: auto; padding: 6px; }
.search-results:empty { display: none; }
.search-results a { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r-chip); }
.search-results a:hover, .search-results a.is-focus { background: var(--bg-2); }
.search-results img { width: 40px; height: 60px; border-radius: var(--r-tag); object-fit: cover; background: var(--bg-2); flex-shrink: 0; }
.search-results b { display: block; font-size: 14px; }
.search-results small { display: block; font-size: 12px; color: var(--fg-2); }
.search-results .sr-empty { padding: 18px; text-align: center; color: var(--fg-2); font-size: 14px; }

/* ---------- Mobile bottom bar ---------- */
.bottom-bar { display: none; }


/* ---------- FAQ (trái 6) + Browse genres (phải 4) ---------- */
.split-64 { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 4fr); gap: 40px; align-items: start; }
.split-64 .faq-list { max-width: none; }
.split-64 .section-title-faq { min-height: 32px; margin-bottom: 0; }
.split-64 .split-side .rail-head { min-height: 32px; margin-bottom: 16px; align-items: center; }
.split-64 .faq .faq-list { margin-top: 16px; }
@media (max-width: 1023px) {
    .split-64 { grid-template-columns: 1fr; gap: 44px; }
    .split-64 .split-side { order: -1; }
}

/* =========================================================
   TYPOGRAPHY – đo từ dramaflix.net @1280px (font-size / line-height / weight / letter-spacing)
   ========================================================= */
/* Trang chủ */
.hero-title   { font-size: clamp(34px, 4.22vw, 64px); line-height: 1.04; letter-spacing: -.025em; }   /* H2 54px / 56.16 */
.page-h1      { font-size: 26px; line-height: 1.5; letter-spacing: -.025em; }                       /* H1 26 / 39 */
.section-title { font-size: 28px; line-height: 1.25; letter-spacing: -.025em; }                     /* H2 28 / 35 */
.section-title-md  { font-size: 21px; line-height: 1.5; letter-spacing: normal; }                   /* Platforms, Browse genres 21 / 31.5 */
.section-title-faq { font-size: 18px; line-height: 1.5; font-weight: 700; letter-spacing: normal; } /* FAQ 18 / 27 */
.section-title-xs  { font-family: var(--font-sans); font-size: 15px; line-height: 1.5; font-weight: 700; letter-spacing: normal; } /* 15 / 22.5 */
.section-title-md .st-icon, .section-title-faq .st-icon { width: 20px; height: 20px; }
.section-title-xs .st-icon { width: 18px; height: 18px; }
.section-sub  { font-size: 14px; line-height: 1.5; color: var(--fg-1); }                            /* 14 / 21 */
.card-title   { font-size: 13px; line-height: 1.375; }                                              /* H3 13→14 / leading-snug */
.card-wide-title { font-size: 19px; line-height: 1.25; letter-spacing: normal; }                    /* 19 / 23.75 */

/* Trang danh sách (Browse, Genres, Dubbed, Leaderboard, Search…) */
.page-title   { font-size: clamp(28px, 2.82vw, 36px); line-height: 1.25; letter-spacing: -.025em; } /* H1 36 / 45 */
.page-title-xl { font-size: clamp(32px, 3.44vw, 44px); line-height: 1.08; }                         /* Platform H1 44 / 47.52 */
.board-title  { font-size: 16px; line-height: 1.375; }

/* Trang phim */
.drama-title  { font-size: clamp(32px, 4.07vw, 52px); line-height: 1.06; letter-spacing: -.025em; } /* H1 52 / 55.12 */
.synopsis h2  { font-size: 16px; line-height: 1.5; font-weight: 400; }
#h-episodes   { line-height: 1.5; letter-spacing: normal; }                                         /* H2 28 / 42 */
.section-title-sm { font-size: 22px; line-height: 1.5; letter-spacing: normal; }                    /* H2 22 / 33 */
.section-title-sm .st-icon { width: 20px; height: 20px; }

/* Trang xem */
.watch-title  { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; letter-spacing: normal; overflow-wrap: anywhere; }
.watch-ep     { line-height: 1.5; }
.watch-side-title { font-family: var(--font-display); font-size: 17px; line-height: 1.5; font-weight: 700; } /* H2 17 / 25.5 */
.watch-side-sub   { font-family: var(--font-sans); font-size: 14px; line-height: 20px; }            /* H3 14 / 20 */
.page-watch .cmt-title,
.page-watch .section-title-sm,
.page-watch .rail-section .section-title { font-size: 17px; line-height: 1.5; font-weight: 700; letter-spacing: normal; } /* H2 17 / 25.5 */
.page-watch .cmt-title .st-icon,
.page-watch .section-title-sm .st-icon,
.page-watch .rail-section .st-icon { width: 18px; height: 18px; }

/* Tài khoản & đăng nhập */
.auth-title   { line-height: 1.25; }
.panel-title, .acc-title { line-height: 1.3; }
.profile-name { line-height: 1.1; }

@media (min-width: 640px) {
    .card-title { font-size: 14px; }
}

/* ---------- Hero trang chủ – đo từ dramaflix.net @1280px ---------- */
.hero-content { max-width: 660px; }
.hero-badges { margin-bottom: 16px; }
.pill-badge { letter-spacing: .05em; }                                       /* 12px/700, ls 0.6px */
.hero-badges .tag { font-size: 11px; line-height: 16px; padding: 4px 8px; letter-spacing: normal; } /* NEW: 11px, cao 24px */
.hero-meta { flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; font-size: 14px; line-height: 21px; font-weight: 600; color: var(--fg-1); } /* 14/21 xám */
.hero-meta span + span::before { content: none; }
.hero-desc { max-width: 600px; margin-top: 16px; font-size: 16px; line-height: 26px; }   /* 16/26 */
.hero .hero-actions { margin-top: 28px; }
.hero .btn-ghost.btn-lg { padding: 0 24px; }
@media (min-width: 1024px) {
    /* Hero 709px dưới header 68px; nội dung căn giữa vùng 582px (padding 48 trên / 24 dưới), dải thumbnail bên dưới */
    .hero { height: calc(var(--header-h) + 709px); }
    .hero-inner { padding-top: calc(var(--header-h) + 48px); padding-bottom: 151px; gap: 48px; }
    /* Poster cao bằng vùng nội dung (582 - 48 - 24 = 510px) */
    .hero-poster { width: 300px; transform: none; }
    /* Dải thumbnail nằm ngay dưới vùng nội dung */
    .hero-thumbs { top: calc(var(--header-h) + 582px); bottom: auto; }
    .hero-thumb { width: 58px; height: 87px; }
}
@media (min-width: 1280px) {
    .hero-poster { width: 340px; }
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
    .rail-item { width: 28vw; }
}
@media (min-width: 768px) {
    .rail-item { width: 22vw; }
    .poster-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (min-width: 1024px) {
    .rail-item { width: 180px; }
    .poster-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px 16px; }
}
@media (min-width: 1280px) {
    .rail-item { width: 196px; }
}
@media (min-width: 1536px) {
    .rail-item { width: 210px; }
}

@media (max-width: 1279px) {
    .main-nav .nav-link[href$="/browse"] { display: none; }
}
@media (max-width: 1023px) {
    :root { --header-h: 60px; }
    .main-nav { display: none; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
    .hero-poster { display: none; }
    .hero { height: auto; min-height: 560px; }
    .hero-slide { position: absolute; }
    .hero-inner { align-items: flex-end; padding-bottom: 120px; min-height: 560px; }
    .hero-bg img { filter: brightness(.5); transform: none; object-position: center 20%; }
    .drama-head { gap: 28px; }
    .drama-poster { width: 200px; }
    .bottom-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr);
        height: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
        background: rgba(8, 8, 10, .94); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
    }
    .bottom-bar a, .bottom-bar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        font-size: 10.5px; font-weight: 600; color: var(--fg-2);
    }
    .bottom-bar .is-active { color: var(--fg-0); }
    .bottom-bar .is-active .icon { color: var(--accent); }
    body { padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }
    .rail-arrow { display: none; }
    /* Một cột: video -> danh sách tập -> thông tin phim */
    .watch-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .watch-player, .watch-episodes, .wd { grid-column: 1; grid-row: auto; }
    .watch-player { order: 1; }
    .watch-episodes { order: 2; position: static; }
    .wd { order: 3; }
}
@media (max-width: 767px) {
    .hero-title { font-size: 32px; }
    .hero-desc { font-size: 14px; }
    .hero-actions .btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
    .hero-thumbs .round-btn { display: none; }
    .section-title { font-size: 22px; }
    .page-h1 { font-size: 22px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-field select { max-width: none; flex: 1; }
    .cs-trigger { flex: 1; max-width: none; justify-content: space-between; }
    .cs-panel { width: 100%; max-width: none; }
    .filter-label { padding: 4px 4px 0; }
    .drama-head { flex-direction: column; align-items: center; text-align: center; }
    .drama-poster { width: 190px; }
    .drama-info .hero-badges, .drama-meta, .drama-info .hero-actions, .drama-info .chip-list { justify-content: center; }
    .synopsis { text-align: left; }
    .watch-player { padding: 0; border: 0; background: none; }
    .watch-backdrop { display: none; }
    .wd { padding: 18px; }
    .player-frame { max-width: 100%; min-width: 0; max-height: calc(100vh - var(--header-h) - 20px); }
    .player-nav { gap: 8px; }
    .player-nav .nav-card { padding: 0 12px; font-size: 13px; gap: 6px; }
    .nav-card-series span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* Đủ 3 nút: nút trang phim chỉ còn icon để hai nút tập không bị tràn */
    .player-nav:has(.nav-card-prev):has(.nav-card-next) .nav-card-series { flex: 0 0 48px; justify-content: center; padding: 0; }
    .player-nav:has(.nav-card-prev):has(.nav-card-next) .nav-card-series span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
    .board-row { grid-template-columns: 34px 54px 1fr auto; gap: 12px; }
    .board-poster { width: 54px; }
    .board-rank { font-size: 22px; }
    .board-cta { display: none; }
    .footer-bottom { flex-direction: column; }
    .card-wide-poster { width: 104px; }
    .lang-btn { padding: 0 10px; }
    .logo-text { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
