:root {
  --bg: #0c1020;
  --bg-soft: #131a2e;
  --card: #1a2138;
  --card-hover: #222b47;
  --border: #2a3452;
  --text: #eef1f8;
  --text-dim: #96a2c0;
  --accent: #ff5c7a;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #ff5c7a, #8b5cf6);
  --teal: #1fb69a;
  --ok: #34d399;
  --warn: #f5a623;
  --err: #ff6b6b;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1100px 560px at 82% -12%, rgba(139, 92, 246, 0.16), transparent 62%),
              radial-gradient(880px 480px at -12% 8%, rgba(255, 92, 122, 0.10), transparent 58%),
              var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

::selection { background: rgba(255, 92, 122, 0.35); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2c3757; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d4a70; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(11, 15, 26, 0.78);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 30px; filter: drop-shadow(0 2px 8px rgba(255, 92, 122, 0.45)); }
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: 1px; }
.brand-text .subtitle { font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; }

.nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.nav-link {
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.2s ease;
}
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-link.active { color: var(--accent); background: rgba(255, 92, 122, 0.12); }

.status-pill {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.status-pill.ok { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }
.status-pill.bad { color: var(--warn); border-color: rgba(245, 166, 35, 0.4); }

main { max-width: 1280px; margin: 0 auto; padding: 30px 32px; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 42px 36px;
  border-radius: 20px;
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.20), rgba(255, 92, 122, 0.10) 70%, rgba(255, 92, 122, 0.04));
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  margin-bottom: 26px;
}
.hero h2 { margin: 0 0 10px; font-size: 30px; letter-spacing: 1px; }
.hero p { margin: 0; color: var(--text-dim); max-width: 720px; line-height: 1.8; font-size: 14px; }

.search-box {
  display: flex;
  gap: 10px;
  margin: 22px 0 6px;
  max-width: 640px;
}
.search-box input {
  flex: 1;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.12); }
.btn {
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); opacity: 0.92; box-shadow: 0 6px 18px rgba(255, 92, 122, 0.22); }
.btn.ghost { background: var(--card); border: 1px solid var(--border); }
.btn.ghost:hover { box-shadow: none; border-color: var(--accent); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 30px 0 16px;
}
.section-title h3 {
  display: flex; align-items: center; gap: 10px;
  margin: 0; font-size: 18px; letter-spacing: 0.5px;
}
.section-title h3::before {
  content: '';
  width: 4px; height: 16px; border-radius: 2px;
  background: var(--accent-grad);
}
.section-title .hint { font-size: 12px; color: var(--text-dim); }

/* ---- 导航广告位（文字链接，最多 5 条） ---- */
.nav-ad-bar { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.nav-ad-bar.hidden { display: none; }
.nav-ad {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-dim);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.nav-ad:hover { color: var(--text); background: var(--card); }

/* ---- 首页轮播 ---- */
.hero-carousel { margin-bottom: 22px; }
.hero-carousel.hidden { display: none; }
.carousel {
  position: relative;
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--bg-soft);
}
.carousel-slide {
  position: absolute;
  inset: 0;
  background: center/cover no-repeat;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.6s ease, transform 7s linear;
  cursor: pointer;
}
.carousel-slide.active { opacity: 1; transform: scale(1); z-index: 1; }
.carousel-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 8, 16, 0.94) 0%, rgba(5, 8, 16, 0.55) 46%, rgba(5, 8, 16, 0.04) 100%),
    linear-gradient(0deg, rgba(5, 8, 16, 0.65), transparent 55%);
}
.carousel-body {
  position: absolute;
  left: 42px;
  bottom: 52px;
  max-width: 62%;
  z-index: 2;
}
.carousel-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #fff;
  margin-bottom: 12px;
}
.carousel-body h3 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.25;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.6);
}
.carousel-body p { margin: 0 0 16px; color: #cfd6e6; font-size: 14px; }
.carousel-more { font-size: 13px; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.5); padding-bottom: 2px; }
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 12, 22, 0.45);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s, background 0.2s;
}
.carousel:hover .carousel-arrow { opacity: 1; }
.carousel-arrow:hover { background: rgba(255, 92, 122, 0.65); }
.carousel-arrow.prev { left: 16px; }
.carousel-arrow.next { right: 16px; }
.carousel-dots {
  position: absolute;
  right: 30px;
  bottom: 24px;
  z-index: 3;
  display: flex;
  gap: 8px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  transition: all 0.25s;
}
.carousel-dot.active { width: 26px; background: #fff; }

/* ---- 搜索条 ---- */
.search-strip { margin-bottom: 20px; }
.search-strip .search-box { margin: 0; max-width: 100%; }

/* ---- 分类导航（一级 + 二级） ---- */
.cat-panel {
  background: linear-gradient(160deg, rgba(26, 33, 56, 0.94), rgba(19, 26, 46, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px 20px;
  margin-bottom: 26px;
}
.cat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cat-panel-title { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; }
.filter-hint { font-size: 12px; color: var(--accent); font-weight: 600; }
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-tab {
  position: relative;
  padding: 9px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.cat-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--cat-color, var(--accent)), var(--accent-2));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
}
.cat-tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--cat-color, var(--accent));
}
.sub-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.sub-tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}
.sub-tab:hover { color: #fff; border-color: var(--cat-color, var(--accent-2)); }
.sub-tab.active {
  background: var(--cat-color, var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.year-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.year-label { font-size: 11px; color: var(--text-dim); letter-spacing: 0.12em; }
.year-pills { margin: 0; gap: 6px; }
.year-pills .pill { padding: 4px 11px; font-size: 12px; }

/* 榜单（最新/最热/高分推荐）与年份筛选同区，用虚线分隔 */
.rank-row {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.rank-row::before {
  content: '榜单';
  font-size: 11px; color: var(--text-dim); letter-spacing: 0.12em;
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.pill:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.pill.active { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: 0 2px 10px rgba(255, 92, 122, 0.25); }

.footer-links { margin-top: 8px; }
.footer-links a { color: var(--text-dim); border-bottom: 1px dashed var(--border); }
.footer-links a:hover { color: var(--accent); }

/* 每行列数固定为 40 的约数（2/4/5/8/10），保证一页 40 条正好铺满，
   不会在最后一行留下看起来像“空白卡片”的空位。 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1600px) { .grid { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); }
.card .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-soft) center/cover no-repeat;
  position: relative;
}
.card .poster .placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 12px;
}
.card .poster.loading {
  background: linear-gradient(110deg, var(--bg-soft) 8%, rgba(255,255,255,.07) 18%, var(--bg-soft) 33%);
  background-size: 200% 100%;
  animation: posterShimmer 1.4s linear infinite;
}
.card .poster.loading::after {
  content: '加载中';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--text-dim);
}
.card .poster.slow::after { content: '海报加载较慢…'; }
@keyframes posterShimmer { to { background-position: -200% 0; } }
.card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff; font-size: 11px;
  padding: 3px 8px; border-radius: 6px;
  backdrop-filter: blur(4px);
}
.card .meta { padding: 10px 12px 12px; }
.card .title { font-size: 13px; font-weight: 600; line-height: 1.4; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { font-size: 11px; color: var(--text-dim); display: flex; gap: 6px; flex-wrap: wrap; }

.empty, .loading { text-align: center; padding: 40px; color: var(--text-dim); }
.spinner {
  display: inline-block; width: 34px; height: 34px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 18px;
  border: 1px solid;
}
.banner.warn { background: rgba(245, 166, 35, 0.1); border-color: rgba(245, 166, 35, 0.4); color: #ffd28a; }
.banner.err { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.4); color: #ffb0b0; }

.pager { display: flex; gap: 10px; justify-content: center; margin-top: 24px; align-items: center; }
.pager button { min-width: 90px; }
.pager .page-info { font-size: 13px; color: var(--text-dim); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; z-index: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 860px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--card); color: var(--text);
  cursor: pointer; font-size: 18px; line-height: 1;
}
.detail-head { display: flex; gap: 20px; padding: 24px; }
.detail-poster {
  width: 150px; flex-shrink: 0;
  aspect-ratio: 2/3; border-radius: 12px;
  background: var(--card) center/cover no-repeat;
  border: 1px solid var(--border);
}
.detail-info h2 { margin: 0 0 8px; }
.detail-meta { font-size: 13px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.detail-desc { font-size: 13px; color: var(--text); line-height: 1.7; }
.play-sources { padding: 0 24px 24px; }
.play-sources h4 { margin: 0 0 10px; font-size: 15px; }
.source-group { margin-bottom: 14px; }
.source-group .src-name { font-size: 13px; color: var(--accent); margin-bottom: 6px; font-weight: 600; }
.episodes { display: flex; flex-wrap: wrap; gap: 6px; }
.ep {
  padding: 5px 10px; font-size: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; color: var(--text-dim);
}
.ep:hover { color: var(--text); border-color: var(--accent); }

/* TVBox / Docs panels */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.panel h3 { margin: 0 0 12px; }
pre.json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
  color: #cbd5e1;
  max-height: 420px;
}
.copy-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.copy-row code {
  background: var(--bg); padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 13px; color: #ffd28a;
  word-break: break-all; flex: 1; min-width: 200px;
}
table.docs { width: 100%; border-collapse: collapse; font-size: 13px; }
table.docs th, table.docs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.docs th { color: var(--text-dim); font-weight: 600; background: var(--bg-soft); }
table.docs code { color: #ffd28a; background: var(--bg); padding: 2px 6px; border-radius: 5px; }

/* ---- 电视直播 ---- */
.live-hero { padding-bottom: 30px; }
.live-meta { margin-top: 14px; color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.live-controls { margin-bottom: 18px; }
.live-group-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.live-search-row { display: flex; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed rgba(255,255,255,.08); }
.live-search-row input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); outline: none; }
.live-search-row input:focus { border-color: var(--accent); }
.live-search-row .btn { padding: 10px 16px; white-space: nowrap; }
.live-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, .8fr); gap: 18px; align-items: start; }
.live-player-panel, .live-channel-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.live-video-wrap { position: relative; aspect-ratio: 16/9; background: #05070d; }
.live-video-wrap video { display: block; width: 100%; height: 100%; background: #05070d; }
.live-player-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 13px; pointer-events: none; }
.live-player-empty.hidden { display: none; }
.live-now { padding: 18px 20px 10px; }
.live-now-title { display: flex; align-items: center; gap: 10px; }
.live-now-title h3 { margin: 0; min-width: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-group-badge { flex-shrink: 0; padding: 3px 8px; border-radius: 6px; color: #fff; background: var(--accent-grad); font-size: 10px; letter-spacing: .08em; }
.live-now p { margin: 8px 0 0; min-height: 20px; color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.live-lines { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 20px 20px; }
.live-line { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text-dim); font-size: 11px; cursor: pointer; }
.live-line:hover { color: var(--text); border-color: var(--accent); }
.live-line.active { color: #fff; border-color: transparent; background: var(--accent-grad); }
.live-list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.live-list-head h3 { margin: 0; font-size: 16px; }
.live-list-head span { color: var(--text-dim); font-size: 11px; }
.live-channel-list { max-height: 700px; overflow-y: auto; padding: 8px; }
.live-channel { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.live-channel:hover { background: rgba(255,255,255,.045); }
.live-channel.active { background: rgba(255,92,122,.12); border-color: rgba(255,92,122,.4); }
.live-channel-logo { position: relative; display: flex; align-items: center; justify-content: center; flex: 0 0 42px; width: 42px; height: 42px; overflow: hidden; border-radius: 9px; background: var(--bg-soft); color: var(--text-dim); font-size: 16px; }
.live-channel-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.live-channel-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.live-channel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.live-channel-meta { color: var(--text-dim); font-size: 10px; }
/* 频道列表健康度：首线路探测未通过的频道打「疑似失效」标记，仍可点击尝试 */
.live-channel.dead { opacity: .62; }
.live-channel.dead .live-channel-name { text-decoration: line-through; text-decoration-color: rgba(255,92,122,.55); }
.live-health { flex: 0 0 auto; margin-left: auto; padding: 2px 6px; border-radius: 6px; background: rgba(255,92,122,.14); border: 1px solid rgba(255,92,122,.35); color: #ff8fa3; font-size: 9px; white-space: nowrap; }
.live-pager { margin: 0; padding: 12px; border-top: 1px solid var(--border); }
.live-pager:empty { display: none; }
.live-pager .btn { min-width: 0; padding: 7px 10px; font-size: 11px; }
@media (max-width: 900px) {
  .live-layout { grid-template-columns: 1fr; }
  .live-channel-list { max-height: 480px; }
  .live-player-panel { scroll-margin-top: 130px; }
}
@media (max-width: 560px) {
  .live-search-row { flex-wrap: wrap; }
  .live-search-row input { flex-basis: 100%; }
  .live-now { padding: 14px 14px 8px; }
  .live-lines { padding: 8px 14px 16px; }
}

.footer { text-align: center; padding: 30px 20px; color: var(--text-dim); font-size: 12px; border-top: 1px solid var(--border); margin-top: 30px; }

/* ---- 创意频道 ---- */
.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.channel-card {
  position: relative;
  background: linear-gradient(150deg, rgba(139, 92, 246, 0.10), rgba(26, 33, 56, 0.9) 55%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.channel-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}
.channel-icon { font-size: 30px; line-height: 1.2; }
.channel-name { font-size: 17px; font-weight: 700; letter-spacing: 0.5px; }
.channel-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.7; flex: 1; }
.channel-more { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 4px; }

.channel-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.channel-detail-title { display: flex; gap: 16px; align-items: flex-start; flex: 1; min-width: 260px; }
.channel-detail-title .channel-icon { font-size: 36px; }
.channel-detail-title h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: 0.5px; }
.channel-detail-title p { margin: 0 0 6px; color: var(--text-dim); font-size: 13px; line-height: 1.7; max-width: 720px; }

/* ---- 首页门户：栏目、快捷分类与横滑卡片 ---- */
.portal-cat-bar { margin: -4px 0 18px; }
.portal-cats { display: flex; gap: 10px; flex-wrap: wrap; }
.portal-cat {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.portal-cat:hover { color: var(--text); border-color: var(--teal); transform: translateY(-1px); }
.portal-cat.active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #0ea5a4);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(31, 182, 154, 0.25);
}
.portal-section { margin: 22px 0; }
.portal-title { margin: 0 0 14px; }
.portal-title h3 { font-size: 19px; }
.portal-title h3::before { background: linear-gradient(135deg, var(--teal), #0ea5a4); }
.portal-more {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.portal-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x proximity;
}
.portal-grid .card { flex: 0 0 150px; }
.portal-grid::-webkit-scrollbar { height: 8px; }
.card:hover .title { color: var(--teal); }
.channel-preview-grid .channel-mini { flex: 0 0 220px; min-height: 150px; }
.channel-mini .channel-icon { font-size: 26px; }
.channel-mini .channel-name { font-size: 15px; }
@media (min-width: 760px) { .portal-grid .card { flex-basis: 165px; } }
@media (min-width: 1100px) { .portal-grid .card { flex-basis: 175px; } }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .nav { order: 3; width: 100%; }
  .detail-head { flex-direction: column; }
  .detail-poster { width: 120px; }
  main { padding: 18px; }
  .hero { padding: 26px 20px; }
  .hero h2 { font-size: 24px; }
  .nav-ad { max-width: 160px; font-size: 13px; padding: 7px 10px; }
  .carousel { height: 230px; border-radius: 16px; }
  .carousel-body { left: 20px; right: 20px; bottom: 36px; max-width: none; }
  .carousel-body h3 { font-size: 22px; }
  .carousel-body p { display: none; }
  .carousel-arrow { display: none; }
  .carousel-dots { right: 16px; bottom: 14px; }
  .cat-tab { padding: 8px 14px; font-size: 14px; }
  .cat-panel { padding: 14px; }
}
