/* =========================================================================
   Tesla Media Hub · 影院控制台设计系统 (Cinema Console)
   面向特斯拉大屏横向触摸场景：大字、大触控目标、电影质感深色主题
   ──────────────────────────────────────────────────────────────────────────
   保留 player.js / app.js 依赖的全部 class 与 id 名称
   ========================================================================= */

:root {
  /* 色彩 */
  --bg: #0b0e13;
  --bg-2: #0e1219;
  --surface: #141a24;
  --surface-2: #1b2230;
  --surface-hover: #212a3a;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #f4f7fb;
  --text-dim: #98a2b3;
  --text-faint: #6b7484;

  --accent: #e82127;          /* Tesla 红 */
  --accent-bright: #ff3b41;
  --accent-soft: rgba(232, 33, 39, 0.14);
  --accent-glow: rgba(232, 33, 39, 0.35);
  --accent-2: #ff8c42;
  --danger: #ff5a5f;

  /* Netflix-like restrained geometry */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;

  --touch-min: 52px;           /* 车机大触控目标 */

  /* 阴影 / 层级 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 10px 40px rgba(232, 33, 39, 0.25);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(232, 33, 39, 0.10), transparent 60%),
    radial-gradient(900px 600px at 0% 110%, rgba(0, 150, 199, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Follow the vehicle/browser system appearance automatically. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f5;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #eeeeee;
    --surface-hover: #e4e4e4;
    --line: rgba(0, 0, 0, 0.10);
    --line-strong: rgba(0, 0, 0, 0.18);
    --text: #171717;
    --text-dim: #626262;
    --text-faint: #8b8b8b;
    --accent-soft: rgba(229, 9, 20, 0.10);
    --accent-glow: rgba(229, 9, 20, 0.22);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.10);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.16);
    --shadow-glow: 0 10px 30px rgba(229, 9, 20, 0.16);
  }
  html, body {
    background: var(--bg);
  }
  #topbar {
    background: rgba(255, 255, 255, 0.94);
  }
  #topbar::after {
    background: linear-gradient(180deg, rgba(245, 245, 245, 0.7), transparent);
  }
  .fav-btn { background: rgba(0, 0, 0, 0.58); color: #fff; }
}

/* Netflix's signature red is the single action accent. */
:root { --accent: #e50914; --accent-bright: #f6121d; }

body { display: flex; flex-direction: column; overflow: hidden; }

/* 滚动条隐藏（触摸场景） */
*::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

/* ---------- 顶栏：毛玻璃 + 渐隐底边 ---------- */
#topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(11, 11, 11, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  flex: none;
  z-index: 20;
}
#topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -18px;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(11, 14, 19, 0.65), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand svg { display: block; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.brand-mark {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
}
.brand-sub { color: var(--text-dim); font-size: 11px; letter-spacing: 0.08em; white-space: nowrap; }

.btn-back {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), transform var(--ease);
}
.btn-back:hover { border-color: var(--accent); color: var(--accent); }
.btn-back:active { background: var(--accent-soft); transform: scale(0.94); }

.title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#page-title { font-size: 20px; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-sub { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 主内容 ---------- */
#app {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 20px 28px;
}

.page-title { font-size: 22px; font-weight: 700; margin: 2px 2px 14px; letter-spacing: 0.01em; }
.section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 22px 2px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: "";
  width: 4px; height: 15px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ---------- 通用卡片网格 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.source-card, .vod-card { box-shadow: var(--shadow-sm); }
.source-card:hover, .vod-card:hover { box-shadow: var(--shadow-md); }
.card:active { transform: scale(0.97); }

.vod-card { position: relative; }

.vod-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

/* 频道收藏星标（IPTV 频道列表） */
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform var(--ease), background var(--ease), color var(--ease);
}
.fav-btn:active { transform: scale(0.9); }
.fav-btn.on { color: #ffd24a; background: rgba(0, 0, 0, 0.55); }

.vod-card .poster {
  position: relative;
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(135deg, #1a212e, #11151d);
  overflow: hidden;
}
.vod-card .poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease), filter var(--ease);
}
.vod-card:hover .poster img { transform: scale(1.05); }
.vod-card .poster .poster-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 13px; text-align: center; padding: 10px;
}
.vod-card .poster .remarks {
  position: absolute;
  right: 0; bottom: 0; left: 0;
  padding: 14px 10px 8px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* IPTV 频道预览图（tvg-logo）：台标多为横向 logo，用 contain + 内边距避免裁切 */
.vod-card .poster .ch-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  background: #0c1018;
  display: block;
}
.vod-card:hover .poster .ch-logo-img { transform: none; }
/* 无 logo 时的首字占位 */
.vod-card .poster .poster-fallback.ch-logo {
  font-size: 44px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, #243049, #141a26);
  letter-spacing: 0;
}
.vod-card .v-name {
  padding: 10px 12px 2px;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vod-card .v-epg {
  padding: 0 12px 12px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 源 / 站点卡片 */
.source-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 104px;
  background: var(--surface);
}
.source-card:hover { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.card-title { font-size: 18px; font-weight: 700; }
.card-meta { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  align-self: flex-start;
}
.badge.catpaw { background: rgba(255, 140, 66, 0.16); color: var(--accent-2); }
.badge.tvbox { background: var(--accent-soft); color: var(--accent-bright); }

.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions button {
  flex: 1;
  min-height: 46px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  transition: background var(--ease), transform var(--ease);
}
.card-actions button:active { transform: scale(0.96); }
.card-actions button.enter { background: var(--accent); color: #fff; font-weight: 700; }
.card-actions button.enter:active { background: var(--accent-bright); }
.card-actions button.del { background: rgba(255, 90, 95, 0.15); color: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  min-height: var(--touch-min);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 22px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition: background var(--ease), transform var(--ease), opacity var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 700; }
.btn.primary:active { background: var(--accent-bright); }
.btn.block { display: block; width: 100%; margin-top: 16px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.hidden { display: none !important; }

/* ---------- 分类栏 ---------- */
.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
}
.cat-bar .cat {
  flex: none;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--ease);
}
.cat-bar .cat:active { transform: scale(0.95); }
.cat-bar .cat.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: rgba(232, 33, 39, 0.45);
}

/* ---------- 搜索行 ---------- */
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input {
  flex: 1;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
  font-size: 16px;
  transition: border-color var(--ease);
}
.search-row input:focus { outline: none; border-color: var(--accent); }
.search-row button {
  min-height: var(--touch-min);
  min-width: 76px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--ease);
}
.search-row button:active { background: var(--accent-bright); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0 8px; }
.pager .info { color: var(--text-dim); font-size: 14px; min-width: 96px; text-align: center; }

/* ---------- 详情页 ---------- */
.detail-head {
  display: flex;
  gap: 18px;
  padding-bottom: 18px;
}
.detail-head .poster {
  width: 150px;
  flex: none;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #1a212e, #11151d);
  box-shadow: var(--shadow-md);
}
.detail-head .poster img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { flex: 1; min-width: 0; }
.detail-info .d-title { font-size: 24px; font-weight: 800; line-height: 1.25; margin-bottom: 10px; }
.detail-info .d-line { font-size: 14px; color: var(--text-dim); margin-bottom: 5px; line-height: 1.5; }
.detail-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  max-height: 150px;
  overflow-y: auto;
}

/* 线路 Tab */
.tab-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; }
.tab-bar .tab {
  flex: none;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all var(--ease);
}
.tab-bar .tab.active { background: rgba(255, 140, 66, 0.16); color: var(--accent-2); border-color: rgba(255, 140, 66, 0.45); }

/* 选集网格 */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
  padding-bottom: 20px;
}
.ep-grid .ep {
  min-height: 50px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  transition: all var(--ease);
}
.ep-grid .ep:active { background: var(--accent); color: #fff; border-color: transparent; transform: scale(0.96); }

/* ---------- Hero 精选（首页） ---------- */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: clamp(280px, 42vh, 460px);
  margin-bottom: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  background: #11151d;
  box-shadow: var(--shadow-md);
}
.hero .hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: saturate(1.05);
}
.hero .hero-bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 14, 19, 0.94) 12%, rgba(11, 14, 19, 0.55) 55%, rgba(11, 14, 19, 0.2) 100%),
    linear-gradient(0deg, rgba(11, 14, 19, 0.96), transparent 70%);
}
.hero .hero-body { position: relative; padding: clamp(24px, 5vw, 56px); max-width: min(760px, 78%); }
.hero .hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent-bright);
  background: var(--accent-soft);
  padding: 4px 12px; border-radius: 20px; margin-bottom: 12px;
}
.hero .hero-title { font-size: clamp(30px, 4vw, 56px); font-weight: 800; line-height: 1.08; margin-bottom: 14px; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,0.75); }
.hero-fallback { background: linear-gradient(110deg, #160b0d, #341116 55%, #0d0d0f); }
.hero .hero-meta { font-size: 14px; color: var(--text-dim); margin-bottom: 8px; }
.hero .hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 16px;
  padding: 12px 22px; border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.hero .hero-cta:active { background: var(--accent-bright); transform: scale(0.97); }

/* 最近观看 rail */
.rail { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 6px; }
.rail-card {
  flex: none;
  width: 150px;
  cursor: pointer;
  transition: transform var(--ease);
}
.rail-card:active { transform: scale(0.96); }
.rail-card .poster {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #1a212e, #11151d);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.rail-card .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-card .resume {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  height: 5px; border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.rail-card .resume > i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.rail-card .ep-tag {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 700;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  padding: 3px 8px; border-radius: 8px;
}
.rail-card .r-name {
  margin-top: 8px;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 播放器层 ---------- */
.player-layer {
  position: fixed;
  inset: 0;
  height: 100dvh;
  background: #000;
  z-index: 100;
  display: flex;
}
.player-layer.hidden { display: none; }

.player-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.player-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.95), rgba(10, 13, 18, 0.5));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-height: 56px;
}
.player-head-left {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.quality-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
}
.quality-btn:active { transform: scale(0.96); }
.quality-btn.active { background: var(--accent); color: #fff; }
.player-close {
  min-height: 44px;
  min-width: 50px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 90, 95, 0.18);
  color: var(--danger);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0 12px;
  transition: background var(--ease), transform var(--ease);
}
.player-close:active { transform: scale(0.95); background: rgba(255, 90, 95, 0.3); }
.player-close svg { display: block; }

#player-box {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  background: #000;
}
.drive-view { position: absolute; inset: 0; background: #000; z-index: 10; }
.drive-view.hidden { display: none !important; }
#tesla-host { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
#tesla-host canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}
/* IPTV 播放容器：与 #tesla-host 同样铺满，否则画布 0 尺寸会黑屏/“打不开” */
#iptv-host { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
#iptv-host canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
}
/* 隐藏播放库自带的“加载中”旋转圈：直播 HLS 持续微缓冲会让它一直显示，影响观感；
   连接状态已由顶部 toast 提示。
   注意：只精准匹配旋转层 class（_loadingWrap_ / _loadingSpinner_ / _loadingSpin_），
   切勿用 div[class*="loading"] 这种通配——播放库还有 loadingEnded 等其它含 loading 的
   内部节点，通配会把视频画面/容器一并隐藏，导致“直播打不开 / 黑屏”。 */
#iptv-host div[class*="_loadingWrap_"],
#iptv-host div[class*="_loadingSpinner_"],
#iptv-host div[class*="_loadingSpin_"],
#tesla-host div[class*="_loadingWrap_"],
#tesla-host div[class*="_loadingSpinner_"],
#tesla-host div[class*="_loadingSpin_"] { display: none !important; }

/* 首屏加载层（自己控制，仅在「尚未出首帧」时显示，出首帧即消失；直播中不常驻，不会一直转圈） */
.iptv-loading {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #000;
  color: var(--text-dim);
}
.iptv-loading.hidden { display: none !important; }
.iptv-spin {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: iptvSpin 0.9s linear infinite;
}
.iptv-loading-text { font-size: 15px; letter-spacing: 0.04em; }
@keyframes iptvSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .iptv-spin { animation-duration: 2.4s; }
}

.ep-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  background: linear-gradient(0deg, rgba(10, 13, 18, 0.96), rgba(10, 13, 18, 0.4));
  scrollbar-width: none;
}
.ep-strip::-webkit-scrollbar { display: none; }
.ep-strip .ep-mini {
  flex: none;
  min-height: 44px;
  min-width: 68px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
}
.ep-strip .ep-mini:active { transform: scale(0.95); }
.ep-strip .ep-mini.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-glow); }

/* ---------- 播放内「频道」按钮 ---------- */
.channels-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}
.channels-btn:active { transform: scale(0.96); }

/* ---------- 播放内「频道」抽屉（不退出直播即可换台） ---------- */
.ch-drawer {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 88vw);
  background: rgba(13, 17, 24, 0.985);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 30;
  box-shadow: -18px 0 44px rgba(0, 0, 0, 0.5);
  animation: fadeUp 0.22s var(--ease) both;
}
.ch-drawer.hidden { display: none; }
.ch-drawer-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.ch-drawer-head input {
  flex: 1;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
}
.ch-drawer-head input:focus { outline: none; border-color: var(--accent); }
.ch-drawer-close {
  flex: none;
  min-width: 46px;
  min-height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background var(--ease);
}
.ch-drawer-close:active { background: rgba(255, 255, 255, 0.12); }
.ch-drawer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
}
.ch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.ch-row:active { transform: scale(0.99); }
.ch-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ch-row-logo-wrap {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  background: #0c1018;
  display: grid;
  place-items: center;
}
.ch-row-logo { width: 100%; height: 100%; object-fit: contain; }
.ch-row-initial { font-size: 22px; font-weight: 800; color: rgba(255, 255, 255, 0.22); }
.ch-row-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch-row-group {
  font-size: 12px;
  color: var(--text-dim);
  flex: none;
  max-width: 36%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 模态框 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }
.modal-body {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-body h3 { font-size: 19px; margin-bottom: 4px; font-weight: 700; }
.modal-body input, .modal-body select, .modal-body textarea {
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline: none; border-color: var(--accent); }
.modal-body textarea { resize: vertical; min-height: 72px; }
.modal-body .tip { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20, 26, 36, 0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 13px 24px;
  border-radius: 26px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
  z-index: 200;
  max-width: 82vw;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 空状态 / 加载 ---------- */
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 56px 20px;
  font-size: 15px;
  line-height: 1.7;
}
.loading {
  text-align: center;
  color: var(--text-dim);
  padding: 44px;
  font-size: 15px;
}

/* 骨架屏 */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--radius);
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton.poster { aspect-ratio: 3 / 4; }
.skeleton.line { height: 14px; border-radius: 7px; margin: 10px 12px; }

/* ---------- 入场动画 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.4s var(--ease) both; }
.card-grid .card { animation: fadeUp 0.4s var(--ease) both; }
.card-grid .card:nth-child(2) { animation-delay: 0.03s; }
.card-grid .card:nth-child(3) { animation-delay: 0.06s; }
.card-grid .card:nth-child(4) { animation-delay: 0.09s; }
.card-grid .card:nth-child(5) { animation-delay: 0.12s; }
.card-grid .card:nth-child(6) { animation-delay: 0.15s; }
.card-grid .card:nth-child(7) { animation-delay: 0.18s; }
.card-grid .card:nth-child(8) { animation-delay: 0.21s; }

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; }
}

/* ---------- 管理后台登录 ---------- */
.login-view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-md);
}
.login-box h2 { font-size: 23px; text-align: center; margin-bottom: 6px; }
.login-box input {
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  padding: 0 16px;
  font-size: 16px;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box .btn { min-height: 52px; }
.back-link {
  color: var(--text-dim);
  text-align: center;
  font-size: 14px;
  text-decoration: none;
  padding-top: 4px;
}
.back-link:active { color: var(--accent); }
