* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #0f1014;
  color: #e8e8e8;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }

/* ==================== 顶部 ==================== */
header {
  background: #1a1c24;
  border-bottom: 1px solid #2a2d38;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
nav {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
.nav-item {
  padding: 6px 14px;
  border-radius: 6px;
  color: #b8bcc4;
  font-size: 14px;
  transition: all .2s;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-item:hover { background: #2a2d38; color: #4ea1ff; }
.nav-item.active { background: #4ea1ff; color: #fff; }

.search-box {
  display: flex;
  background: #0f1014;
  border: 1px solid #2a2d38;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.search-box:focus-within { border-color: #4ea1ff; }
.search-box input {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #e8e8e8;
  width: 160px;
  font-size: 13px;
  outline: none;
}
.search-box button {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 13px;
}
.search-box button:hover { color: #4ea1ff; }

/* ==================== 主区域 ==================== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px;
}

/* ==================== 筛选栏 ==================== */
.filters {
  background: #1a1c24;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid #2a2d38;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #22252e;
}
.filter-row:last-child { border-bottom: none; padding-bottom: 0; }
.filter-row:first-child { padding-top: 0; }
.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.filter-tag {
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: #b8bcc4;
  transition: all .2s;
  white-space: nowrap;
}
.filter-tag:hover { background: #2a2d38; color: #4ea1ff; }
.filter-tag.active { background: #4ea1ff; color: #fff; }

/* ==================== 区块标题 ==================== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #e8e8e8;
  position: relative;
  padding-left: 10px;
}
.section-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: #4ea1ff;
  border-radius: 2px;
}
.result-count { color: #666; font-size: 12px; }

/* ==================== 影片网格 ==================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.card {
  background: #1a1c24;
  border-radius: 8px;
  cursor: pointer;
  transition: .2s;
  display: flex;
  flex-direction: column;
  height: 320px !important;
  min-height: 320px !important;
  max-height: 320px !important;
  overflow: hidden !important;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
}

/* ==================== 封面 ==================== */
.cover {
  width: 100%;
  height: 220px !important;
  min-height: 220px !important;
  max-height: 220px !important;
  background: #2a2d38;
  position: relative;
  overflow: hidden !important;
  flex-shrink: 0;
}
.cover img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==================== 卡片文字 ==================== */
.card-body {
  padding: 8px 10px 10px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.card .title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.card .meta {
  font-size: 11px;
  color: #666;
  display: flex;
  gap: 4px;
}
.card .meta .dot { color: #444; }

/* ==================== 空状态 ==================== */
.empty { text-align: center; padding: 60px 20px; color: #666; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty p { font-size: 14px; }

/* ==================== 页脚 ==================== */
footer {
  text-align: center;
  padding: 24px 16px;
  color: #444;
  font-size: 12px;
  border-top: 1px solid #1a1c24;
  margin-top: 32px;
}

/* ==================== 手机端 ==================== */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .card {
    height: 220px !important;
    min-height: 220px !important;
    max-height: 220px !important;
  }
  .cover {
    height: 140px !important;
    min-height: 140px !important;
    max-height: 140px !important;
  }
  .card-body { padding: 5px 6px 6px; }
  .card .title { font-size: 11px; margin-bottom: 2px; }
  .card .meta { font-size: 9px; gap: 2px; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .card {
    height: 200px !important;
    min-height: 200px !important;
    max-height: 200px !important;
  }
  .cover {
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
  }
  .card .title { font-size: 10px; }
  .card .meta { font-size: 9px; }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f1014; }
::-webkit-scrollbar-thumb { background: #2a2d38; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3d48; }

/* ==================== 分页 ==================== */
.pager {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0 8px;
}
.pager a {
  min-width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  padding: 0 10px;
  background: #1a1c24;
  border: 1px solid #2a2d38;
  border-radius: 6px;
  color: #b8bcc4;
  font-size: 13px;
  transition: all .2s;
}
.pager a:hover { border-color: #4ea1ff; color: #4ea1ff; }
.pager a.active { background: #4ea1ff; color: #fff; border-color: #4ea1ff; }
.pager a.disabled { opacity: .4; pointer-events: none; }

/* ==================== 详情页 ==================== */
.detail-box {
  display: flex;
  gap: 24px;
  background: #1a1c24;
  border: 1px solid #2a2d38;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.detail-cover {
  width: 220px;
  height: 320px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #2a2d38 center/cover no-repeat;
}
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}
.detail-info p {
  color: #b8bcc4;
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 4px;
}
.score-big {
  color: #ffb400;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.detail-info .desc {
  color: #888;
  font-size: 13px;
  line-height: 1.8;
  margin-top: 10px;
  max-height: 120px;
  overflow: hidden;
}

/* ==================== 剧集列表 ==================== */
.episodes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.ep-btn {
  padding: 8px 16px;
  background: #1a1c24;
  border: 1px solid #2a2d38;
  border-radius: 6px;
  color: #b8bcc4;
  font-size: 13px;
  transition: all .2s;
}
.ep-btn:hover { border-color: #4ea1ff; color: #4ea1ff; }
.ep-btn.active { background: #4ea1ff; color: #fff; border-color: #4ea1ff; }

/* ==================== 播放页 ==================== */
.player-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  aspect-ratio: 16 / 9;
}
.player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}
.player-wrap .status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0,0,0,.6);
  padding: 8px 18px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.player-wrap .status.show { opacity: 1; }
.player-wrap .error-tip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(255,77,79,.9);
  padding: 8px 16px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}
.player-wrap .error-tip.show { opacity: 1; }

@media (max-width: 768px) {
  .detail-box { flex-direction: column; gap: 16px; padding: 14px; }
  .detail-cover { width: 140px; height: 200px; margin: 0 auto; }
  .detail-info h1 { font-size: 18px; }
  .detail-info p { font-size: 13px; }
  .ep-btn { padding: 6px 12px; font-size: 12px; }
  .pager a { min-width: 32px; height: 32px; line-height: 32px; font-size: 12px; }
}