* { box-sizing: border-box; }
:root {
  --bg: #0e1116; --bg2: #11161d; --card: #171d26; --card2: #1d2530;
  --line: #252e3a; --text: #e8eef6; --muted: #8d9aab;
  --brand: #ff4d4f; --brand2: #ff7a45; --radius: 12px; --wrap: 1280px;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(14,17,22,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { font-weight: 800; font-size: 20px; white-space: nowrap; background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.nav a:hover, .nav a.on { background: var(--card2); color: var(--text); }
.search { display: flex; gap: 6px; }
.search input { width: 200px; background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 12px; outline: none; }
.search input:focus { border-color: var(--brand); }
.search button { background: linear-gradient(90deg, var(--brand), var(--brand2)); border: 0; color: #fff; border-radius: 8px; padding: 0 16px; cursor: pointer; font-weight: 600; }
@media (max-width: 720px) { .search input { width: 120px; } .logo span { display: none; } }

/* 通用 */
.loading, .empty { padding: 60px 0; text-align: center; color: var(--muted); }
.section { margin: 28px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head a { color: var(--muted); font-size: 14px; }
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid transparent; transition: .15s; }
.card:hover { border-color: var(--brand); transform: translateY(-2px); }
.card-pic { position: relative; aspect-ratio: 3 / 4; background: var(--card2); }
.card-pic img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.card-title { padding: 8px 10px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 头图 */
.hero { position: relative; border-radius: 16px; overflow: hidden; margin: 20px 0; min-height: 320px; background: var(--card2); }
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.5); }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,17,22,.95), rgba(14,17,22,.25)); }
.hero-in { position: relative; padding: 40px; max-width: 640px; }
.hero-in h1 { font-size: 30px; margin: 0 0 10px; }
.hero-in p { color: var(--muted); margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.btn { display: inline-block; background: linear-gradient(90deg, var(--brand), var(--brand2)); color: #fff; border: 0; border-radius: 10px; padding: 10px 22px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: var(--card2); color: var(--text); }

/* 详情 */
.detail-head { display: flex; gap: 24px; margin: 20px 0; }
.detail-head .poster { width: 220px; border-radius: 12px; flex: none; aspect-ratio: 3 / 4; object-fit: cover; background: var(--card2); }
.detail-head h1 { margin: 0 0 8px; font-size: 26px; }
.metas { list-style: none; padding: 0; margin: 10px 0; color: var(--muted); }
.metas li { margin: 4px 0; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
@media (max-width: 720px) { .detail-head { flex-direction: column; } .detail-head .poster { width: 140px; } }

.player { margin: 20px 0; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tab { padding: 6px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 340px; overflow: auto; }
.ep { padding: 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); text-align: center; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep:hover { border-color: var(--brand); }
.ep.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.intro { margin: 20px 0; background: var(--card); border-radius: 12px; padding: 16px; color: var(--muted); }
.intro h3 { margin: 0 0 8px; color: var(--text); font-size: 16px; }

/* 分页 */
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 28px 0; flex-wrap: wrap; }
.pager button, .pager a { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
.pager button:disabled, .pager .pg-dis { opacity: .4; cursor: default; }
.pager .pg { color: var(--muted); }

/* 页脚 */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* 数据源切换 */
.srcsel { background: var(--card); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 7px 8px; outline: none; cursor: pointer; font-size: 13px; max-width: 132px; }
.srcsel:focus { border-color: var(--brand); }
@media (max-width: 720px) { .srcsel { max-width: 96px; } }

/* 卡片上的来源角标(仅聚合搜索结果显示) */
.src-tag { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.72); color: #9fe6a0; font-size: 11px; line-height: 1.4; padding: 2px 6px; border-radius: 6px; z-index: 2; }
.src-tag.warn { color: #ffd591; }

/* 线路标记 */
.tag { font-style: normal; font-size: 11px; line-height: 1.5; padding: 1px 5px; border-radius: 4px; margin-left: 6px; }
.tag.ok { background: rgba(82,196,26,.22); color: #9fe6a0; }
.tag.warn { background: rgba(250,173,20,.22); color: #ffd591; }
.tab.active .tag { background: rgba(255,255,255,.25); color: #fff; }

/* 播放器内提示 */
.player-msg { display: flex; align-items: center; justify-content: center; height: 100%; padding: 24px; text-align: center; color: #ffd591; background: #0a0d12; font-size: 14px; }
.note { font-size: 13px; }

