:root {
  --bg-deep: #05070c;
  --bg-base: #0a0d12;
  --surface-1: #0f131c;
  --surface-2: #161d2b;
  --surface-3: #1e2636;
  --accent: #38bdf8;
  --accent-dim: #0284c7;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-pill: 999px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

/* 顶部导航 */
.header {
  background: var(--surface-1);
  border-bottom: 1px solid var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header .container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.logo {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-box input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-pill);
  padding: 0.75rem 1.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.search-box button,
.fav-btn {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.search-box button:hover,
.fav-btn:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

/* 分类导航 */
.nav {
  background: var(--surface-1);
  border-bottom: 1px solid var(--surface-2);
  padding: 1rem 0;
}

.nav-list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item {
  background: var(--surface-2);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 0.5rem 1.25rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: var(--surface-3);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent);
  color: var(--bg-deep);
}

/* 主内容区 */
.main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

/* 视频网格 */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.video-card {
  background: var(--surface-1);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

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

.video-thumb {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: var(--surface-2);
  overflow: hidden;
}

.video-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.video-card:hover .video-thumb img {
  transform: scale(1.05);
}

.video-thumb::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  font-size: 3rem;
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-card:hover .video-thumb::after {
  opacity: 1;
}

.video-info {
  padding: 1rem;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.fav-icon {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  z-index: 10;
  transition: all 0.2s;
}

.fav-icon:hover {
  background: var(--accent);
  transform: scale(1.1);
}

.fav-icon.active {
  color: var(--danger);
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.page-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 2.5rem;
}

.page-btn:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--accent);
  color: var(--bg-deep);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--surface-1);
  border-radius: var(--radius);
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--danger);
  transform: rotate(90deg);
}

/* 播放器 */
.player-wrapper {
  padding: 2rem;
}

#videoPlayer {
  width: 100%;
  max-height: 70vh;
  background: black;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.player-info h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.video-meta {
  margin-bottom: 1.5rem;
}

.player-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.quality-select,
.download-btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-3);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.quality-select:hover,
.download-btn:hover {
  border-color: var(--accent);
}

.download-btn {
  background: var(--accent);
  color: var(--bg-deep);
  border: none;
  font-weight: 600;
}

/* 收藏弹窗 */
.fav-content {
  padding: 2rem;
  max-width: 1400px;
}

.fav-content h2 {
  margin-bottom: 2rem;
}

/* 加载提示 */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 1rem;
}

.loading.active {
  display: flex;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 响应式 */
@media (max-width: 768px) {
  .header .container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .search-box {
    order: 2;
  }

  .fav-btn {
    justify-self: end;
  }

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

  .player-wrapper {
    padding: 1rem;
  }

  .modal-content {
    max-height: 95vh;
  }
}