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

:root {
  --spacing-unit: 8px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --line-height-body: 1.6;
  --line-height-heading: 1.2;
  --border-radius: 8px;
}

body {
  font-family: var(--font-body);
  line-height: var(--line-height-body);
  color: #333;
  background: #f5f5f5;
}

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

.site-header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

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

.site-logo {
  font-size: 24px;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.main-nav {
  display: flex;
  gap: calc(var(--spacing-unit) * 3);
}

.main-nav a {
  color: #666;
  text-decoration: none;
  padding: calc(var(--spacing-unit)) calc(var(--spacing-unit) * 2);
  border-radius: 4px;
  transition: all 0.3s;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a.active {
  color: #333;
  background: #f0f0f0;
}

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

.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: calc(var(--spacing-unit) * 6) 0;
  margin-bottom: calc(var(--spacing-unit) * 4);
  border-radius: var(--border-radius);
}

.hero-title {
  font-size: 32px;
  margin-bottom: calc(var(--spacing-unit) * 2);
  line-height: var(--line-height-heading);
}

.hero-desc {
  font-size: 16px;
  line-height: 1.8;
  max-width: 800px;
}

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

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

.section-title {
  font-size: 24px;
  color: #333;
  padding-bottom: calc(var(--spacing-unit));
  border-bottom: 3px solid #667eea;
  display: inline-block;
}

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

.video-card {
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.video-card__link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.video-cover {
  position: relative;
  padding-top: 56.25%;
  background: #e0e0e0;
  overflow: hidden;
}

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

.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.play-icon {
  font-size: 48px;
  color: white;
}

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

.video-title {
  font-size: 16px;
  margin-bottom: calc(var(--spacing-unit));
  line-height: var(--line-height-heading);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.video-meta {
  font-size: 13px;
  color: #999;
  margin-bottom: calc(var(--spacing-unit));
}

.video-one-line {
  font-size: 14px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 3);
}

.sidebar-widget {
  background: white;
  padding: calc(var(--spacing-unit) * 3);
  border-radius: var(--border-radius);
}

.widget-title {
  font-size: 18px;
  margin-bottom: calc(var(--spacing-unit) * 2);
  color: #333;
}

.simple-list {
  list-style: none;
}

.simple-list li {
  margin-bottom: calc(var(--spacing-unit));
  line-height: 1.6;
}

.simple-list a {
  color: #666;
  text-decoration: none;
  transition: color 0.3s;
}

.simple-list a:hover {
  color: #667eea;
}

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

.tag {
  display: inline-block;
  padding: calc(var(--spacing-unit) / 2) calc(var(--spacing-unit) * 2);
  background: #f0f0f0;
  border-radius: 16px;
  font-size: 14px;
  color: #666;
}

.page-header {
  margin-bottom: calc(var(--spacing-unit) * 4);
  text-align: center;
}

.page-header h1 {
  font-size: 28px;
  margin-bottom: calc(var(--spacing-unit) * 2);
  color: #333;
}

.page-desc {
  color: #666;
  max-width: 800px;
  margin: 0 auto;
}

.top-list {
  list-style: none;
}

.top-list__item {
  display: flex;
  align-items: center;
  gap: calc(var(--spacing-unit) * 3);
  background: white;
  padding: calc(var(--spacing-unit) * 3);
  margin-bottom: calc(var(--spacing-unit) * 2);
  border-radius: var(--border-radius);
  transition: transform 0.3s;
}

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

.rank-badge {
  font-size: 32px;
  font-weight: bold;
  color: #667eea;
  min-width: 60px;
  text-align: center;
}

.top-cover {
  width: 120px;
  height: 160px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #e0e0e0;
}

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

.top-info {
  flex: 1;
}

.top-title {
  font-size: 20px;
  margin-bottom: calc(var(--spacing-unit));
}

.top-title a {
  color: #333;
  text-decoration: none;
}

.top-title a:hover {
  color: #667eea;
}

.top-meta {
  color: #999;
  font-size: 14px;
  margin-bottom: calc(var(--spacing-unit));
}

.top-desc {
  color: #666;
  line-height: 1.6;
}

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

.sidebar-filters {
  background: white;
  padding: calc(var(--spacing-unit) * 3);
  border-radius: var(--border-radius);
  height: fit-content;
  position: sticky;
  top: 80px;
}

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

.filter-group h4 {
  margin-bottom: calc(var(--spacing-unit) * 2);
  color: #333;
}

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

.filter-tag {
  padding: calc(var(--spacing-unit)) calc(var(--spacing-unit) * 2);
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-tag.active {
  background: #667eea;
  color: white;
}

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

.group-title {
  font-size: 22px;
  margin-bottom: calc(var(--spacing-unit) * 3);
  color: #333;
  padding-bottom: calc(var(--spacing-unit));
  border-bottom: 2px solid #e0e0e0;
}

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

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

.video-player {
  background: #000;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.video-player-inner {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.player-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 4px solid white;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.detail-title {
  font-size: 32px;
  color: #333;
  line-height: var(--line-height-heading);
}

.detail-module {
  background: white;
  padding: calc(var(--spacing-unit) * 4);
  border-radius: var(--border-radius);
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.module-title {
  font-size: 20px;
  color: #333;
  margin-bottom: calc(var(--spacing-unit) * 2);
  padding-bottom: calc(var(--spacing-unit));
  border-bottom: 2px solid #e0e0e0;
}

.info-list {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: calc(var(--spacing-unit) * 2);
}

.info-list dt {
  font-weight: bold;
  color: #666;
}

.info-list dd {
  color: #333;
}

.oneline-text,
.summary-text,
.review-text {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
}

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

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

.site-footer {
  background: #333;
  color: #999;
  padding: calc(var(--spacing-unit) * 4) 0;
  text-align: center;
  margin-top: calc(var(--spacing-unit) * 6);
}

.back-to-top {
  position: fixed;
  bottom: calc(var(--spacing-unit) * 4);
  right: calc(var(--spacing-unit) * 4);
  width: 48px;
  height: 48px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

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

body.ui-style-4 {
  --primary-color: #8b5cf6;
  --secondary-color: #a78bfa;
}

body.ui-style-4 .hero-section {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

body.ui-style-4 .section-title {
  border-bottom-color: #8b5cf6;
}

body.ui-style-4 .rank-badge,
body.ui-style-4 .simple-list a:hover,
body.ui-style-4 .top-title a:hover {
  color: #8b5cf6;
}

body.ui-style-4 .filter-tag.active,
body.ui-style-4 .back-to-top {
  background: #8b5cf6;
}

body.ui-style-4 .back-to-top:hover {
  background: #a78bfa;
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
  }

  .main-nav {
    width: 100%;
    justify-content: space-between;
    gap: calc(var(--spacing-unit));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

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

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

  .sidebar-column,
  .sidebar-filters {
    order: 2;
  }

  .video-grid,
  .group-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .hero-title {
    font-size: 24px;
  }

  .hero-desc {
    font-size: 14px;
  }

  .top-list__item {
    flex-wrap: wrap;
  }

  .rank-badge {
    order: 1;
    min-width: 40px;
    font-size: 24px;
  }

  .top-cover {
    order: 2;
    width: 100px;
    height: 133px;
  }

  .top-info {
    order: 3;
    width: 100%;
  }

  .detail-title {
    font-size: 24px;
  }

  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

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