:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --border: #e5e5e5;
  --accent: #333333;
  --accent-hover: #555555;
  --logo-text: #1a1a1a;
  --logo-brand: #666666;
  --shadow: rgba(0, 0, 0, 0.08);
  --video-bg: #000000;
  --hover-color: #000000;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-secondary: #252525;
  --text: #e5e5e5;
  --text-secondary: #999999;
  --border: #333333;
  --accent: #e5e5e5;
  --accent-hover: #ffffff;
  --logo-text: #e5e5e5;
  --logo-brand: #666666;
  --shadow: rgba(0, 0, 0, 0.3);
  --hover-color: #ffffff;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 10px var(--shadow);
}

.logo-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--bg);
  margin-left: 2px;
}

.logo-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 2px;
}

.logo-brand {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* 现代感修饰 */
.logo-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  pointer-events: none;
}

[data-theme="dark"] .logo-icon {
  background: #ffffff;
}

[data-theme="dark"] .logo-icon svg {
  fill: #1a1a1a;
}

[data-theme="dark"] .logo-text {
  color: #ffffff;
}

[data-theme="dark"] .logo-brand {
  color: #999999;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover {
  background: var(--border);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--text);
}

.theme-toggle .sun-icon { 
  display: none; 
}
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 6px;
  width: 100%;
}

.ad-container {
  margin-bottom: 24px;
}

.ad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.ad-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 16 / 4;
  transition: transform 0.2s ease;
}

.ad-item:hover {
  transform: translateY(-2px);
}

.ad-item a {
  display: block;
  width: 100%;
  height: 100%;
}

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

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

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

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

.video-card-title {
  padding: 12px;
  display: block;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-card-title:hover {
  color: var(--hover-color);
}

.video-card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--video-bg);
  cursor: pointer;
  overflow: hidden;
}

.video-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.video-card-cover.lazy {
  opacity: 0;
}

.video-card-cover.loaded {
  opacity: 1;
}

.video-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.video-card-play svg {
  width: 24px;
  height: 24px;  
  margin-left: 4px;
}

.video-card:hover .video-card-play {
  transform: translate(-50%, -50%) scale(1.1);
}

.video-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--video-bg);
}

.video-card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 30px 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.pagination a:hover {
  background: var(--border);
}

.pagination .active {
  background: var(--text);
  color: var(--bg);
}

.pagination .disabled {
  opacity: 0.5;
  pointer-events: none;
}

.video-detail {
  margin: 10px auto;
}

.video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.video-detail-title {
  flex: 1;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.video-header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--bg-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
  font-weight: 500;
}

.header-nav-btn:hover {
  color: var(--text);
  background: var(--border);
  transform: translateY(-1px);
}

.header-nav-btn svg {
  fill: currentColor;
}

.header-nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

@media (max-width: 768px) {
  .video-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .video-detail-title {
    width: 100%;
    font-size: 20px;
  }
  
  .video-header-nav {
    width: 100%;
    justify-content: space-between;
  }
  
  .header-nav-btn {
    flex: 1;
    justify-content: center;
  }
}

.video-player-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--video-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px var(--shadow);
}

.video-player-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.video-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 16px;
}

.video-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.video-nav a:hover {
  background: var(--border);
}

.video-nav a.disabled {
  opacity: 0.5;
  pointer-events: none;
}

footer {
  border-top: 1px solid var(--bg-secondary);
  padding: 24px 16px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

@media (max-width: 768px) {
  .header-inner {
    height: 52px;
  }

  .logo {
    font-size: 18px;
  }

  main {
    padding: 16px 0px;
  }

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

  .video-card-title {
    padding: 10px;
    font-size: 14px;
  }

  .video-card-play {
    width: 48px;
    height: 48px;
  }

  .video-card-play svg {
    width: 20px;
    height: 20px;
  }

  .video-detail-title {
    font-size: 20px;
  }

  .video-nav {
    flex-direction: column;
  }

  .video-nav a {
    justify-content: center;
  }

  .pagination a,
  .pagination span {
    min-width: 36px;
    height: 36px;
    font-size: 14px;
  }
}

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

  .pagination {
    gap: 4px;
  }

  .pagination a,
  .pagination span {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: 13px;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  border-top-color: var(--logo-brand);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--bg);
  padding: 40px;
  border-radius: 10px;
  max-width: 500px;
  width: 100%;  
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
  margin-bottom: 20px;
  color: var(--text);
  text-align: center;
  font-size: 24px;
}

.modal-content p {
  margin-bottom: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.btn-primary,.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: none;
  padding: 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover,.btn-secondary:hover { background: var(--border); }
