:root {
  --bg: #0b0b0f;
  --bg-card: #16161f;
  --bg-hover: #1f1f2b;
  --text: #eaeaf0;
  --text-dim: #9a9aa8;
  --accent: #e50914;
  --accent-hover: #f6121d;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }

/* ---- 顶部导航 ---- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 0 32px; height: 60px;
  background: linear-gradient(to bottom, rgba(11,11,15,.96), rgba(11,11,15,.82));
  backdrop-filter: blur(8px);
}
.brand { font-size: 20px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.nav-links { display: flex; gap: 22px; flex: 1; align-items: center; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: 15px; padding: 6px 2px; }
.nav-links a.active { color: var(--text); font-weight: 600; }
.nav-links a:hover { color: var(--text); }
.nav-drop-wrap { position: relative; display: flex; align-items: center; }
.nav-right { display: flex; align-items: center; gap: 12px; }
#search {
  background: var(--bg-card); border: 1px solid #2a2a38; color: var(--text);
  border-radius: 6px; padding: 7px 12px; width: 200px; font-size: 14px; outline: none;
}
#search:focus { border-color: #4a4a60; }
.btn-accent {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-accent:disabled { opacity: .5; cursor: default; }

.scan-bar {
  padding: 8px 32px; font-size: 13px; color: var(--text-dim);
  background: #14141c; border-bottom: 1px solid #22222e;
}

/* ---- 首页 ---- */
main { padding-bottom: 60px; }
.hero {
  position: relative; min-height: 52vh; max-height: 60vh;
  display: flex; align-items: flex-end;
  background-size: cover; background-position: center 20%;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 4%, rgba(11,11,15,.35) 55%, rgba(11,11,15,.25));
}
.hero-content { position: relative; z-index: 2; padding: 0 40px 40px; max-width: 640px; }
.hero-title { font-size: 40px; font-weight: 800; margin-bottom: 10px; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.hero-meta { color: var(--text-dim); font-size: 14px; margin-bottom: 14px; display: flex; gap: 14px; }
.hero-desc { color: #cfcfda; font-size: 15px; line-height: 1.6; margin-bottom: 20px; }
.hero-actions { display: flex; gap: 12px; }
.btn-play {
  background: #fff; color: #000; border: none; border-radius: 6px;
  padding: 11px 26px; font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn-play:hover { background: #e6e6e6; }
.btn-ghost {
  background: rgba(60,60,75,.6); color: #fff; border: none; border-radius: 6px;
  padding: 11px 22px; font-size: 16px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(80,80,100,.7); }

.row { margin: 26px 0 6px; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 32px; margin-bottom: 12px; }
.row-title { font-size: 19px; font-weight: 700; }
.row-scroller {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 32px 14px;
  scroll-behavior: smooth; scrollbar-width: none;
  /* 两端渐隐 */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent 100%);
}
.row-scroller::-webkit-scrollbar { display: none; }
.row-more { color: var(--accent); font-size: 13px; text-decoration: none; cursor: pointer; }
.row-more:hover { text-decoration: underline; }
/* 贴边渐隐三角箭头 */
.row { position: relative; }
.row-nav {
  position: absolute; top: 46px; bottom: 14px; width: 64px; z-index: 5;
  border: none; color: #fff; font-size: 44px; line-height: 1; font-family: sans-serif;
  display: flex; align-items: center; opacity: 0; transition: opacity .2s ease; cursor: pointer;
  text-shadow: 0 1px 6px rgba(0,0,0,.85);
}
.row:hover .row-nav, .row-nav:focus-visible { opacity: 1; }
.row-nav.left { left: 0; justify-content: flex-start; padding-left: 10px; background: linear-gradient(90deg, #0b0b10 8%, transparent 100%); }
.row-nav.right { right: 0; justify-content: flex-end; padding-right: 10px; background: linear-gradient(270deg, #0b0b10 8%, transparent 100%); }

/* ---- 卡片（全站统一：宽 210px · 2:3 竖版海报） ---- */
.card {
  position: relative; flex: 0 0 210px; min-width: 0; cursor: pointer;
  background: transparent; transition: transform .18s ease;
}
.card:hover { transform: translateY(-4px) scale(1.03); z-index: 2; }
.thumb-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #1c1c26; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  transition: box-shadow .18s ease;
}
.card:hover .thumb-wrap { box-shadow: 0 14px 34px rgba(0,0,0,.6); }
.thumb { aspect-ratio: 2/3; width: 100%; max-width: 100%; min-width: 0; object-fit: cover; display: block; background: #1c1c26; }
.card-title {
  padding: 8px 2px 0; font-size: 12.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-sub { padding: 1px 2px 0; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-track {
  position: absolute; left: 7px; right: 7px; bottom: 7px; height: 4px;
  background: rgba(255,255,255,.25); border-radius: 2px;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.badge {
  position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
}
.card.placeholder { display: flex; align-items: center; justify-content: center; color: #3a3a4a; font-size: 40px; }

/* ---- 网格页 ---- */
.page { padding: 26px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 26px; font-weight: 800; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, 210px); justify-content: start; gap: 16px 14px;
}
.grid .card { flex: none; }
/* 网格页小缩略图模式 */
.grid .card-title { font-size: 12px; padding: 6px 2px 0; }
.grid .card-sub { font-size: 11px; }
.grid .badge { font-size: 10px; padding: 1px 6px; top: 6px; left: 6px; }
.grid .thumb.placeholder { font-size: 26px; }

.root-err {
  color: #ff6b76; background: rgba(229, 9, 20, 0.1); border: 1px solid rgba(229, 9, 20, 0.35);
  border-radius: 6px; padding: 9px 14px; font-size: 13px; margin-bottom: 16px;
}

/* Alist 网盘面板 */
.panel-title { font-size: 17px; font-weight: 700; margin: 28px 0 12px; }
.alist-panel {
  background: var(--bg-card); border: 1px solid #23232f; border-radius: 10px;
  padding: 16px; margin-bottom: 22px;
}
.alist-status { color: var(--text-dim); font-size: 13px; margin: 10px 0 4px; }
.alist-panel .add-root input { min-width: 0; }

/* 在线观看下拉子菜单（动画滑出） */
.nav-drop-wrap { position: relative; }
#nav-online { color: var(--text-dim); text-decoration: none; font-size: 15px; padding: 6px 2px; cursor: pointer; }
#nav-online:hover { color: var(--text); }
.submenu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 60;
  min-width: 150px; padding: 6px;
  background: var(--bg-card); border: 1px solid #2a2a38; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  animation: subSlide .28s ease;
}
@keyframes subSlide {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
.submenu a {
  display: block; padding: 9px 14px; border-radius: 6px;
  color: var(--text-dim); text-decoration: none; font-size: 14px;
}
.submenu a:hover { color: var(--text); background: var(--bg-hover); }

/* 在线剧集展开的集列表 */
.online-eps { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.online-ep {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border: 1px solid #2a2a38; border-radius: 8px;
  background: var(--bg-card); color: var(--text); font-size: 13px;
  cursor: pointer; text-align: left; animation: subSlide .24s ease;
}
.online-ep:hover { border-color: var(--accent); background: var(--bg-hover); }

/* ---- 详情页 ---- */
.detail-hero {
  position: relative; min-height: 46vh; display: flex; align-items: flex-end;
  background-size: cover; background-position: center 20%;
}
.detail-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 6%, rgba(11,11,15,.4));
}
.detail-info { position: relative; z-index: 2; padding: 0 40px 34px; max-width: 700px; }
.detail-title { font-size: 34px; font-weight: 800; margin-bottom: 8px; }
.detail-meta { color: var(--text-dim); font-size: 14px; margin-bottom: 12px; display: flex; gap: 16px; flex-wrap: wrap; }
.detail-actions { margin-top: 18px; display: flex; gap: 12px; }
.season-block { padding: 20px 32px; }
.season-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.episode {
  display: flex; gap: 14px; padding: 10px; border-radius: var(--radius);
  cursor: pointer; background: var(--bg-card); margin-bottom: 10px;
}
.episode:hover { background: var(--bg-hover); }
.episode .thumb { width: 200px; flex: none; border-radius: 6px; aspect-ratio: 16/9; }

/* ---- 目录选择器 ---- */
.picker-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
}
.picker {
  width: 520px; max-width: 92vw; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid #2a2a38; border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6); overflow: hidden;
}
.picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; font-size: 15px; font-weight: 700; border-bottom: 1px solid #23232e;
}
.picker-x { background: none; border: none; color: var(--text-dim); font-size: 15px; cursor: pointer; }
.picker-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 0;
}
.picker-up {
  background: #23232e; color: var(--text); border: 1px solid #2a2a38;
  border-radius: 6px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.picker-cur {
  flex: 1; font-size: 12.5px; color: var(--text-dim); font-family: Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picker-jump { display: flex; gap: 8px; padding: 10px 18px; }
.picker-jump input {
  flex: 1; background: var(--bg); border: 1px solid #2a2a38; color: var(--text);
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px; outline: none;
}
.picker-jump button {
  background: #23232e; color: var(--text); border: 1px solid #2a2a38;
  border-radius: 6px; padding: 6px 14px; font-size: 12.5px; cursor: pointer;
}
.picker-body { flex: 1; overflow-y: auto; padding: 6px 10px; min-height: 200px; }
.picker-item {
  padding: 8px 12px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  color: var(--text);
}
.picker-item:hover { background: rgba(255,255,255,.07); }
.picker-file { color: #7fd1a0; }
.picker-file:hover { background: rgba(127,209,160,.12); }
.picker-hint { padding: 20px 12px; text-align: center; color: var(--text-dim); font-size: 13px; }

/* ---- 网盘目录多选 ---- */
.picker-row {
  display: flex; align-items: center; gap: 4px; border-radius: 8px;
}
.picker-row.on { background: rgba(99,179,237,.16); }
.picker-row .picker-item { flex: 1; min-width: 0; }
.picker-check {
  flex: none; width: 30px; height: 30px; border: none; border-radius: 6px;
  background: none; color: var(--text); font-size: 15px; line-height: 1; cursor: pointer;
}
.picker-check:hover { background: rgba(255,255,255,.07); }
.picker-root {
  background: #23232e; color: var(--text); border: 1px solid #2a2a38;
  border-radius: 6px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.picker-root:hover { background: #2f2f3e; }
.picker-picked {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0;
  max-height: 96px; overflow-y: auto;
}
.picker-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #23232e;
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-family: Consolas, monospace;
}
.picker-chip button { background: none; border: none; color: var(--text-dim); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
.picker-chip button:hover { color: var(--text); }
.picker-all {
  background: none; border: 1px solid #2a2a38; color: var(--text-dim);
  border-radius: 6px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.picker-all:hover { color: var(--text); }
.picker-foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px;
  border-top: 1px solid #23232e;
}
.picker-cancel {
  background: none; border: 1px solid #2a2a38; color: var(--text-dim);
  border-radius: 6px; padding: 7px 16px; font-size: 13px; cursor: pointer;
}
.picker-cancel:hover { color: var(--text); }
.ep-title { font-weight: 600; font-size: 15px; }
.ep-sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.back-link { display: inline-block; color: var(--text-dim); text-decoration: none; font-size: 14px; padding: 18px 32px 0; }
.back-link:hover { color: var(--text); }

/* ---- 媒体库 ---- */
.root-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px;
}
.root-path { font-size: 14px; }
.root-meta { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.root-actions { display: flex; gap: 10px; }
.btn-small {
  background: #2a2a38; color: var(--text); border: none; border-radius: 6px;
  padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.btn-small:hover { background: #35354a; }
.btn-danger { background: #3a1520; color: #ff6b76; }
.btn-danger:hover { background: #4d1b28; }
.add-root { display: flex; gap: 10px; margin-bottom: 22px; }
.add-root input { flex: 1; }
.empty-hint { color: var(--text-dim); padding: 60px 0; text-align: center; line-height: 2; }

/* ---- 播放器 ---- */
.player-page {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.player-top {
  display: flex; align-items: center; gap: 16px; padding: 14px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
}
.player-title { font-size: 17px; font-weight: 600; color: #fff; }
.player-back {
  background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 6px;
  padding: 8px 18px; font-size: 14px; cursor: pointer;
}
.player-back:hover { background: rgba(255,255,255,.22); }
video { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #000; outline: none; }

/* ---- 播放页字幕菜单（2026-09-19）---- */
.player-sub-wrap { position: relative; margin-left: auto; }
.cc-btn {
  background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; cursor: pointer;
}
.cc-btn:hover { background: rgba(255,255,255,.22); }
.cc-btn.dim { opacity: .55; }
.cc-btn.skip-now { color: #ffb020; border-color: #ffb020; font-weight: 600; }
.cc-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 230px; max-height: 300px; overflow-y: auto;
  background: rgba(24,24,30,.97); border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.45);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 50;
}
.cc-menu.hidden { display: none; }
.cc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; border: none; background: transparent;
  color: #e8e8ee; font-size: 13px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.cc-item:hover { background: rgba(255,255,255,.1); }
.cc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-check { color: #6db3ff; }
.cc-sep { height: 1px; background: rgba(255,255,255,.12); margin: 4px 6px; }
/* 底部操作行吸底常驻：候选字幕再多也不会把「选择字幕文件…」顶出可视区 */
.cc-foot {
  position: sticky; bottom: -6px; z-index: 2;
  display: flex; flex-direction: column; gap: 2px;
  background: rgba(24,24,30,.97); border-top: 1px solid rgba(255,255,255,.12);
  padding-top: 2px;
}
/* 轻提示 */
.hmp-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  background: rgba(20,20,26,.94); color: #f2f2f6;
  border: 1px solid rgba(255,255,255,.14); border-radius: 10px;
  padding: 10px 16px; font-size: 13.5px; line-height: 1.5;
  max-width: min(560px, 86vw); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 9999;
}
.hmp-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .topnav { padding: 0 14px; gap: 12px; }
  #search { width: 120px; }
  .row-scroller, .page, .season-block, .back-link { padding-left: 14px; padding-right: 14px; }
  .hero-content, .detail-info { padding-left: 14px; padding-right: 14px; }
  .hero-title { font-size: 28px; }
  .card { flex-basis: 160px; }
  .grid { grid-template-columns: repeat(auto-fill, 160px); }
  .episode .thumb { width: 130px; }
}


/* ---- TMDB 元数据（2026-09-18）---- */
.badge-rating {
  left: auto;
  right: 8px;
  background: rgba(20, 20, 26, 0.82);
  color: #ffd75e;
  font-weight: 500;
}
.detail-overview {
  margin-top: 10px;
  max-width: 560px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-dim, #9a9aa8);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- 电视直播 ---- */
.ltv-wrap { padding: 0 32px; }
.ltv-group { margin-top: 26px; }
.ltv-group-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ltv-count { font-size: 12px; font-weight: 500; color: var(--text-dim); background: var(--bg-card); border-radius: 10px; padding: 1px 8px; }
.ltv-channels { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ltv-ch {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-card); border: 1px solid #2a2a38; border-radius: 8px;
  padding: 8px 14px 8px 8px; cursor: pointer; color: var(--text); font-size: 14px;
}
.ltv-ch:hover { background: var(--bg-hover); border-color: #4a4a60; }
.ltv-logo { width: 34px; height: 34px; border-radius: 6px; object-fit: contain; background: #fff; flex: none; }
.ltv-logo-txt { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.ltv-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltv-live-dot { color: var(--accent); font-size: 10px; margin-left: 2px; animation: ltv-blink 1.6s infinite; }
.ltv-live-badge { color: var(--accent); font-size: 12px; margin-left: 10px; }
@keyframes ltv-blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---- 手动识别弹窗 ---- */
.idf { width: 620px; }
.idf .picker-body { padding: 8px 10px 12px; }
.idf-row {
  display: flex; gap: 12px; padding: 8px; border-radius: 10px; cursor: pointer;
  align-items: flex-start;
}
.idf-row:hover { background: rgba(255,255,255,.07); }
.idf-poster {
  width: 62px; height: 93px; flex: none; border-radius: 6px; object-fit: cover;
  background: #1a1a24; border: 1px solid #2a2a38;
}
.idf-noimg {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 12px;
}
.idf-meta { flex: 1; min-width: 0; }
.idf-title { font-size: 14px; font-weight: 600; color: var(--text); }
.idf-year, .idf-rate { font-weight: 400; font-size: 12.5px; color: var(--text-dim); }
.idf-orig { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.idf-ov {
  font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* 自定义海报区：贴链接 / 上传本地图 */
.idf-custom {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px 14px; border-top: 1px solid rgba(255,255,255,.08);
}
.idf-custom input {
  flex: 1; min-width: 0; background: rgba(255,255,255,.06); color: var(--text);
  border: 1px solid rgba(255,255,255,.14); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; outline: none;
}
.idf-custom input:focus { border-color: rgba(127,209,160,.6); }
.idf-custom button {
  background: rgba(80,80,100,.7); color: #fff; border: none; border-radius: 6px;
  padding: 8px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.idf-custom button:hover { background: rgba(100,100,125,.85); }
