* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #e50914;
  --primary-dark: #b20710;
  --bg-dark: #141414;
  --bg-darker: #000000;
  --bg-card: #1f1f1f;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #808080;
  --border-color: #2f2f2f;
  --hover-bg: #2a2a2a;
  --spacing-unit: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

body.ui-style-4 {
  --primary-color: #e50914;
  --primary-dark: #b20710;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-color);
}

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

header {
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 calc(var(--spacing-unit) * 3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

.main-nav {
  display: flex;
  gap: calc(var(--spacing-unit) * 4);
  align-items: center;
}

.main-nav a {
  font-size: 15px;
  font-weight: 500;
  padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--hover-bg);
  color: var(--text-primary);
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 3);
  min-height: calc(100vh - 68px - 120px);
}

.page-header {
  margin-bottom: calc(var(--spacing-unit) * 5);
}

.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 2);
  line-height: 1.2;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 800px;
}

.section {
  margin-bottom: calc(var(--spacing-unit) * 8);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.section-title {
  font-size: 24px;
  font-weight: 700;
}

.section-more {
  font-size: 14px;
  color: var(--text-secondary);
  padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.section-more:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: calc(var(--spacing-unit) * 3);
}

.video-card {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.video-card__link {
  display: block;
}

.video-cover {
  position: relative;
  width: 100%;
  padding-top: 150%;
  background: var(--bg-darker);
  overflow: hidden;
}

.video-cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-info {
  padding: calc(var(--spacing-unit) * 2);
}

.video-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: calc(var(--spacing-unit) * 1);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  min-height: 42px;
}

.video-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: calc(var(--spacing-unit) * 2);
}

.video-one-line {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: calc(var(--spacing-unit) * 1);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.filter-bar {
  background: var(--bg-card);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: 8px;
  margin-bottom: calc(var(--spacing-unit) * 4);
}

.filter-bar h2 {
  font-size: 18px;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.filter-bar p {
  color: var(--text-secondary);
  font-size: 14px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: calc(var(--spacing-unit) * 2);
  margin-top: calc(var(--spacing-unit) * 6);
}

.pagination button {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  background: var(--hover-bg);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page--grid {
  display: block;
}

.page--with-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: calc(var(--spacing-unit) * 4);
}

.layout__side--filters {
  background: var(--bg-card);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: 8px;
  height: fit-content;
  position: sticky;
  top: 88px;
}

.layout__side--filters h3 {
  font-size: 16px;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.page--top {
  display: block;
}

.top-list__items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 2);
}

.top-list__item {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.top-list__item:hover {
  transform: translateX(4px);
}

.top-list__link {
  display: grid;
  grid-template-columns: 60px 120px 1fr;
  gap: calc(var(--spacing-unit) * 3);
  padding: calc(var(--spacing-unit) * 2);
  align-items: center;
}

.top-rank {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
}

.top-cover {
  width: 120px;
  height: 180px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-darker);
}

.top-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-info {
  flex: 1;
}

.top-info h3 {
  font-size: 18px;
  margin-bottom: calc(var(--spacing-unit) * 1);
}

.top-info p {
  font-size: 14px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.page--grouped {
  display: block;
}

.group {
  margin-bottom: calc(var(--spacing-unit) * 6);
}

.group__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 3);
  padding-bottom: calc(var(--spacing-unit) * 2);
  border-bottom: 2px solid var(--border-color);
}

.group__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: calc(var(--spacing-unit) * 3);
}

.video-player-section {
  margin: 0 0 calc(var(--spacing-unit) * 5) 0;
}

.video-player {
  max-width: 1200px;
  margin: 0 auto;
}

.video-player-inner {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: var(--bg-darker);
  border-radius: 8px;
  overflow: hidden;
}

.player-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.player-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: #ffffff;
}

.player-play-icon {
  font-size: 32px;
  color: var(--bg-darker);
  margin-left: 4px;
}

.video-detail {
  max-width: 1200px;
  margin: 0 auto;
}

.video-detail h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 3);
  line-height: 1.2;
}

.detail-section {
  background: var(--bg-card);
  padding: calc(var(--spacing-unit) * 4);
  border-radius: 8px;
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.detail-section h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: calc(var(--spacing-unit) * 3);
  padding-bottom: calc(var(--spacing-unit) * 2);
  border-bottom: 2px solid var(--border-color);
}

.detail-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.detail-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.detail-section ul {
  list-style: none;
}

.detail-section ul li {
  padding: calc(var(--spacing-unit) * 1) 0;
  color: var(--text-secondary);
  display: flex;
  gap: calc(var(--spacing-unit) * 2);
}

.detail-section ul li strong {
  color: var(--text-primary);
  min-width: 80px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: calc(var(--spacing-unit) * 3);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 1);
}

.info-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 15px;
  color: var(--text-primary);
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing-unit) * 2);
  margin-top: calc(var(--spacing-unit) * 2);
}

.tag {
  background: var(--hover-bg);
  color: var(--text-secondary);
  padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag:hover {
  background: var(--primary-color);
  color: var(--text-primary);
}

.video-card--related {
  background: var(--bg-card);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: calc(var(--spacing-unit) * 3);
}

footer {
  background: var(--bg-darker);
  padding: calc(var(--spacing-unit) * 5) calc(var(--spacing-unit) * 3);
  margin-top: calc(var(--spacing-unit) * 8);
  border-top: 1px solid var(--border-color);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.footer-container p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.back-to-top {
  position: fixed;
  bottom: calc(var(--spacing-unit) * 4);
  right: calc(var(--spacing-unit) * 4);
  width: 48px;
  height: 48px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 999;
  opacity: 0;
}

.back-to-top.visible {
  display: flex;
  opacity: 1;
}

.back-to-top:hover {
  transform: translateY(-4px);
}

@media (max-width: 768px) {
  .header-container {
    height: 56px;
    padding: 0 calc(var(--spacing-unit) * 2);
  }

  .logo {
    font-size: 22px;
  }

  .main-nav {
    gap: calc(var(--spacing-unit) * 1);
    font-size: 13px;
  }

  .main-nav a {
    padding: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit) * 1.5);
    font-size: 13px;
  }

  main {
    padding: calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 2);
  }

  .page-header h1 {
    font-size: 24px;
  }

  .section-title {
    font-size: 20px;
  }

  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: calc(var(--spacing-unit) * 2);
  }

  .video-cover {
    padding-top: 140%;
  }

  .video-info {
    padding: calc(var(--spacing-unit) * 1.5);
  }

  .video-title {
    font-size: 14px;
    min-height: 38px;
  }

  .page--with-sidebar {
    grid-template-columns: 1fr;
  }

  .layout__side--filters {
    position: static;
  }

  .top-list__link {
    grid-template-columns: 40px 80px 1fr;
    gap: calc(var(--spacing-unit) * 2);
  }

  .top-rank {
    font-size: 24px;
  }

  .top-cover {
    width: 80px;
    height: 120px;
  }

  .top-info h3 {
    font-size: 15px;
  }

  .video-detail h1 {
    font-size: 26px;
  }

  .detail-section {
    padding: calc(var(--spacing-unit) * 3);
  }

  .detail-section h2 {
    font-size: 20px;
  }

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

  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: calc(var(--spacing-unit) * 2);
    right: calc(var(--spacing-unit) * 2);
  }
}

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

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