:root {
  --clr-bg: #ffffff;
  --clr-surface: #fafafa;
  --clr-border: #e0e0e0;
  --clr-text: #212121;
  --clr-muted: #757575;
  --clr-primary: #be123c;
  --clr-accent: #f43f5e;
  --radius-md: 16px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --gap: clamp(1rem, 2vw, 1.5rem);
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --fs-hero: clamp(26px, 3.4vw, 32px);
  --fs-body: 15px;
  --fs-body-desktop: 16px;
  --fs-section: 20px;
  --fs-card-title: 15px;
  --fs-news-title: 16px;
  --fs-muted: 13px;
  --fs-micro: 12px;
  --lh-body: 1.7;
  --space-section: 48px;
  --space-section-desktop: 64px;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.07);
  --shadow-header: 0 1px 8px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--clr-text);
  background: var(--clr-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  width: 100%;
  object-fit: cover;
  display: block;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* ============ Header ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--clr-border);
  height: 64px;
}

header.is-scrolled {
  box-shadow: var(--shadow-header);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--clr-primary);
  text-decoration: none;
  letter-spacing: 0.3px;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-main {
  display: flex;
  gap: 24px;
}

.nav-main a {
  font-size: 15px;
  color: var(--clr-text);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.2s;
}

.nav-main a:hover {
  color: var(--clr-primary);
}

.menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 6px;
  color: var(--clr-text);
  cursor: pointer;
  line-height: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-pill);
  background: var(--clr-surface);
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  width: 140px;
  color: var(--clr-text);
  font-family: var(--font-base);
}

.search-box input::placeholder {
  color: var(--clr-muted);
}

.search-count {
  font-size: var(--fs-micro);
  color: var(--clr-muted);
  white-space: nowrap;
}

/* ============ Layout ============ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.layout-three {
  display: grid;
  grid-template-columns: 200px 1fr 280px;
  gap: var(--gap);
  padding: var(--gap) 0;
  align-items: start;
}

.sidebar-left,
.sidebar-right {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.main-content {
  min-width: 0;
}

.main-content > section,
.main-content > .section {
  margin-top: var(--space-section);
}

/* ============ Hero ============ */
.hero-banner {
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
  border-radius: var(--radius-md);
  padding: 3rem 2rem;
  color: #fff;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: center;
  margin-bottom: var(--gap);
  overflow: hidden;
}

.hero-text h1 {
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 14px;
}

.hero-text p {
  font-size: 15px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.86);
  margin: 0 0 24px;
  max-width: 52ch;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--clr-primary);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.btn-hero svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.hero-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* ============ Section Title ============ */
.section-title {
  display: flex;
  align-items: center;
  font-size: var(--fs-section);
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 16px;
}

.section-title::before {
  content: "";
  width: 3px;
  height: 16px;
  margin-right: 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--clr-primary), var(--clr-accent));
  flex: 0 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: 16px;
}

.section-header .section-title {
  margin: 0;
}

.more-link {
  font-size: var(--fs-muted);
  color: var(--clr-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.more-link:hover {
  color: var(--clr-primary);
}

/* ============ Video Grid ============ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}

.video-card {
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.45s ease both;
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.video-thumb {
  position: relative;
  display: block;
}

.video-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: var(--fs-micro);
  line-height: 1;
}

.video-info {
  padding: 12px 14px 14px;
}

.video-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 2.9em;
  min-height: 2.9em;
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 10px;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.uploader-avatar {
  flex: 0 0 auto;
}

.uploader-avatar img {
  width: 36px;
  height: 36px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.uploader-info {
  min-width: 0;
}

.uploader-name {
  font-size: 13px;
  color: var(--clr-text);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-stats {
  display: flex;
  gap: 10px;
  font-size: var(--fs-micro);
  color: var(--clr-muted);
}

.video-stats span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

/* ============ Live Grid ============ */
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap);
}

.live-card {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.live-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.live-thumb {
  position: relative;
  display: block;
}

.live-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--clr-primary);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
}

.live-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  animation: livePulse 1.4s ease-in-out infinite;
}

.live-online {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: var(--fs-micro);
  line-height: 1.5;
}

.live-info {
  padding: 10px 12px 12px;
}

.live-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--fs-card-title);
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 6px;
}

.live-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--fs-micro);
  color: var(--clr-muted);
}

/* ============ News List ============ */
.news-list {
  display: block;
}

.news-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--clr-border);
}

.news-item:first-child {
  padding-top: 0;
}

.news-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-item time {
  font-size: var(--fs-micro);
  color: var(--clr-muted);
  display: block;
  margin-bottom: 6px;
}

.news-item p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--clr-muted);
  margin: 0;
}

/* ============ FAQ ============ */
.faq-list {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-item + .faq-item {
  border-top: 1px solid var(--clr-border);
}

.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
}

.faq-q::after {
  content: "+";
  font-size: 18px;
  font-weight: 400;
  color: var(--clr-muted);
  transition: transform 0.25s;
  flex: 0 0 auto;
}

.faq-item.open .faq-q::after {
  transform: rotate(45deg);
}

.faq-a {
  display: none;
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--clr-muted);
}

.faq-item.open .faq-a {
  display: block;
}

/* ============ About ============ */
.about-text p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--clr-text);
  margin: 0 0 var(--space-md);
}

.about-text p:last-child {
  margin-bottom: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-lg);
}

.tags a {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  font-size: var(--fs-muted);
  color: var(--clr-text);
  text-decoration: none;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.tags a:hover {
  background: #fff;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}

/* ============ Left Sidebar ============ */
.sidebar-card {
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.sidebar-card h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 12px;
}

.category-list {
  display: block;
}

.category-list a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--clr-text);
  text-decoration: none;
  transition: background 0.18s, color 0.18s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-list a:hover {
  background: var(--clr-surface);
  color: var(--clr-primary);
}

/* ============ Right Sidebar ============ */
.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 12px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 10px;
}

.tab-btn {
  background: none;
  border: none;
  font-family: var(--font-base);
  font-size: var(--fs-muted);
  padding: 6px 10px;
  color: var(--clr-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: var(--clr-text);
}

.tab-btn.active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}

.rank-list {
  display: block;
}

.rank-item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  align-items: flex-start;
}

.rank-num {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-micro);
  font-weight: 700;
  background: var(--clr-surface);
  color: var(--clr-muted);
}

.rank-item:nth-child(-n + 3) .rank-num {
  background: var(--clr-primary);
  color: #fff;
}

.rank-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
  color: var(--clr-text);
  flex: 1 1 auto;
  min-width: 0;
  transition: color 0.2s;
}

.rank-title:hover {
  color: var(--clr-primary);
}

.rank-value {
  flex: 0 0 auto;
  font-size: var(--fs-micro);
  color: var(--clr-muted);
  line-height: 1.4;
}

/* ============ Category Scroll (mobile) ============ */
.cat-scroll {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
}

.cat-scroll a {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  font-size: var(--fs-muted);
  color: var(--clr-text);
  text-decoration: none;
  white-space: nowrap;
}

.cat-scroll a:hover {
  color: var(--clr-primary);
}

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

/* ============ Footer ============ */
.site-footer {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  margin-top: calc(var(--gap) * 2);
  padding-top: 2.5rem;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0 0 12px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col ul a {
  font-size: var(--fs-muted);
  color: var(--clr-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-col ul a:hover {
  color: var(--clr-primary);
}

.friend-links {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding: 14px 1rem 20px;
  border-top: 1px solid var(--clr-border);
  font-size: var(--fs-muted);
  line-height: 2;
  color: var(--clr-muted);
  text-align: center;
}

.friend-links span {
  color: var(--clr-muted);
}

.friend-links a {
  color: var(--clr-muted);
  text-decoration: none;
  margin: 0 6px;
  transition: color 0.2s;
}

.friend-links a:hover {
  color: var(--clr-primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 1rem;
  border-top: 1px solid var(--clr-border);
  text-align: center;
}

.footer-bottom p {
  font-size: var(--fs-muted);
  color: var(--clr-muted);
  line-height: 1.6;
  margin: 0;
}

.footer-bottom p + p {
  margin-top: 6px;
}

.footer-bottom a {
  color: var(--clr-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-bottom a:hover {
  color: var(--clr-primary);
}

/* ============ To Top ============ */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
  z-index: 90;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ============ Animations ============ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

/* ============ Responsive ============ */
@media (max-width: 1200px) {
  .layout-three {
    grid-template-columns: 1fr 280px;
  }
  aside.sidebar-left {
    display: none;
  }
}

@media (max-width: 768px) {
  :root {
    --space-section: 40px;
  }

  body {
    font-size: 15px;
  }

  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 0 16px;
    gap: var(--space-sm);
  }

  .logo {
    font-size: 16px;
    max-width: 150px;
  }

  .nav-main {
    display: none;
  }

  .menu-btn {
    display: block;
    flex: 0 0 auto;
  }

  .search-box {
    flex: 1 1 auto;
    min-width: 0;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
  }

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

  aside.sidebar-right {
    display: none;
  }

  .hero-banner {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
    gap: 1.25rem;
  }

  .hero-thumb {
    order: -1;
  }

  .hero-text h1 {
    font-size: 24px;
  }

  .hero-text p {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .video-title {
    font-size: 13px;
    min-height: 2.9em;
  }

  .video-info {
    padding: 10px 12px 12px;
  }

  .live-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .uploader-avatar img {
    width: 32px;
    height: 32px;
  }

  .video-stats {
    font-size: 12px;
    gap: 8px;
  }

  .footer-cols {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0 16px;
  }

  .footer-bottom {
    padding: 16px;
  }

  .cat-scroll {
    display: flex;
  }

  .section-header {
    margin-bottom: 12px;
  }

  .main-content > section,
  .main-content > .section {
    margin-top: 40px;
  }

  .to-top {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 380px) {
  .video-grid {
    grid-template-columns: 1fr;
  }

  .footer-cols {
    grid-template-columns: 1fr;
  }

  .logo {
    max-width: 120px;
    font-size: 15px;
  }
}

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

  .video-card {
    animation: none;
  }

  .live-badge::before {
    animation: none;
  }
}