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

/* ==================== 顶部 ==================== */
header {
  background: #ffffff;
  border-bottom: 1px solid #eee;
  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: #666;
  font-size: 14px;
  transition: all .2s;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-item:hover { background: #f5f5f5; color: #FF5C00; }
.nav-item.active { background: #FF5C00; color: #fff; }

.search-box {
  display: flex;
  background: #f5f5f5;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.search-box:focus-within { border-color: #FF5C00; }
.search-box input {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #1a1a1a;
  width: 160px;
  font-size: 13px;
  outline: none;
}
.search-box button {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 13px;
}
.search-box button:hover { color: #FF5C00; }

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

/* ==================== 筛选栏 ==================== */
.filters {
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid #f0f0f0;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
}
.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: #666;
  transition: all .2s;
  white-space: nowrap;
}
.filter-tag:hover { background: #f5f5f5; color: #FF5C00; }
.filter-tag.active { background: #FF5C00; 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: #1a1a1a;
  position: relative;
  padding-left: 10px;
}
.section-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: #FF5C00;
  border-radius: 2px;
}
.result-count { color: #999; font-size: 12px; }

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

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

/* ==================== 封面 ==================== */
.cover {
  width: 100%;
  height: 220px !important;
  min-height: 220px !important;
  max-height: 220px !important;
  background: #f0f0f0;
  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;
  color: #1a1a1a;
}
.card .meta {
  font-size: 11px;
  color: #999;
  display: flex;
  gap: 4px;
  margin-bottom: 2px;
}
.card .meta .dot { color: #ccc; }

.card .actors {
  font-size: 11px;
  color: #999;
  line-height: 1.35;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

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

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

/* ==================== 分页 ==================== */
.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: #ffffff;
  border: 1px solid #eee;
  border-radius: 6px;
  color: #666;
  font-size: 13px;
  transition: all .2s;
}
.pager a:hover { border-color: #FF5C00; color: #FF5C00; }
.pager a.active { background: #FF5C00; color: #fff; border-color: #FF5C00; }
.pager a.disabled { opacity: .4; pointer-events: none; }

/* ==================== 详情页 ==================== */
.detail-box {
  display: flex;
  gap: 24px;
  background: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.detail-cover {
  width: 220px;
  height: 320px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #f0f0f0 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;
  color: #1a1a1a;
}
.detail-info p {
  color: #666;
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 4px;
}
.score-big {
  color: #FF5C00;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.detail-info .desc {
  color: #999;
  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: #ffffff;
  border: 1px solid #eee;
  border-radius: 6px;
  color: #666;
  font-size: 13px;
  transition: all .2s;
}
.ep-btn:hover { border-color: #FF5C00; color: #FF5C00; }
.ep-btn.active { background: #FF5C00; color: #fff; border-color: #FF5C00; }

/* ==================== 播放页 ==================== */
.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) {
  .header-inner {
    gap: 6px;
    padding: 8px 10px;
  }
  .logo a { font-size: 13px; }

  .search-box { flex-shrink: 0; }
  .search-box input { width: 100px; font-size: 12px; padding: 5px 8px; }
  .search-box button { padding: 5px 8px; }

  nav {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-item { padding: 5px 8px; font-size: 12px; }

  .filters { padding: 8px 10px; margin-bottom: 12px; }
  .filter-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding: 4px 0;
  }
  .filter-tags { flex-wrap: nowrap; flex-shrink: 0; }
  .filter-tag {
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 12px;
  }

  .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; }
  .card .actors {
    font-size: 9px;
    margin-top: 1px;
    line-height: 1.3;
    -webkit-line-clamp: 3;
  }

  .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; }
}

@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; }
  .card .actors {
    font-size: 8px;
    margin-top: 1px;
    line-height: 1.3;
    -webkit-line-clamp: 3;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ccc; }

/* ==================== 分类页推荐位 ==================== */
.recommend-box {
  background: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.recommend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.recommend-header h3 {
  color: #1a1a1a;
  font-size: 16px;
  margin: 0;
  font-weight: 600;
}
.recommend-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.recommend-scroll::-webkit-scrollbar { height: 6px; }
.recommend-scroll::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}
.recommend-card {
  flex: 0 0 auto;
  width: 120px;
  text-decoration: none;
  transition: transform .2s;
}
.recommend-card:hover { transform: translateY(-2px); }
.rc-cover {
  position: relative;
  width: 120px;
  height: 170px;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  margin-bottom: 8px;
}
.rc-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rc-score {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,.7);
  color: #ffcc00;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.rc-title {
  color: #1a1a1a;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.rc-meta {
  color: #999;
  font-size: 11px;
  line-height: 1.3;
}

@media (max-width: 768px) {
  .recommend-box { padding: 12px; margin-bottom: 14px; }
  .recommend-header h3 { font-size: 15px; }
  .recommend-card { width: 100px; }
  .rc-cover { width: 100px; height: 140px; }
  .rc-title { font-size: 12px; }
}