:root {
  --clr-bg: #ffffff;
  --clr-surface: #fafafa;
  --clr-border: #e0e0e0;
  --clr-text: #212121;
  --clr-muted: #757575;
  --clr-primary: #a16207;
  --clr-accent: #eab308;
  --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;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 15px;
  line-height: 1.7;
  color: var(--clr-text);
  background: var(--clr-bg);
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

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

@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);
  }
}

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

header.is-scrolled {
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  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);
}

.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: inherit;
}

.search-count {
  font-size: 13px;
  color: var(--clr-muted);
}

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

/* ============ 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;
}

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

.sidebar-card h3 {
  font-size: 15px;
  font-weight: 700;
  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;
}

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

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

.hero-text h1 {
  font-size: clamp(26px, 3.4vw, 32px);
  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: var(--clr-bg);
  color: var(--clr-primary);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

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

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

/* ============ Section ============ */
section {
  margin-bottom: calc(var(--gap) * 2);
}

section:last-child {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
  line-height: 1.4;
}

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

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

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

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

.section-more: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: var(--clr-bg);
  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: 0 4px 16px rgba(0, 0, 0, 0.07);
}

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

.video-thumb img {
  width: 100%;
  height: auto;
  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: var(--clr-bg);
  font-size: 12px;
  line-height: 1;
}

.duration-badge svg {
  width: 12px;
  height: 12px;
}

.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: 15px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 10px;
}

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

.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;
}

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

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

.video-stats svg {
  width: 12px;
  height: 12px;
}

/* ============ Live ============ */
.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: var(--clr-bg);
  transition: transform 0.2s, box-shadow 0.2s;
}

.live-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

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

.live-thumb img {
  width: 100%;
  height: auto;
  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: var(--clr-bg);
  font-size: 11.5px;
  line-height: 1.5;
}

.live-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--clr-bg);
  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: var(--clr-bg);
  font-size: 12px;
  line-height: 1.3;
}

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

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

.live-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--clr-muted);
}

/* ============ News ============ */
.news-list {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}

.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-body {
  display: block;
}

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

.news-time {
  font-size: 12px;
  color: var(--clr-muted);
  display: block;
}

.news-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.5;
}

.news-excerpt {
  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;
  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 14px;
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.tag {
  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: 13px;
  color: var(--clr-text);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}

.tag:hover {
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}

/* ============ Right sidebar / rank ============ */
.sidebar-title {
  font-size: 15px;
  font-weight: 700;
  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: inherit;
  font-size: 13px;
  padding: 6px 10px;
  color: var(--clr-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s;
}

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

.rank-list {
  display: block;
  list-style: none;
  margin: 0;
  padding: 0;
}

.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: 12px;
  font-weight: 700;
  background: var(--clr-surface);
  color: var(--clr-muted);
}

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

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

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

.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;
}

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

.rank-score {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--clr-muted);
  white-space: nowrap;
  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: 13px;
  color: var(--clr-text);
  text-decoration: none;
  white-space: nowrap;
}

.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-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}

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

.footer-list a {
  font-size: 13px;
  color: var(--clr-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

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

.footer-bottom p {
  font-size: 13px;
  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);
}

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

.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);
}

/* ============ To top ============ */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: var(--clr-bg);
  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;
}

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

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  .layout-three {
    grid-template-columns: 1fr;
  }
  aside.sidebar-right {
    display: none;
  }
  .hero-banner {
    grid-template-columns: 1fr;
    padding: 2rem 1.25rem;
  }
  .hero-thumb {
    order: -1;
  }
  .hero-text h1 {
    font-size: 24px;
  }
  .nav-main {
    display: none;
  }
  .menu-btn {
    display: block;
  }
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .video-title {
    font-size: 13px;
  }
  .footer-cols {
    grid-template-columns: 1fr 1fr;
    padding: 0 16px;
  }
  .cat-scroll {
    display: flex;
  }
  .search-box {
    display: none;
  }
  section {
    margin-bottom: calc(var(--gap) * 1.6);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .video-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}