/* ============================================================
   影视盒子 · 移动 / 平板体验增强层（覆盖式，可整体删除回滚）
   依赖：style.css 先加载；本文件只做覆盖与增强，不改原有类语义
   ============================================================ */

:root {
  --ui-radius: 16px;
  --ui-gap: 12px;
  --ui-dock-h: 60px;
  --ui-edge: env(safe-area-inset-top, 0px);
  --ui-safe-b: env(safe-area-inset-bottom, 0px);
  --ui-ease: cubic-bezier(.22, .61, .36, 1);
  --ui-line: rgba(255, 255, 255, .08);
  --ui-glass: rgba(18, 23, 33, .72);
}

/* 触摸交互基础：去掉点按高亮、允许滚动惯性 */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
input, textarea { user-select: text; -webkit-user-select: text; }

/* 滚动条在移动端隐藏 */
@media (max-width: 900px) {
  ::-webkit-scrollbar { width: 0; height: 0; }
}

/* ================= 首页：进入界面重塑 ================= */
.home-wrap {
  justify-content: center;
  padding: 4px 0 12px;
  position: relative;
}
.home-wrap::before {
  content: "";
  position: absolute;
  inset: -10% -20% auto -20%;
  height: 460px;
  background:
    radial-gradient(520px 260px at 22% 12%, rgba(79, 140, 255, .22), transparent 70%),
    radial-gradient(460px 240px at 82% 4%, rgba(124, 92, 255, .20), transparent 70%),
    radial-gradient(380px 200px at 55% 30%, rgba(52, 199, 123, .10), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
}
.home-wrap > * { position: relative; z-index: 1; }

.home-hero { width: min(720px, 100%); }

.hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.hero-logo {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 21px; font-weight: 800;
  box-shadow: 0 8px 22px rgba(79, 140, 255, .32);
}
.hero-brand .home-title {
  margin: 0;
  font-size: 25px;
  letter-spacing: 1px;
  line-height: 1.15;
  text-align: left;
  background: linear-gradient(120deg, #fff 10%, #a9c4ff 55%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--sub);
  letter-spacing: .3px;
}

/* 搜索框：更大气，触控友好 */
.home-search {
  padding: 6px 6px 6px 18px;
  border-radius: 16px;
  background: rgba(24, 31, 44, .88);
  border: 1px solid rgba(255, 255, 255, .10);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .38);
}
.home-search input {
  font-size: 15.5px;
  padding: 14px 4px;
}
.home-search .icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  font-size: 17px;
}
.home-tip { margin-top: 10px; font-size: 12.5px; text-align: left; }

/* 首页快捷入口 */
.home-entries {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.entry {
  border: 1px solid var(--ui-line);
  background: linear-gradient(180deg, rgba(26, 34, 48, .92), rgba(20, 26, 38, .92));
  border-radius: 14px;
  padding: 11px 8px 10px;
  color: var(--txt);
  text-align: center;
  cursor: pointer;
  transition: transform .16s var(--ui-ease), border-color .16s;
  min-height: 74px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.entry:active { transform: scale(.96); border-color: var(--accent); }
.entry .ic {
  font-size: 19px; line-height: 1;
  width: 26px; height: 26px; display: grid; place-items: center;
}
.entry b { font-size: 13px; font-weight: 700; }
.entry span { font-size: 10.5px; color: var(--sub); }

/* 首页横滑片单 */
.home-rails { width: 100%; }
.rail { margin-bottom: 16px; }
.rail-head { align-items: center; }
.rail-title { font-size: 14px; }
.rail-sub { font-size: 10.5px; }
.rail-body {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  grid-template-columns: none;
}
.rail-card {
  width: 108px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  border-radius: 12px;
}
.rail-card .pname { font-size: 12px; }

/* ================= 移动端整体框架 ================= */
@media (max-width: 900px) {
  body {
    background:
      radial-gradient(700px 420px at 85% -8%, #16233b 0%, transparent 60%),
      var(--bg);
    overflow: hidden;
  }

  /* 顶栏：精简为品牌条 */
  header {
    padding: calc(var(--ui-edge) + 8px) 14px 8px;
    gap: 10px;
    border-bottom: 1px solid var(--ui-line);
    background: rgba(11, 14, 20, .82);
  }
  header .logo { font-size: 16px; gap: 8px; }
  header .logo .badge { width: 27px; height: 27px; font-size: 14px; border-radius: 9px; }
  header .status-dot { margin-left: auto; }

  /* 导航移至底部 Dock */
  header nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    order: 0;
    width: auto;
    z-index: 400;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    padding: 6px 10px calc(6px + var(--ui-safe-b));
    background: rgba(12, 16, 23, .92);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--ui-line);
    overflow: visible;
  }
  header nav .tab {
    padding: 6px 0 4px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    background: none !important;
    box-shadow: none !important;
    color: var(--sub);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-height: 46px;
    justify-content: center;
  }
  header nav .tab::before {
    font-size: 17px;
    line-height: 1;
    display: block;
  }
  header nav .tab[data-view="vod"]::before { content: "▶"; }
  header nav .tab[data-view="live"]::before { content: "◉"; }
  header nav .tab[data-view="settings"]::before { content: "◎"; }
  header nav .tab.active { color: var(--accent); }
  header nav .tab.active::after {
    content: "";
    position: absolute;
    bottom: 2px;
    width: 16px; height: 2.5px;
    border-radius: 2px;
    background: var(--accent);
  }
  header nav .tab { position: relative; }

  main { height: calc(100dvh - 47px - var(--ui-edge)); }
  .view { padding: 10px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .view.active { padding-bottom: calc(var(--ui-dock-h) + var(--ui-safe-b) + 10px); }

  /* 首页 */
  .home-wrap {
    justify-content: flex-start;
    padding: 6px 0 calc(var(--ui-dock-h) + 24px);
    gap: 18px;
  }
  .home-wrap::before { height: 300px; inset: -6% -20% auto -20%; }
  .home-entries { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .entry { min-height: 68px; padding: 9px 4px; border-radius: 13px; }
  .entry b { font-size: 12px; }
  .entry span { display: none; }
  .hero-logo { width: 38px; height: 38px; font-size: 18px; border-radius: 11px; }
  .hero-brand .home-title { font-size: 21px; }
  .home-browse-btn { width: 100%; padding: 13px; font-size: 14px; border-radius: 12px; }

  /* 片库 */
  .vod-browse { height: auto; min-height: 0; gap: 10px; }
  .browse-head {
    position: sticky; top: 0; z-index: 20;
    margin: -10px -12px 4px;
    padding: 8px 12px;
    background: rgba(11, 14, 20, .94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ui-line);
  }
  .back-btn { padding: 8px 12px; font-size: 13px; border-radius: 10px; min-height: 38px; display: flex; align-items: center; }
  .browse-title { font-size: 14px; }
  .vod-left .panel { max-height: none; }
  .vod-left { margin-bottom: 2px; }
  .source-list { padding: 5px; gap: 5px; }
  .source-item { padding: 8px 13px; font-size: 12.5px; border-radius: 20px; }
  .class-bar { overflow-x: auto; display: flex; gap: 7px; padding-bottom: 6px; flex-wrap: nowrap; }
  .class-chip { flex: 0 0 auto; padding: 7px 14px; font-size: 12.5px; border-radius: 20px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 9px; }
  .pcard .pname { font-size: 12px; margin-top: 4px; }
  .pcard .pmeta { font-size: 10.5px; }
  .pcard .poster { border-radius: 10px; }
  .pager { padding: 14px 0 6px; }
  .pager button { min-height: 40px; padding: 0 20px; }

  /* ========== 直播：播放器吸顶 + 下面单列浏览 ==========
     原结构是 .live-left（源+分组）在左、.live-main（频道列表 340px + 播放器）在右，
     手机上要滚过三块内容才能看到画面。这里用 display:contents 打散后按 order 重排，
     播放器置顶吸顶，源/分组各占一行横滑，频道列表改两列网格。 */
  .live-layout { display: flex; flex-direction: column; gap: 10px; height: auto; min-height: 0; }
  .live-left, .live-main { display: contents; }

  .live-player {
    order: 1;
    position: sticky;
    top: -10px;
    z-index: 30;
    display: flex; flex-direction: column; gap: 8px;
    padding: 8px 0 10px;
    background: linear-gradient(180deg, var(--bg) 84%, rgba(11, 14, 20, 0));
  }
  .live-stage { height: auto; aspect-ratio: 16 / 9; min-height: 0; border-radius: 12px; }
  .live-stage .hint { font-size: 13px; text-align: center; padding: 0 20px; }
  .live-info {
    padding: 8px 10px; gap: 6px; font-size: 12.5px; border-radius: 10px;
    flex-wrap: nowrap; align-items: center;
  }
  .live-info .now {
    font-weight: 600; max-width: 46%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .live-info .sub {
    font-size: 11px; color: var(--sub);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .live-info .mini-btn { min-height: 34px; padding: 6px 12px; font-size: 12px; white-space: nowrap; }

  .live-left > .panel:nth-child(1) { order: 2; }
  .live-left > .panel:nth-child(2) { order: 3; }
  .live-main > .panel { order: 4; width: 100% !important; }
  .live-left > .panel, .live-main > .panel { max-height: none !important; }
  .live-left > .panel .phead, .live-main > .panel .phead { padding: 9px 12px; font-size: 12.5px; }

  .live-src-bar { padding: 8px; gap: 6px; }
  .live-src { padding: 7px 13px; font-size: 12.5px; border-radius: 18px; }
  .group-tree { flex-direction: row; overflow-x: auto; padding: 8px; gap: 6px; }
  .gnode {
    white-space: nowrap; flex: 0 0 auto;
    padding: 7px 13px; font-size: 12.5px; border-radius: 18px;
    background: var(--card2);
  }
  .gnode.active { background: var(--accent); color: #fff; }

  .ch-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: none;
    overflow: visible;
    padding: 8px;
  }
  .chn {
    padding: 9px 10px; font-size: 12.5px; border-radius: 10px;
    background: var(--card2); gap: 8px;
  }
  .chn.active {
    background: rgba(79, 140, 255, .18); color: #fff;
    box-shadow: inset 0 0 0 1px rgba(79, 140, 255, .5);
  }
  .chn .logo {
    width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px;
    overflow: hidden; display: grid; place-items: center; background: rgba(255, 255, 255, .06);
  }
  .chn .logo img { width: 100%; height: 100%; object-fit: contain; }
  .chn .no { font-size: 9px; }
  .mini-search { margin: 0; padding: 0 8px 8px; }
  .mini-search input { min-height: 40px; font-size: 13.5px; }

  /* 详情页 */
  .detail-view { padding: 0 0 calc(var(--ui-dock-h) + var(--ui-safe-b) + 30px); overflow-y: auto; }
  .detail-view .back-btn {
    position: sticky; top: 0; z-index: 30;
    padding: 10px 14px; margin: 0;
    background: rgba(11, 14, 20, .95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ui-line);
    border-radius: 0;
    font-size: 13px;
  }
  .detail-top { flex-direction: column; gap: 12px; padding: 12px; }
  .detail-poster { width: 96px; flex: 0 0 auto; }
  .detail-poster img { border-radius: 10px; }
  .detail-info { width: 100%; }
  .detail-info h2 { font-size: 18px; }
  .dname-row { align-items: flex-start; gap: 8px; }
  .line-bar { flex-wrap: wrap; gap: 8px; margin: 10px 0; }
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 7px; }
  .ep { min-height: 40px; font-size: 12.5px; border-radius: 9px; }
  .detail-desc { font-size: 12.5px; line-height: 1.7; }

  /* 设置 */
  .settings-layout { gap: 12px; padding: 0 0 20px; }
  .set-panel { padding: 12px; border-radius: 14px; }
  .set-panel h3 { font-size: 14px; }
  .src-tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .srow { padding: 10px 0; }
  .srow label { font-size: 13px; }
  .mini-btn { min-height: 38px; padding: 8px 14px; font-size: 12.5px; border-radius: 10px; }
}

/* ================= 平板（641 ~ 1024） ================= */
@media (min-width: 641px) and (max-width: 1024px) {
  header { padding: 10px 18px; }
  main { height: calc(100vh - 58px); }
  .view { padding: 14px 16px 14px; }
  .home-hero { width: min(640px, 92%); }
  .home-title { font-size: 30px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .rail-body { gap: 12px; }
  .rail-card { width: 124px; }
  .vod-left { width: 170px; }
  .detail-poster { width: 150px; }
  .detail-info h2 { font-size: 22px; }
  .ep-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}

/* ================= 播放器：沉浸 / 控件 / 抽屉 ================= */

/* 播放器容器：手机端默认 16:9，圆角收敛 */
#playerOverlay {
  border-radius: 12px;
  background: #000;
  touch-action: none;
  transition: border-radius .2s var(--ui-ease);
}

/* 沉浸模式（JS 添加 .ph-immersive） */
#playerOverlay.ph-immersive {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  z-index: 9999;
  margin: 0;
  border: none;
  border-radius: 0;
}
body.ph-lock { overflow: hidden; }

/* 顶部/底部控件：可隐藏、渐隐渐现 */
.player-top,
.player-ctrl {
  transition: opacity .26s var(--ui-ease), transform .26s var(--ui-ease);
}
#playerOverlay.ph-hide .player-top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
#playerOverlay.ph-hide .player-ctrl { opacity: 0; transform: translateY(10px); pointer-events: none; }
#playerOverlay.ph-hide { cursor: none; }

/* 控件条：在原样式基础上适配安全区与渐变压暗，保证手机刘海屏/手势区不遮挡 */
.player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.player-ctrl {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  padding: 16px 14px calc(12px + var(--ui-safe-b));
  background: linear-gradient(0deg, rgba(0, 0, 0, .82), rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0));
}
#playerOverlay { overflow: hidden; }

/* 控件触控尺寸 */
.player-top { padding: 12px 14px; gap: 8px; }
.player-top .pclose {
  min-width: 40px; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; margin-left: 0;
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(6px);
}
.player-top .ptitle { flex: 1; min-width: 0; font-size: 14px; }

.player-ctrl { padding: 14px 14px calc(12px + var(--ui-safe-b)); }
.ctrl-row { gap: 6px; margin-top: 6px; }
.ctrl-row .btn {
  min-width: 42px; min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 17px;
}
.ctrl-row .btn:active { background: rgba(255, 255, 255, .14); }
.ctrl-row .time { font-size: 11.5px; white-space: nowrap; }

/* 进度条：加大触控热区 */
.progress { height: 26px; display: flex; align-items: center; }
.progress .track,
.progress .fill,
.progress .buff {
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 3px;
}
.progress .track::after {
  content: "";
  position: absolute; left: 0; right: 0; top: -11px; bottom: -11px;
}
.progress .fill { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.progress .fill::after {
  content: "";
  position: absolute; right: -7px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(79, 140, 255, .8);
}

/* 手机沉浸时隐藏顶部线路/选集条，改用抽屉 */
#playerOverlay.ph-immersive .line-switch,
#playerOverlay.ph-immersive .ep-float { display: none !important; }

/* 抽屉：线路 + 选集 */
.ph-drawer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  background: rgba(16, 20, 28, .97);
  backdrop-filter: blur(18px);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding: 8px 14px calc(16px + var(--ui-safe-b));
  transform: translateY(102%);
  transition: transform .3s var(--ui-ease);
  max-height: 62%;
  overflow-y: auto;
  color: var(--txt);
}
.ph-drawer.open { transform: none; }
.ph-drawer .ph-handle {
  width: 40px; height: 4px; border-radius: 3px;
  background: rgba(255, 255, 255, .28);
  margin: 2px auto 12px;
}
.ph-drawer .ph-sec { margin-bottom: 12px; }
.ph-drawer .ph-sec:last-child { margin-bottom: 0; }
.ph-drawer .ph-sec-t {
  font-size: 12px; color: var(--sub); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.ph-drawer .ph-sec-t::after { content: ""; flex: 1; height: 1px; background: rgba(255, 255, 255, .08); }
.ph-drawer .ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
}
.ph-drawer .line-switch { display: flex; flex-wrap: wrap; gap: 8px; max-width: none; }
.ph-drawer .line-chip,
.ph-drawer .ep-chip {
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, .08);
  min-height: 38px;
  display: inline-flex; align-items: center;
}
.ph-drawer .line-chip.active,
.ph-drawer .ep-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 600;
}
.ph-drawer .ep {
  min-height: 40px;
  font-size: 12.5px;
  border-radius: 9px;
}

/* 手势 HUD */
.ph-hud {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .16s;
  pointer-events: none;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.ph-hud.show { opacity: 1; }

/* 播放器中央大播放态 */
#playerOverlay .ph-bigplay {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 62px; height: 62px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .22);
  display: grid; place-items: center;
  color: #fff; font-size: 24px; z-index: 20;
  pointer-events: none;
  opacity: 0; transition: opacity .2s;
}
#playerOverlay.ph-paused .ph-bigplay { opacity: 1; }

/* 竖屏全屏时提示旋转 */
.ph-rotate-tip {
  position: absolute;
  right: 12px; top: 58px;
  z-index: 30;
  font-size: 11.5px;
  color: #cfd8e8;
  background: rgba(0, 0, 0, .5);
  padding: 6px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .12);
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.ph-rotate-tip.show { opacity: 1; }

/* 单手返回条（沉浸态） */
.ph-back {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  z-index: 46;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  display: none; place-items: center;
  font-size: 17px;
  backdrop-filter: blur(8px);
}
#playerOverlay.ph-immersive .ph-back { display: grid; }

/* 播放器骨架：进入时的柔和淡入，避免黑块突兀 */
#playerOverlay { animation: ph-fade .22s var(--ui-ease); }
@keyframes ph-fade { from { opacity: .5; } to { opacity: 1; } }

/* 空态/加载态质感提升 */
.loading, .empty { padding: 30px 16px; font-size: 13px; color: var(--sub); }

/* ================= 移动端控件行适配（窄屏不挤压） ================= */
@media (max-width: 900px) {
  #playerOverlay { margin-bottom: 10px; }
  .ctrl-row { gap: 4px; margin-top: 4px; }
  .ctrl-row .btn {
    min-width: 34px; min-height: 34px;
    font-size: 15px; padding: 0;
  }
  .ctrl-row .time { font-size: 11px; letter-spacing: 0; }
  /* 手机上画中画与横滑进度功能重叠，隐藏以腾出空间 */
  #btnPIP { display: none; }
  .player-top .ptitle { font-size: 12.5px; }
  .player-top .pclose {
    min-width: 34px; min-height: 34px;
    font-size: 15px;
  }
  #btnMini { display: none; }
  .player-ctrl .progress { height: 24px; }
}

/* 极窄屏（<=360px）进一步收敛 */
@media (max-width: 360px) {
  .ctrl-row .btn { min-width: 30px; min-height: 30px; font-size: 14px; }
  .ctrl-row .time { font-size: 10px; }
  #btnDanmaku { display: none; }
}

/* 横屏全屏：控件更紧凑，标题单行 */
@media (orientation: landscape) and (max-height: 520px) {
  .player-top { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
  .player-ctrl { padding: 10px 16px calc(8px + var(--ui-safe-b)); }
  .ctrl-row .btn { min-width: 38px; min-height: 38px; }
  .ph-drawer { max-height: 78%; }
  .ph-drawer .ep-grid { max-height: 52vh; }
  .ph-rotate-tip { display: none; }
}


/* ============================================================
   二期（P0）：全局滚动归一 + 详情页「播放/详情同屏」一体化
   ① 只保留 body 一个滚动容器，消除 main / .view / .detail-view 三层嵌套穿透
   ② 进详情页即是播放器位的封面大播放键，点选集后自动回位播放器
   ③ 线路由下拉框升级为横滑 chip
   ============================================================ */

/* ---------- ① 滚动归一 ---------- */
html { overflow-x: hidden; }
body { overflow-x: hidden; overscroll-behavior-y: contain; }
main { height: auto !important; min-height: calc(100dvh - var(--ui-edge)); }
.view {
  position: static !important;
  height: auto !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto;
}
.view.active { padding-bottom: calc(var(--ui-dock-h) + var(--ui-safe-b) + 18px); }
.detail-view {
  position: static !important;
  height: auto !important;
  min-height: calc(100dvh - var(--ui-edge));
  overflow: visible !important;
  box-sizing: border-box;
  padding-bottom: calc(var(--ui-safe-b) + 28px) !important;
}
/* 详情展开：隐藏列表视图与底部 Dock，避免叠影与误触 */
body.dv-open .view { display: none !important; }
body.dv-open header nav { display: none; }

/* ---------- ② 详情页一体化 ---------- */
#detailView { max-width: 880px; margin: 0 auto; width: 100%; }
#detailView .back-btn {
  position: sticky; top: 0; z-index: 16;
  align-self: flex-start; margin-bottom: 8px;
  background: rgba(11, 14, 20, .92); backdrop-filter: blur(10px);
}
#detailView #playerOverlay { margin-bottom: 12px; }

/* 封面态：未播放时占据播放器位，给出唯一主行动 */
.ph-cover {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  margin-bottom: 12px; border-radius: 12px; overflow: hidden;
  background: #000; border: 1px solid var(--ui-line); display: none;
}
.ph-cover.show { display: block; }
.ph-cover-bg { position: absolute; inset: 0; }
.ph-cover-bg img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); }
.ph-cover-mask { position: absolute; inset: 0; background: radial-gradient(95% 95% at 50% 38%, rgba(0,0,0,.16), rgba(0,0,0,.74)); }
.ph-cover-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px;
  background: rgba(20,24,32,.62); backdrop-filter: blur(10px);
  color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .3px; cursor: pointer;
  transition: transform .16s var(--ui-ease), background .16s var(--ui-ease);
}
.ph-cover-play:active { transform: translate(-50%, -50%) scale(.96); background: rgba(40,46,58,.78); }
.ph-cover-play .ico { font-size: 14px; color: var(--accent); }
.ph-cover-meta {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  font-size: 11.5px; color: rgba(255,255,255,.8);
  text-shadow: 0 1px 6px rgba(0,0,0,.75);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- ③ 线路 chip ---------- */
.ph-linechips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; margin: 2px 0 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ph-linechips::-webkit-scrollbar { display: none; }
.ph-lc {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--ui-line); background: var(--card2); color: var(--sub);
  font-size: 12.5px; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.ph-lc.active {
  color: #fff; border-color: transparent; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
#detailView .ep-grid .ep {
  min-height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
}

@media (max-width: 900px) {
  /* 顶部已是封面/播放器，海报不再重复占屏 */
  #detailView .detail-poster { display: none; }
  #detailView .detail-top { padding: 0; gap: 10px; }
  #detailView .detail-info { padding: 0; }
  #detailView .dname-row h2 { font-size: 17px; line-height: 1.35; }
  #detailView .detail-desc { font-size: 12.5px; line-height: 1.75; }
  .ph-cover { margin-bottom: 10px; }
}

/* ================= 三期修正：唯一滚动容器 / 首页宽度 / 直播 16:9 ================= */
/* 1) body 必须可滚动：二期误把 body 设为 overflow:hidden，导致超出首屏的内容被裁切 */
html {
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
body {
  height: auto !important;
  min-height: 100dvh;
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

/* 2) 首页容器撑满并居中，去掉自身滚动条（消除 main / .view / .home-wrap 多层滚动） */
#viewVod { align-items: stretch; }
.home-wrap {
  width: 100% !important;
  max-width: 760px;
  margin: 0 auto;
  overflow: visible !important;
}
.home-hero { width: 100% !important; }

/* 3) 直播播放器恢复 16:9：原 flex:1 会压过 aspect-ratio，窄屏下只有 110px 高 */
@media (max-width: 900px) {
  .live-player { flex: none; }
  .live-stage {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9;
    width: 100%;
  }
}

/* 4) 直播页容器撑满视口宽度（原布局在窄屏收缩到 348px，右侧留白） */
@media (max-width: 900px) {
  #viewLive { align-items: stretch; }
  .live-layout {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
  }
}

/* 5) 设置页检测源表格：窄屏收紧，避免右侧操作列贴边 */
@media (max-width: 600px) {
  .src-tbl { font-size: 11.5px; }
  .src-tbl th, .src-tbl td { padding: 6px 6px; }
  .src-tbl .mini-btn, .src-tbl button { padding: 4px 8px; font-size: 11.5px; }
  .set-card, .settings-card { padding-left: 12px; padding-right: 12px; }
}

/* ============================================================
   三期补：播放态选集横滑条（最后一段叠加；此后进入合并重构）
   ============================================================ */
.ep-strip { display: none; }

@media (max-width: 900px) {
  #detailView .ep-strip {
    display: none;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    padding: 8px 0;
    background: transparent;
    border-bottom: 1px solid var(--ui-line, rgba(255,255,255,.08));
  }
  #detailView .ep-strip.show { display: flex; }

  .ep-strip-list {
    display: flex;
    gap: 8px;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
  }
  .ep-strip-list::-webkit-scrollbar { display: none; }

  .ep-mini {
    flex: 0 0 auto;
    scroll-snap-align: center;
    min-width: 54px;
    height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    border: 1px solid var(--ui-line, rgba(255,255,255,.08));
    background: var(--card2, #161b24);
    color: var(--txt, #e6ebf5);
    font-size: 12.5px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
  .ep-mini.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
  }

  .ep-strip-more {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--ui-line, rgba(255,255,255,.08));
    background: var(--card2, #161b24);
    color: var(--sub, #9aa7bd);
    font-size: 12px;
  }
}


/* ===== 五期：播放体验增强（回滚删本段即可） ===== */

/* 画中画按钮恢复显示（原先移动端被隐藏，切后台无法悬浮） */
#btnPIP { display: inline-flex !important; align-items: center; justify-content: center; }

/* 控制栏「线路」按钮 */
#p5LineBtn { font-size: 12px; letter-spacing: .5px; }

/* 全屏：让 overlay 整体铺满，视频按 contain 居中，控制栏叠加在底部 */
#playerOverlay:fullscreen,
#playerOverlay:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  background: #000;
  display: flex;
  flex-direction: column;
}
#playerOverlay:fullscreen #playerVideoWrap,
#playerOverlay:-webkit-full-screen #playerVideoWrap {
  flex: 1 1 auto;
  height: auto;
  padding-top: 0;
  position: relative;
  background: #000;
}
#playerOverlay:fullscreen #playerVideo,
#playerOverlay:-webkit-full-screen #playerVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#playerOverlay:fullscreen #danmakuCanvas,
#playerOverlay:-webkit-full-screen #danmakuCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#playerOverlay:fullscreen .player-top,
#playerOverlay:-webkit-full-screen .player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  background: linear-gradient(rgba(0,0,0,.7), transparent);
}
#playerOverlay:fullscreen .player-ctrl,
#playerOverlay:-webkit-full-screen .player-ctrl {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 6;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
}
#playerOverlay:fullscreen .ph-bigplay,
#playerOverlay:fullscreen .ph-back,
#playerOverlay:fullscreen .ph-hud { z-index: 7; }

/* 集数更新信息：从标签区移到简介顶部 */
.p5-update {
  font-size: 12px;
  line-height: 1.6;
  color: var(--sub, #9aa0a6);
  margin: 0 0 6px;
}
/* 被去重隐藏的集数标签 */
.dtag[data-p5hide="1"] { display: none !important; }
