:root {
  --bg: #0a0c10;
  --bg-2: #0e1117;
  --surface: #161a23;
  --surface-2: #1d2230;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #eef1f6;
  --muted: #8b93a7;
  --soft: #c6ccd9;
  --accent: #f0b429;
  --accent-2: #ffd166;
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 12, 16, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 66px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-decoration: none;
  white-space: nowrap;
}

.logo svg {
  width: 27px;
  height: 27px;
  color: var(--accent);
  flex: none;
}

.site-nav {
  display: flex;
  gap: 2px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.site-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
}

.header-search {
  position: relative;
  margin-left: auto;
  width: 280px;
}

.header-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.header-search input:focus {
  border-color: var(--accent);
}

/* ---------- hero ---------- */

#hero {
  position: relative;
  height: min(72vh, 640px);
  min-height: 420px;
  overflow: hidden;
  margin-bottom: 6px;
}

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

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

.hero-slide > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 12, 16, 0.94) 0%, rgba(10, 12, 16, 0.6) 42%,
      rgba(10, 12, 16, 0.12) 78%),
    linear-gradient(0deg, var(--bg) 0%, rgba(10, 12, 16, 0) 42%);
}

.hero-box {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 54px;
  z-index: 2;
}

.hero-box.container {
  margin: 0 auto;
}

.hero-chip {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 11px;
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 50px);
  line-height: 1.05;
  max-width: 20ch;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

.hero-meta {
  margin-bottom: 14px;
  color: var(--soft);
  font-size: 15px;
}

.hero-desc {
  margin: 0 0 22px;
  max-width: 58ch;
  color: var(--soft);
  font-size: 15px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-primary {
  display: inline-block;
  padding: 12px 22px;
  background: var(--accent);
  border-radius: 10px;
  color: #171207;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-2);
}

.hero-dots {
  position: absolute;
  right: 24px;
  bottom: 26px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.hero-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.hero-dot.active {
  width: 24px;
  background: var(--accent);
}

/* ---------- rows ---------- */

.row {
  margin: 30px 0 4px;
}

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.row-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.row-more {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.row-more:hover {
  color: var(--accent);
}

.row-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}

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

.row-track {
  display: flex;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2px 24px 16px;
}

.row-track .card {
  flex: 0 0 168px;
}

/* ---------- cards ---------- */

.card {
  text-decoration: none;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
}

.card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

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

.poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.16);
  font-size: 44px;
  font-weight: 700;
}

.card-rating {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.card-body {
  padding-top: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- catalog ---------- */

.catalog-title {
  margin: 28px 0 16px;
  font-size: 28px;
}

.catalog-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.control {
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.control:focus {
  border-color: var(--accent);
}

select.control option {
  background: var(--surface);
  color: var(--text);
}

.catalog-search {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 340px;
}

.btn-reset {
  cursor: pointer;
  color: var(--muted);
}

.btn-reset:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.catalog-count {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 24px 16px;
  padding-bottom: 24px;
}

.load-more {
  display: block;
  margin: 6px auto 48px;
}

/* ---------- detail ---------- */

.detail {
  position: relative;
  padding-bottom: 8px;
}

.detail-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  overflow: hidden;
  pointer-events: none;
}

.detail-backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.detail-backdrop img.is-poster {
  filter: blur(16px);
  transform: scale(1.08);
}

.detail-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, var(--bg) 2%, rgba(10, 12, 16, 0.35) 55%,
      rgba(10, 12, 16, 0.15) 100%);
}

.detail-inner {
  position: relative;
  display: flex;
  gap: 36px;
  padding-top: 180px;
}

.detail-poster-wrap {
  flex: 0 0 260px;
}

.detail-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55);
}

.detail-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-poster .poster-fallback {
  font-size: 64px;
}

.detail-info {
  flex: 1;
  min-width: 0;
}

.detail-type {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-info h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.5vw, 44px);
  line-height: 1.1;
}

.detail-original {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 15px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 16px;
  color: var(--soft);
  font-size: 14px;
}

.detail-rating {
  color: var(--accent);
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--soft);
  font-size: 13px;
}

.detail-info h2 {
  margin: 22px 0 10px;
  font-size: 18px;
}

.detail-overview {
  margin: 0;
  max-width: 75ch;
  color: var(--soft);
  font-size: 15px;
  line-height: 1.65;
}

.btn-ghost {
  display: inline-block;
  margin-top: 20px;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- states ---------- */

.loading {
  display: flex;
  justify-content: center;
  padding: 120px 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.state {
  padding: 60px 0;
  color: var(--muted);
  text-align: center;
  font-size: 15px;
}

.state p {
  margin: 0 0 4px;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 48px;
  padding: 32px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-inner p {
  margin: 0;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.footer-brand svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.attribution {
  opacity: 0.75;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .detail-inner {
    flex-direction: column;
    gap: 24px;
    padding-top: 150px;
  }

  .detail-backdrop {
    height: 400px;
  }

  .detail-poster-wrap {
    width: 170px;
  }
}

@media (max-width: 760px) {
  .container {
    padding: 0 16px;
  }

  .row-track {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 0;
    row-gap: 6px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .header-search {
    order: 2;
    width: 190px;
  }

  #hero {
    min-height: 380px;
    height: 62vh;
  }

  .hero-box {
    bottom: 34px;
  }

  .hero-dots {
    right: 16px;
    bottom: 14px;
  }

  .row-track .card {
    flex-basis: 142px;
  }

  .catalog-search {
    max-width: none;
    flex-basis: 100%;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 20px 12px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 26px;
  }

  .hero-desc {
    -webkit-line-clamp: 2;
    font-size: 14px;
  }
}
