:root {
  --primary: #7c2ce8;
  --pink: #ec268f;
  --indigo: #2e3b98;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #fff;
  --page: #f5f6f8;
  --shadow: 0 5px 18px rgba(31, 41, 55, .12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
.container { width: min(1040px, calc(100% - 32px)); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  color: #fff;
  background: linear-gradient(100deg, #5b1d9c 0%, #283a98 100%);
  box-shadow: 0 2px 8px rgba(35, 24, 92, .3);
}
.nav-wrap {
  width: min(1040px, calc(100% - 32px));
  min-height: 58px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-mark { font-size: 22px; }
.brand strong { font-size: 19px; font-weight: 800; }
.desktop-nav { display: flex; gap: 22px; }
.nav-link { font-size: 14px; color: rgba(255,255,255,.86); }
.nav-link:hover, .nav-link.active { color: #fff; font-weight: 700; }
.header-search {
  position: relative;
  flex: 1;
  max-width: 430px;
  margin-left: auto;
}
.header-search span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}
.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 18px 0 38px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}
.nav-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 17px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 14px;
  background: linear-gradient(135deg, #9d38ef, #d12ee7);
}
.menu-btn { display: none; margin-left: auto; border: 0; color: #fff; background: transparent; font-size: 25px; }
.mobile-nav { display: none; padding: 6px 16px 14px; background: rgba(34, 25, 110, .96); }
.mobile-nav a { display: block; padding: 11px 8px; border-bottom: 1px solid rgba(255,255,255,.12); }
.mobile-nav.open { display: block; max-height: 70dvh; overflow: auto; }

/* Home hero and categories */
.hero-top {
  position: relative;
  overflow: hidden;
  padding: 44px 0 92px;
  text-align: center;
  background:
    radial-gradient(circle at 22% 35%, rgba(255, 130, 211, .22), transparent 27%),
    radial-gradient(circle at 82% 25%, rgba(125, 152, 255, .2), transparent 30%),
    linear-gradient(120deg, #fff7fd, #edf4ff);
}
.hero-glow { display: none; }
.hero-title { width: min(900px, calc(100% - 32px)); margin: auto; }
.hero-title h1 {
  margin: 0;
  font-size: clamp(34px, 4.4vw, 53px);
  line-height: 1.2;
  letter-spacing: -.045em;
  font-weight: 900;
  color: transparent;
  background: linear-gradient(90deg, #792ee7, #ec268f, #376bdc);
  -webkit-background-clip: text;
  background-clip: text;
}
.hero-title h2 { margin: 18px 0 0; font-size: 22px; font-weight: 500; color: #4b5563; }
.hero-title p { max-width: 820px; margin: 20px auto 0; color: #6b7280; font-size: 15px; line-height: 1.9; }
.cat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-top: 45px;
}
.pill {
  min-width: 0;
  min-height: 106px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 15px 10px;
  border: 1px solid rgba(124, 44, 232, .07);
  border-radius: 10px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 5px 18px rgba(93, 63, 141, .08);
  transition: transform .2s, box-shadow .2s;
}
.pill:hover { transform: translateY(-3px); box-shadow: 0 9px 24px rgba(93, 63, 141, .15); }
.pill-icon { font-size: 29px; line-height: 1; }
.pill strong { font-size: 15px; }
.pill > span:last-child { color: #7b8190; font-size: 11px; line-height: 1.35; }

/* Cards and sections */
.section-block { padding-top: 55px; }
.section-block + .section-block { padding-top: 64px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.section-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 26px; }
.section-head h2 span { color: #f0b400; }
.section-head a { margin-left: auto; color: var(--primary); font-size: 14px; font-weight: 700; }
.movie-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.movie-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e7e7ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(31, 41, 55, .1);
  transition: transform .2s, box-shadow .2s;
}
.movie-card:hover { transform: translateY(-3px); box-shadow: 0 9px 24px rgba(31, 41, 55, .16); }
.poster-link { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #ddd; }
.poster-link img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.movie-card:hover .poster-link img { transform: scale(1.04); }
.category-badge, .score-badge {
  position: absolute;
  top: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.category-badge { left: 10px; background: linear-gradient(135deg, #782be7, #b62ee7); }
.score-badge { right: 10px; color: #fff; background: #f0b400; }
.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: rgba(255,255,255,.9);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.8);
  transition: .2s;
}
.movie-card:hover .play-badge { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card-body { padding: 14px 15px 15px; }
.card-title { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; font-weight: 800; }
.card-body > p {
  height: 42px;
  margin: 8px 0 10px;
  overflow: hidden;
  color: #697181;
  font-size: 12px;
  line-height: 1.75;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-facts { display: flex; gap: 14px; color: #7b8190; font-size: 11px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.card-meta span, .tag-list span, .detail-meta span {
  padding: 3px 7px;
  border-radius: 5px;
  color: #7350a4;
  background: #f2ebfb;
  font-size: 10px;
}
.cta {
  margin-top: 70px;
  margin-bottom: 70px;
  padding: 48px 24px;
  border-radius: 12px;
  text-align: center;
  color: #fff;
  background: linear-gradient(110deg, #5c219d, #283b9b);
}
.cta h2 { margin: 0 0 12px; font-size: 28px; }
.cta p { color: rgba(255,255,255,.8); }
.cta-button, .btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #9b35ec, #e62f9a);
  cursor: pointer;
  font-weight: 700;
}

/* Inner pages */
.page-hero { padding: 42px 16px; text-align: center; background: linear-gradient(120deg, #fff4fc, #edf4ff); }
.page-hero h1 { margin: 0; font-size: 36px; }
.page-hero p { margin: 10px 0 0; color: var(--muted); }
.page-bottom { padding-top: 35px; padding-bottom: 55px; }
.categories-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.category-card { display: grid; grid-template-columns: 170px 1fr; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.cat-cover { display: grid; place-items: center; min-height: 150px; border-radius: 8px; color: #fff; background: linear-gradient(135deg, #7629e2, #eb2c91); font-weight: 800; }
.category-card p, .category-card li { color: var(--muted); font-size: 13px; line-height: 1.7; }
.search-panel { display: grid; grid-template-columns: 210px 1fr auto; gap: 12px; align-items: center; margin-bottom: 28px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search-panel strong { display: block; }
.search-panel > div > span { color: var(--muted); font-size: 12px; }
.search-panel input, .sort-select, .auth-form input {
  width: 100%;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #d9dce3;
  border-radius: 7px;
  outline: 0;
  background: #fff;
}
.search-panel input:focus, .sort-select:focus, .auth-form input:focus { border-color: var(--primary); }
.quick-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
.quick-chips a { padding: 5px 10px; border-radius: 999px; color: var(--primary); background: #f2ebfb; font-size: 12px; }
.empty-state { padding: 55px 16px; text-align: center; color: var(--muted); }
.load-more-wrap, .page-actions { display: flex; justify-content: center; gap: 10px; margin-top: 25px; }
.ranking-section, .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
.rank-main, .rank-side, .detail-main, .side-panel { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.rank-row { display: grid; grid-template-columns: 28px 78px 1fr auto; align-items: center; gap: 10px; padding: 8px; }
.rank-row img { width: 78px; height: 52px; border-radius: 6px; object-fit: cover; }
.rank-num { color: var(--primary); font-weight: 900; text-align: center; }
.rank-row strong, .rank-row em { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-row em, .rank-row small { color: var(--muted); font-size: 11px; font-style: normal; }
.auth-card { max-width: 440px; margin: 50px auto; padding: 28px; border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.auth-form input { margin-bottom: 12px; }
.form-error { color: #dc2626; font-size: 13px; }
.form-note, .auth-brand { text-align: center; }
.content-block { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }

/* Watch page */
.watch-page { padding: 30px 0 60px; background: var(--page); }
.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.watch-player, .watch-info, .comments-card { overflow: hidden; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.ad-ribbon { padding: 10px 14px; color: #fff; text-align: center; font-size: 12px; background: linear-gradient(90deg, #8d28e8, #e72786); }
.ad-ribbon span { margin-left: 8px; padding: 3px 7px; border-radius: 3px; background: rgba(255,255,255,.2); }
.player-box { aspect-ratio: 16 / 9; background: #000; }
.player-box video { width: 100%; height: 100%; object-fit: contain; }
.watch-info { margin-top: 18px; padding: 22px; }
.watch-info h1 { margin: 0 0 13px; font-size: 25px; }
.watch-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: #7b8190; font-size: 12px; }
.watch-score { color: #d8a800; font-weight: 800; }
.category-badge-static { padding: 3px 9px; border-radius: 999px; color: #7c2ce8; background: #f1e7fc; font-size: 10px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }
.watch-actions button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; color: #697181; background: #fafafa; }
.watch-info h2, .comments-card h2, .watch-related h2 { margin: 18px 0 12px; font-size: 17px; }
.watch-info p { color: #596170; font-size: 13px; line-height: 1.8; }
.comments-card { margin-top: 18px; min-height: 180px; padding: 20px; }
.comment-empty { display: grid; place-items: center; min-height: 100px; color: #9ca3af; font-size: 13px; }
.watch-related h2 { margin-top: 0; }
.related-item { display: grid; grid-template-columns: 105px 1fr; overflow: hidden; margin-bottom: 12px; border-radius: 7px; background: #fff; box-shadow: 0 3px 10px rgba(31,41,55,.12); }
.related-item img { width: 105px; height: 68px; object-fit: cover; }
.related-item div { min-width: 0; padding: 10px 9px; }
.related-item strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.related-item span { display: block; margin-top: 7px; color: #8a8f9b; font-size: 10px; }

/* Footer */
.site-footer { margin-top: 72px; color: rgba(255,255,255,.78); background: linear-gradient(110deg, #361567, #1d2c77); }
.footer-grid {
  width: min(1040px, calc(100% - 32px));
  margin: auto;
  padding: 45px 0 32px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: 36px;
}
.footer-logo { display: flex; gap: 8px; align-items: center; color: #fff; font-size: 19px; }
.footer-grid h3 { margin: 0 0 14px; color: #fff; font-size: 15px; }
.footer-grid p, .footer-grid li { font-size: 12px; line-height: 1.8; }
.footer-grid ul { margin: 0; padding: 0; list-style: none; }
.footer-bottom {
  width: min(1040px, calc(100% - 32px));
  margin: auto;
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 12px;
}
.footer-contact-fly { display: inline-flex; align-items: center; gap: 7px; animation: footerFly 3s ease-in-out infinite; }
.footer-tg-icon { width: 18px; height: 18px; color: #43a7e8; }
@keyframes footerFly { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-5px) rotate(3deg); } }

@media (max-width: 820px) {
  .desktop-nav { display: none; }
  .header-search { max-width: none; }
  .menu-btn { display: block; }
  .nav-auth { display: none; }
  .cat-strip { grid-template-columns: repeat(5, minmax(100px, 1fr)); overflow-x: auto; padding-bottom: 8px; }
  .movie-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .watch-layout, .ranking-section, .detail-layout { grid-template-columns: 1fr; }
  .watch-related { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .watch-related h2 { grid-column: 1 / -1; }
  .related-item { margin: 0; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .container, .nav-wrap, .footer-grid, .footer-bottom { width: min(100% - 24px, 1040px); }
  .nav-wrap { min-height: 52px; gap: 10px; }
  .brand strong { font-size: 16px; }
  .brand-mark { font-size: 18px; }
  .header-search input { height: 34px; font-size: 12px; }
  .hero-top { padding: 35px 0 55px; }
  .hero-title h1 { font-size: 30px; }
  .hero-title h2 { margin-top: 13px; font-size: 17px; }
  .hero-title p { margin-top: 14px; font-size: 12px; line-height: 1.7; }
  .cat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; gap: 10px; margin-top: 28px; }
  .pill { min-height: 92px; }
  .section-block, .section-block + .section-block { padding-top: 38px; }
  .section-head h2 { font-size: 21px; }
  .movie-grid { grid-template-columns: 1fr; gap: 15px; }
  .poster-link { aspect-ratio: 16 / 9; }
  .cta { width: calc(100% - 24px); margin-top: 45px; padding: 35px 16px; }
  .categories-grid, .footer-grid, .watch-related { grid-template-columns: 1fr; }
  .category-card { grid-template-columns: 1fr; }
  .search-panel { grid-template-columns: 1fr; }
  .watch-page { padding-top: 12px; }
  .watch-layout { gap: 18px; }
  .watch-info { padding: 17px; }
  .watch-info h1 { font-size: 21px; }
  .related-item { margin-bottom: 0; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}
