:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #171a24;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #5b4bdb;
  --brand-strong: #4232bc;
  --brand-soft: #efedff;
  --accent: #f59e0b;
  --danger: #c2413a;
  --shadow: 0 18px 50px rgba(23, 26, 36, .08);
  --radius: 18px;
  --header-h: 72px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #101117;
  --surface: #171922;
  --surface-2: #20232e;
  --text: #f4f6fb;
  --muted: #a5adbd;
  --line: #2c3040;
  --brand: #8b7cf6;
  --brand-strong: #a79cff;
  --brand-soft: #26223f;
  --accent: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 18px 55px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(91, 75, 219, .08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

img { display: block; max-width: 100%; }

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

button, input, select { font: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 1000;
  padding: .75rem 1rem;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  transition: top .2s ease;
}

.skip-link:focus { top: 1rem; }

.container {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-h);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  font-weight: 850;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #8f6df2);
  color: white;
  box-shadow: 0 8px 22px rgba(91, 75, 219, .28);
}

.main-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .3rem;
}

.main-nav a {
  padding: .6rem .8rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 650;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.menu-toggle { display: none; }

main { min-height: 65vh; }

.hero {
  padding: 4.8rem 0 2.2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 2rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  color: var(--brand);
  font-weight: 800;
  font-size: .86rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hero h1,
.page-hero h1,
.detail-title {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.7rem);
  line-height: 1.03;
  letter-spacing: -.055em;
}

.hero h1 span { color: var(--brand); }

.hero-copy {
  max-width: 700px;
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .9rem;
}

.stat-card {
  min-height: 135px;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  letter-spacing: -.04em;
}

.stat-card span { color: var(--muted); }

.search-panel {
  position: relative;
  z-index: 3;
  margin-top: 2rem;
  padding: .8rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 180px;
  gap: .7rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.field {
  position: relative;
}

.field svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 20px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-panel input,
.search-panel select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--bg);
  color: var(--text);
}

.search-panel input { padding: .8rem 1rem .8rem 3rem; }
.search-panel select { padding: .8rem 2.5rem .8rem 1rem; }

.section { padding: 2.2rem 0; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -.035em;
}

.section-heading p {
  margin: .25rem 0 0;
  color: var(--muted);
}

.text-link {
  color: var(--brand);
  font-weight: 750;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: start;
}

.subtitle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.subtitle-card {
  overflow: hidden;
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(23, 26, 36, .045);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.subtitle-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: var(--shadow);
}

.card-poster {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  background: var(--surface-2);
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-year {
  position: absolute;
  left: .65rem;
  top: .65rem;
  padding: .25rem .52rem;
  border-radius: 999px;
  background: rgba(12, 13, 18, .78);
  color: white;
  font-size: .78rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.card-body {
  min-width: 0;
  padding: 1rem;
}

.card-kicker {
  margin-bottom: .35rem;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.card-title {
  margin: 0;
  font-size: 1.14rem;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.card-subtitle {
  overflow: hidden;
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-description {
  display: -webkit-box;
  overflow: hidden;
  margin: .7rem 0;
  color: var(--muted);
  font-size: .9rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: .3rem .55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .77rem;
  font-weight: 700;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  display: grid;
  gap: 1rem;
}

.sidebar-card,
.content-card {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sidebar-card h3,
.content-card h2,
.content-card h3 {
  margin-top: 0;
  letter-spacing: -.02em;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 1rem;
  border: 1px dashed color-mix(in srgb, var(--muted) 50%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  color: var(--muted);
  text-align: center;
  font-size: .82rem;
}

.ad-slot--active {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.ad-slot--active .adsbygoogle { width: 100%; }

.ad-slot--sidebar { min-height: 250px; }
.ad-slot--active.ad-slot--sidebar { min-height: 250px; }
.ad-slot--article { min-height: 180px; margin: 1.5rem 0; }
.ad-slot--active.ad-slot--article { min-height: 90px; }

.page-hero {
  padding: 3.2rem 0 1.8rem;
}

.page-hero h1 { font-size: clamp(2rem, 5vw, 3.6rem); }

.page-hero p {
  max-width: 720px;
  color: var(--muted);
}

.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  color: var(--muted);
}

.empty-state {
  display: none;
  padding: 3rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state.show { display: block; }

.detail-wrap {
  padding: 3rem 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: .9rem;
}

.breadcrumbs a:hover { color: var(--brand); }

.detail-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: start;
}

.detail-poster {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-poster img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.detail-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.detail-vn-title {
  margin: .45rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.detail-description {
  margin: 1.2rem 0;
  color: var(--muted);
  font-size: 1.03rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin: 1.3rem 0;
}

.meta-item {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
}

.meta-item strong {
  display: block;
  margin-top: .15rem;
  font-size: .94rem;
}

.download-box {
  padding: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--brand-soft), var(--surface));
  box-shadow: var(--shadow);
}

.download-box h2 {
  margin: 0 0 .4rem;
  font-size: 1.2rem;
}

.download-box p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .9rem;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .55rem;
  min-height: 46px;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 800;
  transition: transform .15s ease, background .15s ease;
}

.button:hover { transform: translateY(-1px); }

.button-primary {
  width: 100%;
  background: var(--brand);
  color: white;
}

.button-primary:hover { background: var(--brand-strong); }

.button-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.button-row {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

.notice {
  padding: 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.prose {
  max-width: 820px;
}

.prose h2 {
  margin-top: 2rem;
  font-size: 1.45rem;
}

.prose p,
.prose li { color: color-mix(in srgb, var(--text) 82%, var(--muted)); }

.prose a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose ul { padding-left: 1.2rem; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.tag-cloud a {
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.tag-cloud a:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.coffee-button {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1rem;
  border: 0;
  border-radius: 999px;
  background: #1d1a16;
  color: #fff8e8;
  box-shadow: 0 14px 36px rgba(0,0,0,.24);
  font-weight: 800;
}

.coffee-button:hover { transform: translateY(-2px); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  place-items: center;
  padding: 1rem;
}

.modal[aria-hidden="false"] { display: grid; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 16, .72);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  width: min(470px, 100%);
  max-height: min(720px, calc(100vh - 2rem));
  overflow: auto;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

.modal-close {
  position: absolute;
  right: .8rem;
  top: .8rem;
}

.coffee-qr {
  width: min(270px, 80%);
  aspect-ratio: 1;
  margin: 1rem auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  object-fit: contain;
}

.bank-info {
  display: grid;
  gap: .65rem;
  padding: 1rem;
  border-radius: 15px;
  background: var(--surface-2);
}

.bank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
}

.bank-row span { color: var(--muted); }
.bank-row strong { text-align: right; word-break: break-word; }

.copy-status {
  min-height: 1.3rem;
  margin-top: .55rem;
  color: var(--brand);
  font-size: .85rem;
  text-align: center;
}

.site-footer {
  margin-top: 3rem;
  padding: 3rem 0 1.5rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, .7fr);
  gap: 2rem;
}

.footer-brand p {
  max-width: 480px;
  color: var(--muted);
}

.footer-links {
  display: grid;
  align-content: start;
  gap: .55rem;
}

.footer-links h3 {
  margin: 0 0 .45rem;
  font-size: .95rem;
}

.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .86rem;
}

.footer-bottom a { color: var(--brand); }

.mobile-only { display: none; }

@media (max-width: 1050px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .detail-grid > aside { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .hero { padding-top: 3rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-panel { grid-template-columns: 1fr; }
  .subtitle-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 180px minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }

  .menu-toggle { display: inline-grid; margin-left: auto; }
  .main-nav {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: calc(var(--header-h) - .1rem);
    display: none;
    padding: .6rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .main-nav.open { display: grid; }
  .main-nav a { padding: .8rem; }
}

@media (max-width: 620px) {
  .container { width: min(100% - 22px, 1180px); }
  .hero h1 { font-size: 2.55rem; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 112px; padding: 1rem; }
  .stat-card strong { font-size: 1.55rem; }
  .subtitle-card { grid-template-columns: 105px minmax(0, 1fr); min-height: 180px; }
  .card-body { padding: .85rem; }
  .card-description { -webkit-line-clamp: 2; margin: .55rem 0; }
  .sidebar { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-poster { width: min(240px, 70%); }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: auto; }
  .footer-bottom { flex-direction: column; }
  .coffee-button span { display: none; }
  .coffee-button { width: 52px; height: 52px; padding: 0; justify-content: center; }
  .mobile-only { display: initial; }
}

@media (max-width: 410px) {
  .hero-stats { grid-template-columns: 1fr; }
  .subtitle-card { grid-template-columns: 92px minmax(0, 1fr); }
  .card-description { display: none; }
  .meta-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Giao diện thẻ phụ đề tối giản: thumbnail, tên phim và nút tải. */
.subtitle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
}

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

.subtitle-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.card-poster {
  width: 100%;
  min-height: 0;
  aspect-ratio: 2 / 3;
}

.card-poster img {
  aspect-ratio: 2 / 3;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1rem;
}

.card-title {
  font-size: 1.05rem;
}

.card-subtitle {
  white-space: normal;
}

.card-download {
  margin-top: auto;
  padding-top: .68rem;
  padding-bottom: .68rem;
}

.simple-detail {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) 300px;
  gap: 1.7rem;
  align-items: start;
}

.simple-detail-content {
  min-width: 0;
}

.detail-download {
  width: min(100%, 360px);
  margin-top: .35rem;
}

.detail-actions {
  margin-top: .8rem;
}

.simple-note {
  margin-top: 1.5rem;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.simple-note strong {
  display: block;
  margin-bottom: .4rem;
}

.simple-note p {
  margin: 0;
  color: var(--muted);
}

.detail-ad {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

@media (max-width: 1050px) {
  .subtitle-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .subtitle-grid--wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .simple-detail { grid-template-columns: 230px minmax(0, 1fr); }
  .detail-ad { grid-column: 1 / -1; position: static; }
}

@media (max-width: 820px) {
  .subtitle-grid,
  .subtitle-grid--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .simple-detail { grid-template-columns: 190px minmax(0, 1fr); }
}

@media (max-width: 620px) {
  .subtitle-grid,
  .subtitle-grid--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .subtitle-card { min-height: 0; }
  .card-body { padding: .8rem; }
  .card-title { font-size: .94rem; }
  .card-subtitle { font-size: .8rem; }
  .card-download { min-height: 42px; padding-inline: .55rem; font-size: .86rem; }
  .simple-detail { grid-template-columns: 1fr; }
  .detail-poster { width: min(270px, 78%); margin-inline: auto; }
  .detail-download { width: 100%; }
}

@media (max-width: 390px) {
  .subtitle-grid,
  .subtitle-grid--wide { grid-template-columns: 1fr 1fr; }
  .card-year { left: .45rem; top: .45rem; }
}
.payment-title {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.payment-separator {
  margin: 22px 0;
  border-top: 1px solid var(--border);
}