:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #eef6ff;
  --text: #111827;
  --muted: #64748b;
  --line: #e5e7eb;
  --blue: #2563eb;
  --blue-dark: #1e3a8a;
  --green: #16a34a;
  --orange: #f97316;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

button,
input,
select {
  font: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  color: var(--blue-dark);
  white-space: nowrap;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

.brand-text {
  font-size: 22px;
  letter-spacing: 0.03em;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-link,
.mobile-link {
  padding: 10px 14px;
  border-radius: 12px;
  color: #475569;
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active,
.mobile-link:hover,
.mobile-link.is-active {
  color: var(--blue);
  background: #eff6ff;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 320px;
}

.nav-search input,
.mobile-search input,
.hero-search input,
.filter-row input,
.filter-row select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--text);
  background: #ffffff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav-search input:focus,
.mobile-search input:focus,
.hero-search input:focus,
.filter-row input:focus,
.filter-row select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.nav-search button,
.mobile-search button,
.hero-search button,
.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.nav-search button,
.mobile-search button,
.hero-search button,
.primary-btn {
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.ghost-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
}

.nav-search button:hover,
.mobile-search button:hover,
.hero-search button:hover,
.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-2px);
}

.menu-toggle {
  display: none;
  margin-left: auto;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--blue-dark);
  background: #eff6ff;
}

.mobile-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 14px 16px 18px;
  background: #ffffff;
}

.mobile-panel.is-open {
  display: block;
}

.mobile-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mobile-panel nav {
  display: grid;
  gap: 6px;
}

.hero-carousel {
  position: relative;
  height: 600px;
  overflow: hidden;
  background: linear-gradient(120deg, #0f172a, #1e3a8a);
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.hero-bg,
.detail-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
}

.hero-mask,
.detail-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(2, 6, 23, 0.88), rgba(15, 23, 42, 0.56), rgba(15, 23, 42, 0.08));
}

.hero-content {
  position: absolute;
  top: 50%;
  left: max(24px, calc((100% - 1180px) / 2));
  width: min(640px, calc(100% - 48px));
  transform: translateY(-50%);
  color: #ffffff;
}

.hero-badge,
.section-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 13px;
  color: #ffffff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.hero-content h1,
.page-hero h1,
.detail-title-block h1 {
  margin: 18px 0 14px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.06;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.hero-content p,
.page-hero p,
.detail-title-block p {
  max-width: 680px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
}

.hero-tags {
  margin-top: 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.hero-control {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  font-size: 34px;
  line-height: 1;
  transform: translateY(-50%);
}

.hero-control.prev {
  left: 22px;
}

.hero-control.next {
  right: 22px;
}

.hero-dots {
  position: absolute;
  left: 50%;
  bottom: 34px;
  z-index: 5;
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}

.hero-dot {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  transition: width 0.2s ease, background 0.2s ease;
}

.hero-dot.is-active {
  width: 34px;
  background: #ffffff;
}

.page-stack {
  display: grid;
  gap: 64px;
  padding: 56px 0;
}

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

.section-heading h2 {
  margin: 10px 0 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  color: var(--text);
}

.section-heading p {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
}

.section-kicker {
  color: var(--blue);
  background: #dbeafe;
}

.section-more {
  color: var(--blue);
  font-weight: 900;
  white-space: nowrap;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.featured-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

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

.movie-card {
  min-width: 0;
}

.movie-card > a {
  height: 100%;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.movie-card > a:hover {
  transform: translateY(-6px);
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow: var(--shadow);
}

.poster-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #dbeafe;
}

.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease, filter 0.35s ease;
}

.movie-card > a:hover .poster-wrap img {
  transform: scale(1.06);
  filter: saturate(1.08);
}

.play-chip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: rgba(37, 99, 235, 0.92);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.32);
}

.rank-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #f97316, #ef4444);
  font-weight: 900;
}

.card-body {
  padding: 16px;
}

.card-body h3 {
  margin: 6px 0 8px;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 900;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-body p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta-row,
.meta-pills,
.side-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.meta-row span,
.meta-pills span {
  border-radius: 999px;
  padding: 4px 9px;
  background: #f1f5f9;
}

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

.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 12px;
  font-weight: 800;
}

.hero-tags .tag {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.movie-card.horizontal > a {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
}

.movie-card.horizontal .poster-wrap {
  aspect-ratio: auto;
  height: 100%;
  min-height: 230px;
}

.movie-card.compact .card-body h3 {
  font-size: 16px;
}

.movie-card.compact .card-body p {
  -webkit-line-clamp: 1;
}

.soft-panel,
.rank-panel,
.filter-panel,
.content-card,
.player-card,
.poster-panel {
  border: 1px solid rgba(219, 234, 254, 0.9);
  border-radius: 28px;
  background: linear-gradient(135deg, #ffffff, #eff6ff);
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.08);
}

.soft-panel,
.rank-panel,
.filter-panel {
  padding: 28px;
}

.category-grid,
.category-list-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.category-tile,
.category-card-large {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 24px;
  padding: 22px;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.78), rgba(37, 99, 235, 0.68));
  box-shadow: var(--shadow);
}

.category-tile img,
.category-card-large img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.32;
  transition: transform 0.3s ease;
}

.category-tile:hover img,
.category-card-large:hover img {
  transform: scale(1.08);
}

.category-tile span,
.category-tile p,
.category-card-large > div:not(.category-thumbs) {
  position: relative;
  z-index: 1;
}

.category-tile span {
  display: block;
  margin-top: 80px;
  font-size: 24px;
  font-weight: 950;
}

.category-tile p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.82);
}

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

.category-card-large {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
}

.category-thumbs img:nth-child(2),
.category-thumbs img:nth-child(3) {
  display: none;
}

.page-hero,
.detail-hero {
  position: relative;
  overflow: hidden;
  padding: 92px 0;
  color: #ffffff;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
}

.page-hero::before,
.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 18% 20%, rgba(96, 165, 250, 0.36), transparent 34%), radial-gradient(circle at 85% 10%, rgba(34, 197, 94, 0.28), transparent 30%);
}

.page-hero .container,
.detail-hero-inner {
  position: relative;
  z-index: 1;
}

.small-hero,
.category-hero,
.ranking-hero,
.search-hero {
  padding-top: 78px;
  padding-bottom: 78px;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
}

.filter-row label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.hero-search {
  display: flex;
  width: min(680px, 100%);
  gap: 12px;
  margin-top: 28px;
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 52px 58px minmax(0, 1fr) auto 58px;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 18px;
  background: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rank-row:hover {
  transform: translateX(4px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.rank-row img {
  width: 58px;
  height: 78px;
  object-fit: cover;
  border-radius: 12px;
}

.rank-number,
.rank-score {
  color: var(--blue);
  font-weight: 950;
}

.rank-title {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rank-meta {
  color: var(--muted);
  font-size: 14px;
}

.detail-hero {
  min-height: 430px;
  padding: 0;
  background: #0f172a;
}

.detail-bg,
.detail-mask {
  position: absolute;
  inset: 0;
}

.detail-hero-inner {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 24px;
  padding-bottom: 34px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.breadcrumb a:hover {
  color: #ffffff;
}

.detail-title-block {
  max-width: 780px;
  margin-top: 36px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 360px;
  gap: 28px;
  padding: 44px 0 0;
}

.detail-main {
  display: grid;
  gap: 24px;
}

.player-card,
.content-card,
.poster-panel {
  overflow: hidden;
  padding: 24px;
  background: #ffffff;
}

.video-shell {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: #000000;
  aspect-ratio: 16 / 9;
}

.player-video {
  width: 100%;
  height: 100%;
  background: #000000;
  object-fit: contain;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.42), rgba(37, 99, 235, 0.18));
  cursor: pointer;
}

.play-overlay.is-hidden {
  display: none;
}

.play-overlay span {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.95);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.45);
  font-size: 34px;
}

.content-card h2 {
  margin: 0 0 12px;
  font-size: 26px;
}

.content-card h2:not(:first-child) {
  margin-top: 28px;
}

.content-card p {
  margin: 0;
  color: #334155;
  font-size: 17px;
  line-height: 1.9;
}

.poster-panel {
  position: sticky;
  top: 96px;
}

.poster-panel img {
  width: 100%;
  border-radius: 20px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.poster-panel h2 {
  margin: 18px 0 12px;
  font-size: 24px;
}

.side-meta {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.related-stack {
  padding-top: 38px;
}

.site-footer {
  margin-top: 40px;
  color: #cbd5e1;
  background: linear-gradient(180deg, #111827, #020617);
}

.footer-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  padding: 42px 0;
}

.footer-brand {
  color: #ffffff;
  font-size: 24px;
}

.footer-inner p {
  max-width: 560px;
  margin: 12px 0 0;
}

.footer-links {
  display: grid;
  gap: 10px;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  padding: 18px 0;
  text-align: center;
  color: #94a3b8;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: 46px;
  height: 46px;
  display: none;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.28);
}

.back-to-top.is-visible {
  display: grid;
  place-items: center;
}

.is-filtered-out {
  display: none;
}

@media (max-width: 1100px) {
  .nav-search {
    display: none;
  }

  .movie-grid,
  .featured-grid,
  .catalog-grid,
  .compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .detail-layout {
    grid-template-columns: 1fr;
  }

  .poster-panel {
    position: static;
  }
}

@media (max-width: 780px) {
  .header-inner {
    height: 64px;
  }

  .desktop-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .brand-text {
    font-size: 19px;
  }

  .hero-carousel {
    height: 540px;
  }

  .hero-content {
    left: 20px;
    width: calc(100% - 40px);
  }

  .hero-control {
    display: none;
  }

  .section-heading,
  .footer-inner {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .movie-grid,
  .featured-grid,
  .horizontal-grid,
  .catalog-grid,
  .compact-grid,
  .category-grid,
  .category-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .movie-card.horizontal > a {
    grid-template-columns: 1fr;
  }

  .filter-row,
  .rank-row {
    grid-template-columns: 1fr;
  }

  .rank-row img {
    display: none;
  }

  .hero-search,
  .mobile-search {
    flex-direction: column;
  }

  .detail-title-block h1,
  .hero-content h1,
  .page-hero h1 {
    font-size: 36px;
  }
}

@media (max-width: 520px) {
  .movie-grid,
  .featured-grid,
  .horizontal-grid,
  .catalog-grid,
  .compact-grid,
  .category-grid,
  .category-list-grid {
    grid-template-columns: 1fr;
  }

  .page-stack {
    gap: 42px;
    padding: 38px 0;
  }

  .soft-panel,
  .rank-panel,
  .filter-panel,
  .content-card,
  .player-card,
  .poster-panel {
    padding: 18px;
    border-radius: 20px;
  }
}
