/* ====== Netflix 风格深色主题 ====== */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* UKIJ Es Bold 字体(维文优先, 中文回退雅黑) */
@font-face {
  font-family: 'UKIJEs';
  src: url('/fonts/UKIJEsBold.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #141414;          /* Netflix 主黑 */
  --card: #181818;
  --card2: #242424;
  --line: #2f2f2f;
  --text: #f5f5f5;
  --muted: #a1a1a1;
  --accent: #e50914;      /* Netflix 红 */
  --accent2: #f6121d;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "UKIJEs", "Microsoft YaHei", "PingFang SC", sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card2);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  transition: all .15s;
}
button:hover { border-color: var(--accent); color: #fff; background: #2c2c2c; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; }
button.primary:hover { background: var(--accent2); }
button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; }
button.proxy { border-color: var(--accent); color: var(--accent); background: transparent; }
button.proxy:hover { background: rgba(229,9,20,.12); }
.spacer { flex: 1; }

/* ====== 顶栏 ====== */
.topbar {
  background: linear-gradient(180deg, #0b0b0b 0%, #141414 100%);
  border-bottom: 1px solid var(--line); padding: 14px 0 0;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 16px;
}
.logo { font-size: 22px; font-weight: 900; white-space: nowrap; color: var(--accent); letter-spacing: 1px; }
.search-box { flex: 1; max-width: 480px; margin: 0 auto; display: flex; gap: 8px; }
.search-box input {
  flex: 1; background: #0b0b0b; border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 14px; color: var(--text); font-size: 14px; outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box #searchBtn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: bold; }
.vod-title { font-size: 18px; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-back { white-space: nowrap; }

/* 站点切换: 永远一排, 左右滑动(手机/电脑一致) */
.site-bar {
  max-width: 1200px; margin: 12px auto 0; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
}
.site-label { color: var(--muted); font-size: 13px; white-space: nowrap; flex: 0 0 auto; }
.site-btns {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none; -ms-overflow-style: none;
  padding: 2px 0 4px;
}
.site-btns::-webkit-scrollbar { display: none; height: 0; }
.site-btns button {
  flex: 0 0 auto; white-space: nowrap; padding: 6px 13px;
  font-size: 13px; border-radius: 999px;
}
.site-btns .loading { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* 分类: 同样一排横滑 */
.cat-bar {
  max-width: 1200px; margin: 8px auto 0; padding: 0 16px 10px;
  display: flex; flex-wrap: nowrap; gap: 8px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none; -ms-overflow-style: none;
}
.cat-bar::-webkit-scrollbar { display: none; height: 0; }
.cat-bar button {
  flex: 0 0 auto; white-space: nowrap; padding: 5px 13px;
  font-size: 13px; border-radius: 999px; background: transparent;
}
.cat-bar button.active { background: var(--accent); }
.cat-bar .loading { color: var(--muted); font-size: 13px; white-space: nowrap; padding: 6px 0; }

/* ====== 列表 ====== */
.main { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; cursor: pointer; transition: transform .18s, border-color .18s;
}
.card:hover { transform: scale(1.04); border-color: var(--accent); }
.card .pic { position: relative; aspect-ratio: 2/3; background: var(--card2); }
.card .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .name {
  padding: 10px 10px 4px; font-size: 14px; font-weight: bold;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  direction: rtl; text-align: right;
}
.card .remarks {
  padding: 0 10px 10px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  direction: rtl; text-align: right;
}
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* 翻页: 下面不留大片空白 */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 18px 0 6px; margin-bottom: 0; }
#pageInfo { color: var(--muted); font-size: 14px; }
.pager button { font-size: 15px; padding: 9px 22px; }

/* ====== 播放页 ====== */
.player-main { max-width: 1000px; margin: 0 auto; padding: 18px 16px 6px; }
/* 播放器宽度保持现状; 下方黑色区域不带 box-shadow */
.video-wrap {
  position: relative;
  background: #000; border-radius: 10px; overflow: hidden;
  box-shadow: none;
}
.video-wrap video { width: 100%; aspect-ratio: 16/9; display: block; background: #000; }
/* DPlayer 容器 */
#dplayer { width: 100%; aspect-ratio: 16/9; background: #000; }
#dplayer .dplayer-video { width: 100%; height: 100%; }
/* 播放地址解析中的占位层 */
.p-loading {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: #000; color: #9a9a9a; font-size: 14px; letter-spacing: .5px;
}
.p-loading::before {
  content: ''; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #333; border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.p-loading.hide { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.info-card {
  background: #101010; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-top: 14px; box-shadow: none;
}
.info-row { display: flex; gap: 16px; }
.info-pic { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: var(--card2); flex-shrink: 0; }
.info-text { flex: 1; min-width: 0; }
.info-text h2 { font-size: 18px; margin-bottom: 6px; }
.remarks { color: var(--accent); font-size: 13px; margin-bottom: 8px; }
.content { color: var(--muted); font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.copy-btns { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.copy-btn { padding: 8px 12px; font-size: 13px; flex: 1 1 auto; min-width: 110px; }

.ep-card {
  background: #101010; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 16px; margin-top: 14px; box-shadow: none;
}
.ep-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ep-head h3 { font-size: 15px; font-weight: bold; white-space: nowrap; }
.ep-head button { padding: 5px 12px; font-size: 13px; flex-shrink: 0; }
/* 地址复制操作: 固定排在标题下面一行, 统一尺寸, 永远不用往下翻 */
.ep-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.ep-toolbar button { flex: 1 1 auto; min-width: 120px; padding: 9px 12px; font-size: 13px; }

.play-group { margin-bottom: 14px; }
.play-group .group-name { color: var(--accent); font-size: 14px; font-weight: bold; margin-bottom: 8px; }
/* 集按钮: 一排多个, 自动换行; 集数上千时限高内部滚动, 免得把下面的信息区顶到天边 */
.ep-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 46vh; overflow-y: auto;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  padding-right: 2px;
}
.ep-list::-webkit-scrollbar { width: 6px; }
.ep-list::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 3px; }
.ep-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 10px;
  transition: border-color .15s;
}
.ep-item:hover { border-color: var(--accent); }
.ep-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.ep-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer; font-size: 13px; direction: rtl; text-align: right;
}
.ep-name:hover { color: var(--accent); }
.ep-copy { padding: 3px 8px; font-size: 12px; flex-shrink: 0; border-radius: 4px; }

.ep-item.unresolved { opacity: .5; }
.ep-item.unresolved .ep-name { cursor: not-allowed; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 2px 0 12px; }

/* 点卡片后的即时反馈条(打开播放页瞬间就有动静) */
#navBar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--accent); z-index: 200;
  transition: width .6s ease;
  box-shadow: 0 0 8px rgba(229,9,20,.7);
}
#navBar.on { width: 88%; }

/* 提示浮层 */
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-weight: bold;
  padding: 10px 22px; border-radius: 999px; font-size: 14px;
  z-index: 99;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 0 12px; }
  .logo { font-size: 18px; }
  .search-box { order: 3; max-width: 100%; flex-basis: 100%; margin: 0; }
  .site-bar { margin-top: 10px; padding: 0 12px; }
  .cat-bar { padding: 0 12px 10px; }
  /* 列表: 一排两个 */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .name { font-size: 13px; padding: 8px 8px 3px; }
  .card .remarks { font-size: 11px; padding: 0 8px 8px; }
  .main { padding: 14px 12px 0; }
  .info-row { flex-direction: column; }
  .info-pic { width: 96px; }
  .ep-list { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
  .ep-item { padding: 7px 8px; gap: 6px; }
  .ep-name { font-size: 12px; }
  .ep-copy { padding: 3px 7px; font-size: 11px; }
  .ep-toolbar button { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .copy-btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .pager { padding: 16px 0 4px; gap: 10px; }
  .pager button { flex: 1 1 0; padding: 9px 8px; font-size: 14px; }
  .foot { display: none; }
  .player-main { padding: 12px 12px 4px; }
}
