:root {
  --primary-color: #2c5f8d;
  --secondary-color: #d94c3d;
  --accent-color: #f4a261;
  --bg-light: #f8f9fa;
  --text-dark: #212529;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --spacing-unit: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: #fff;
  font-size: 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 calc(var(--spacing-unit) * 2);
}

header {
  background: linear-gradient(135deg, #2c5f8d 0%, #1a3a5c 100%);
  color: white;
  padding: calc(var(--spacing-unit) * 2) 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(var(--spacing-unit) * 2);
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  letter-spacing: 1px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: calc(var(--spacing-unit) * 3);
  flex-wrap: nowrap;
}

nav a {
  color: white;
  text-decoration: none;
  padding: calc(var(--spacing-unit)) calc(var(--spacing-unit) * 2);
  border-radius: 4px;
  transition: background 0.3s, transform 0.2s;
  white-space: nowrap;
}

nav a:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

main {
  min-height: 60vh;
  padding: calc(var(--spacing-unit) * 4) 0;
}

h1 {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: calc(var(--spacing-unit) * 3);
  color: var(--primary-color);
  font-weight: 700;
}

h2 {
  font-size: 24px;
  line-height: 1.3;
  margin: calc(var(--spacing-unit) * 4) 0 calc(var(--spacing-unit) * 2) 0;
  color: var(--primary-color);
  font-weight: 600;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
  margin: calc(var(--spacing-unit) * 3) 0 calc(var(--spacing-unit) * 2) 0;
  color: var(--text-dark);
  font-weight: 600;
}

p {
  margin-bottom: calc(var(--spacing-unit) * 2);
  line-height: 1.8;
}

.intro-section {
  background: var(--bg-light);
  padding: calc(var(--spacing-unit) * 4);
  border-radius: 8px;
  margin-bottom: calc(var(--spacing-unit) * 5);
  border-left: 4px solid var(--primary-color);
}

.intro-section p {
  font-size: 17px;
  color: var(--text-dark);
  margin-bottom: calc(var(--spacing-unit) * 2);
}

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

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

.video-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: calc(var(--spacing-unit) * 3);
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.video-card h3 {
  margin: 0 0 calc(var(--spacing-unit) * 2) 0;
  font-size: 18px;
}

.video-card h3 a {
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 600;
}

.video-card h3 a:hover {
  color: var(--primary-color);
}

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

.video-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.video-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--spacing-unit));
}

.tag {
  display: inline-block;
  background: var(--bg-light);
  color: var(--text-dark);
  padding: calc(var(--spacing-unit) / 2) calc(var(--spacing-unit) * 1.5);
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--border-color);
}

.video-list {
  margin-top: calc(var(--spacing-unit) * 3);
}

.video-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: calc(var(--spacing-unit) * 3);
  margin-bottom: calc(var(--spacing-unit) * 2);
  transition: border-color 0.3s;
}

.video-item:hover {
  border-color: var(--primary-color);
}

.detail-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: calc(var(--spacing-unit) * 3);
  margin-bottom: calc(var(--spacing-unit) * 4);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: calc(var(--spacing-unit) * 2);
  background: var(--bg-light);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: 8px;
  margin: calc(var(--spacing-unit) * 3) 0;
}

.info-item {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: calc(var(--spacing-unit) / 2);
}

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

.content-section {
  background: white;
  padding: calc(var(--spacing-unit) * 4);
  border-radius: 8px;
  margin-bottom: calc(var(--spacing-unit) * 4);
  border: 1px solid var(--border-color);
}

.related-section {
  margin-top: calc(var(--spacing-unit) * 6);
  padding-top: calc(var(--spacing-unit) * 4);
  border-top: 2px solid var(--border-color);
}

footer {
  background: #2c3e50;
  color: white;
  text-align: center;
  padding: calc(var(--spacing-unit) * 4) 0;
  margin-top: calc(var(--spacing-unit) * 8);
}

footer p {
  margin: calc(var(--spacing-unit)) 0;
  opacity: 0.9;
}

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

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

.back-to-top.show {
  display: flex;
}

.ranked-list .video-item {
  display: flex;
  gap: calc(var(--spacing-unit) * 2);
  align-items: flex-start;
}

.rank-number {
  font-size: 32px;
  font-weight: bold;
  color: var(--primary-color);
  min-width: 60px;
  text-align: center;
}

.rank-number.top3 {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.rank-content {
  flex: 1;
}

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

.topic-header {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
  border-radius: 8px 8px 0 0;
  font-size: 20px;
  font-weight: 600;
}

.topic-items {
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.topic-items .video-item {
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border-color);
  margin: 0;
}

.topic-items .video-item:last-child {
  border-bottom: none;
}

.latest-date {
  display: inline-block;
  background: var(--secondary-color);
  color: white;
  padding: calc(var(--spacing-unit) / 2) calc(var(--spacing-unit) * 1.5);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: calc(var(--spacing-unit));
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }

  nav ul {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    width: 100%;
  }

  nav li {
    flex: 1 1 0;
    min-width: 0;
  }

  nav a {
    display: block;
    text-align: center;
    padding: calc(var(--spacing-unit)) calc(var(--spacing-unit) / 2);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

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

  .intro-section {
    padding: calc(var(--spacing-unit) * 2);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .ranked-list .video-item {
    flex-direction: column;
  }

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

body.ui-style-5 {
  --primary-color: #1e3a5f;
  --secondary-color: #c73e3a;
  --accent-color: #e89a3c;
}

body.ui-style-5 header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5f8d 100%);
}

body.ui-style-5 .video-card:hover {
  box-shadow: 0 12px 32px rgba(30, 58, 95, 0.15);
}
