/* ===== 畅影UI 暗黑主题 ===== */
:root {
  --bg-primary: #0f0f14;
  --bg-secondary: #16161e;
  --bg-tertiary: #1d1d28;
  --bg-elevated: #24242f;
  --bg-hover: #2c2c3a;
  --border: #2a2a38;
  --border-light: #363648;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-tertiary: #6a6a7a;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --accent-soft: rgba(229, 9, 20, 0.15);
  --gold: #ffb733;
  --green: #46d369;
  --blue: #2d9cf6;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.65);
  --transition: 0.2s ease;
}
:root[data-theme="light"] {
  --bg-primary: #f5f5f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #ececF2;
  --bg-elevated: #ffffff;
  --bg-hover: #e0e0e8;
  --border: #e0e0e8;
  --border-light: #d0d0db;
  --text-primary: #1a1a25;
  --text-secondary: #555560;
  --text-tertiary: #9999a5;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --accent-soft: rgba(229, 9, 20, 0.1);
  --gold: #f59e0b;
  --green: #16a34a;
  --blue: #2563eb;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
input, button { font-family: inherit; font-size: inherit; border: none; outline: none; background: none; color: inherit; }

/* ===== 布局 ===== */
.app-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
}
.logo-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff4d2e 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
}
.logo-text { font-size: 18px; font-weight: 700; }
.nav { flex: 1; padding: 8px 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
  color: var(--text-secondary);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-label { font-size: 14px; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

/* 主区域 */
.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.container { padding: 24px 32px; }

/* ===== 轮播图 ===== */
.banner {
  position: relative;
  height: 380px;
  overflow: hidden;
  border-radius: 0;
  margin-bottom: 8px;
}
.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.8s ease;
}
.banner-slide {
  min-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}
.banner-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.1);
  filter: blur(24px) brightness(0.5);
}
.banner-fg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  z-index: 1;
}
.banner-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to right, var(--bg-primary) 0%, rgba(15,15,20,0.5) 50%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 60px;
}
.banner-content { max-width: 500px; }
.banner-tags { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.banner-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.banner-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.banner-desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.banner-play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.banner-play:hover { background: var(--accent-hover); transform: translateY(-2px); }
.banner-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}
.banner-dots span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: var(--transition);
}
.banner-dots span.active { background: var(--accent); width: 24px; border-radius: 4px; }

/* ===== 板块 ===== */
.block { margin-bottom: 32px; }
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 18px;
  font-weight: 600;
  position: relative;
  padding-left: 12px;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 20px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.tag-red { background: var(--accent-soft); color: var(--accent); }
.tag-gold { background: rgba(255,183,51,0.15); color: var(--gold); }
.tag-green { background: rgba(70,211,105,0.15); color: var(--green); }

/* ===== 横向卡片网格 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 影视卡片(横向) */
.vod-card {
  position: relative;
  display: flex;
  flex-direction: row;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
}
.vod-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.vod-card .poster {
  position: relative;
  width: 40%;
  flex-shrink: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-tertiary);
}
.vod-card .poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transition: var(--transition);
  opacity: 0;
}
.vod-card .poster img.loaded { opacity: 1; }
.vod-card:hover .poster img { transform: scale(1.06); }
.vod-card .poster-mask {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent 50%);
  opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.vod-card:hover .poster-mask { opacity: 1; }
.play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(229,9,20,0.9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; padding-left: 3px;
}
.remarks {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff; font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  max-width: calc(100% - 12px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vod-card .info {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.vod-card .title {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: var(--transition);
}
.vod-card:hover .title { color: var(--accent); }
.vod-card .meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 12px; color: var(--text-tertiary);
}
.meta-item:not(:last-child)::after { content: '·'; margin-left: 6px; }
.vod-card .desc {
  font-size: 12px; line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.vod-card .actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 2px;
}
.play-text { font-size: 12px; color: var(--accent); font-weight: 500; }
.score {
  background: rgba(255,183,51,0.15);
  color: var(--gold);
  font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}

/* ===== 筛选器 ===== */
.filter { margin-bottom: 16px; }
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.filter-label {
  font-size: 13px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  width: 50px;
  line-height: 28px;
}
.filter-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tag {
  padding: 4px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.filter-tag:hover { color: var(--text-primary); background: var(--bg-hover); }
.filter-tag.active { background: var(--accent); color: #fff; }
.filter-summary {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 12px 0;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 32px 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 详情页 ===== */
.detail-header {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}
.detail-poster {
  width: 200px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-tertiary);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { flex: 1; min-width: 0; }
.detail-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.detail-sub { font-size: 14px; color: var(--text-tertiary); margin-bottom: 16px; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 16px;
}
.detail-meta-item { font-size: 13px; color: var(--text-secondary); }
.detail-meta-item strong { color: var(--text-tertiary); font-weight: normal; margin-right: 6px; }
.detail-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.detail-actions { display: flex; gap: 12px; }

/* 播放源列表 */
.play-source { margin-bottom: 24px; }
.source-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.source-tab {
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.source-tab:hover { color: var(--text-primary); }
.source-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.episode-item {
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.episode-item:hover { border-color: var(--accent); color: var(--accent); }
.episode-item.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== 播放页 ===== */
.player-page { display: flex; gap: 24px; }
.player-main { flex: 1; min-width: 0; }
.player-wrapper {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
}
.player-wrapper iframe, .player-wrapper video { width: 100%; height: 100%; border: none; }
.player-sidebar { width: 320px; flex-shrink: 0; }
.player-title { font-size: 20px; font-weight: 600; margin-bottom: 12px; }

/* ===== 搜索框 ===== */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.search-input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-tertiary); }
.search-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.search-btn:hover { background: var(--accent-hover); }

/* ===== 空状态/加载 ===== */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}
.loading { text-align: center; padding: 40px; color: var(--text-tertiary); }

/* ===== 顶部栏(移动端) ===== */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo { font-size: 16px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.topbar-search { flex: 1; min-width: 0; }
.topbar-search .search-input { padding: 7px 12px; font-size: 13px; }
.topbar-search .search-btn { padding: 7px 14px; font-size: 13px; }
.topbar-menu-btn { font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; }

/* 移动端遮罩层 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* ===== 移动端响应式 ===== */
@media (max-width: 768px) {
  /* 侧边栏改为抽屉 */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    width: 240px;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .main { width: 100%; }
  .container { padding: 12px; }

  /* 轮播图 */
  .banner { height: 200px; margin-bottom: 12px; }
  .banner-overlay { padding: 0 16px; background: linear-gradient(to right, var(--bg-primary) 0%, rgba(15,15,20,0.6) 60%, transparent 100%); }
  .banner-content { max-width: 75%; }
  .banner-title { font-size: 16px; margin-bottom: 4px; }
  .banner-meta { font-size: 11px; margin-bottom: 8px; gap: 4px; }
  .banner-desc { font-size: 12px; -webkit-line-clamp: 2; margin-bottom: 12px; }
  .banner-play { padding: 6px 16px; font-size: 12px; }
  .banner-tags { gap: 4px; margin-bottom: 8px; }
  .banner-tags .tag { font-size: 10px; padding: 1px 6px; }
  .banner-dots { bottom: 8px; }
  .banner-dots span { width: 6px; height: 6px; }
  .banner-dots span.active { width: 16px; }

  /* 网格:手机端2列 */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  /* 卡片改为纵向 */
  .vod-card { flex-direction: column; }
  .vod-card:hover { transform: none; }
  .vod-card .poster { width: 100%; aspect-ratio: 16 / 9; }
  .vod-card .info { padding: 8px 10px; gap: 4px; }
  .vod-card .title { font-size: 13px; }
  .vod-card .meta { font-size: 11px; gap: 4px; }
  .vod-card .desc { display: none; }
  .vod-card .actions { margin-top: 2px; }
  .play-text { font-size: 11px; }
  .score { font-size: 10px; padding: 1px 4px; }
  .remarks { font-size: 10px; padding: 1px 4px; top: 4px; right: 4px; }

  /* 板块间距 */
  .block { margin-bottom: 20px; }
  .block-head { margin-bottom: 10px; }
  .section-title { font-size: 15px; }
  .btn { padding: 4px 10px; font-size: 12px; }

  /* 筛选器 */
  .filter-row { flex-direction: column; gap: 4px; padding: 6px 0; }
  .filter-label { width: auto; line-height: 1.5; }
  .filter-tags { gap: 4px; }
  .filter-tag { padding: 3px 8px; font-size: 12px; }
  .filter-summary { font-size: 12px; margin: 8px 0; }

  /* 详情页 */
  .detail-header { flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .detail-poster { width: 120px; aspect-ratio: 2 / 3; }
  .detail-title { font-size: 20px; margin-bottom: 4px; }
  .detail-sub { font-size: 13px; margin-bottom: 10px; }
  .detail-meta { gap: 6px 16px; margin-bottom: 12px; }
  .detail-meta-item { font-size: 12px; }
  .detail-content { font-size: 13px; line-height: 1.7; }
  .detail-actions { gap: 8px; }

  /* 播放页 */
  .player-page { flex-direction: column; gap: 12px; }
  .player-sidebar { width: 100%; }
  .player-title { font-size: 16px; margin-bottom: 8px; }

  /* 播放源 */
  .source-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .source-tab { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
  .episode-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
  .episode-item { padding: 6px 8px; font-size: 12px; }

  /* 搜索框 */
  .search-box { gap: 6px; margin-bottom: 16px; }
  .search-input { padding: 8px 12px; font-size: 13px; }
  .search-btn { padding: 8px 16px; font-size: 13px; }

  /* 分页 */
  .pagination { gap: 4px; margin: 20px 0; flex-wrap: wrap; }
  .pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 8px; font-size: 13px; }

  /* 返回按钮 */
  .back-btn { padding: 4px 10px; font-size: 12px; margin-bottom: 10px; }

  /* 主题切换 */
  .theme-toggle { bottom: 16px; right: 16px; width: 36px; height: 36px; font-size: 16px; }

  /* 空状态 */
  .empty { padding: 40px 16px; font-size: 13px; }
}

/* 超小屏幕(<=400px) */
@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
  .banner { height: 160px; }
  .banner-content { max-width: 85%; }
  .banner-title { font-size: 14px; }
  .banner-desc { display: none; }
  .topbar-logo { font-size: 14px; }
  .detail-poster { width: 100px; }
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar-search .search-btn { padding: 7px 10px; }
}

/* ===== 返回按钮 ===== */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateX(-2px); }

/* ===== 主题切换按钮 ===== */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  z-index: 999;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); }
