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

:root {
  --bg: #0f1115;
  --bg-soft: #161922;
  --bg-card: #1c202b;
  --bg-hover: #262b3a;
  --border: #2a2f3d;
  --text: #e6e8ee;
  --text-dim: #9aa0b0;
  --accent: #ff4d4f;
  --accent-2: #ff8a5c;
  --green: #2fbf71;
  --blue: #4f8cff;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* 隐藏所有下载/保存按钮 */
.local-item-btn.save,
.task-btn.primary[data-save],
.batch-btn,
.ep-btn.download {
  display: none !important;
}

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #171a22, rgba(15,17,21,0.92));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.logo {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 9px;
  font-size: 15px; color: #fff;
  box-shadow: 0 4px 14px rgba(255,77,79,0.35);
}

.brand-name { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--text-dim); }

.search-wrap {
  flex: 1;
  display: flex;
  max-width: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  transition: border-color .2s;
}
.search-wrap:focus-within { border-color: var(--accent); }

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text);
}
.search-input::placeholder { color: var(--text-dim); }

.search-btn {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .2s;
}
.search-btn:hover { opacity: .85; }

.nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent-2); }

/* ---------- 类型 Tab ---------- */
.typebar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 61px;
  z-index: 90;
}

.type-tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.type-tabs::-webkit-scrollbar { display: none; }

.type-tab {
  padding: 13px 22px;
  font-size: 15px;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .2s;
  position: relative;
}
.type-tab:hover { color: var(--text); }
.type-tab.active { color: var(--accent-2); font-weight: 600; border-bottom-color: var(--accent-2); }

/* ---------- 筛选栏 ---------- */
.filterbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px 6px;
}

.filter-row { display: flex; flex-direction: column; gap: 8px; }

.filter-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.filter-label {
  width: 40px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 6px;
}

.chip-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.chip-group::-webkit-scrollbar { display: none; }

.chip {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.chip:hover { color: var(--text); background: var(--bg-hover); }
.chip.active {
  background: rgba(255,77,79,0.15);
  color: var(--accent-2);
  border-color: rgba(255,77,79,0.5);
}

/* ---------- 结果统计 ---------- */
.result-info {
  max-width: 1200px;
  margin: 8px auto 0;
  padding: 0 20px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 影片网格 ---------- */
.movie-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
}

.movie-card {
  cursor: pointer;
  transition: transform .2s;
}
.movie-card:hover { transform: translateY(-4px); }

.movie-poster {
  position: relative;
  aspect-ratio: 3/4;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}
.movie-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.movie-card:hover .movie-poster img { transform: scale(1.05); }

.movie-label {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(255,77,79,0.85);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.movie-score {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(0,0,0,0.55);
  color: #ffd54f;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 8px;
}

.movie-name {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-meta {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 加载 ---------- */
.load-more {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 13px;
}
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-dim);
}
.empty-icon { font-size: 60px; margin-bottom: 16px; opacity: .6; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 1000; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s;
}

.modal-panel {
  position: absolute;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
  animation: slideUp .25s ease;
}

.detail-panel {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}

.player-panel {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, 96vw);
}

.local-panel {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  padding: 24px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  transition: all .2s;
}
.modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

/* ---------- 详情 ---------- */
.detail-content { padding: 24px; }

.detail-head {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-poster {
  width: 140px; flex-shrink: 0;
  aspect-ratio: 3/4;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}
.detail-poster img { width: 100%; height: 100%; object-fit: cover; }

.detail-info { flex: 1; min-width: 0; }

.detail-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.detail-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-dim);
}

.detail-meta { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.detail-meta b { color: var(--text); font-weight: 500; }

.detail-blurb {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  max-height: 4.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 18px 0 10px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 4px; height: 14px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

/* 播放源 */
/* 播放源/选集 横向滚动 */
.source-scroll-wrap,
.episode-scroll-wrap {
  position: relative;
  margin-bottom: 12px;
}

.source-scroll,
.episode-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.source-scroll::-webkit-scrollbar,
.episode-scroll::-webkit-scrollbar { display: none; }

.source-scroll.expanded,
.episode-scroll.expanded {
  flex-wrap: wrap;
  overflow-x: visible;
}

.source-chip {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.source-chip:hover { background: var(--bg-hover); border-color: var(--accent); }
.source-chip.active { border-color: var(--accent); background: rgba(255,77,79,0.15); }
.source-chip-name { font-size: 13px; font-weight: 500; white-space: nowrap; }
.source-chip-count { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.episode-chip {
  flex-shrink: 0;
  min-width: 70px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.episode-chip:hover { background: var(--bg-hover); border-color: var(--accent-2); }
.episode-chip.selected { border-color: var(--green); background: rgba(47,191,113,0.15); }
.episode-chip .episode-name { font-size: 13px; white-space: nowrap; }
.episode-chip .episode-check { font-size: 12px; color: var(--green); }
.episode-chip .episode-done { font-size: 10px; color: var(--green); }

.expand-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 4px;
  padding: 0 12px;
  background: linear-gradient(90deg, transparent, var(--bg) 40%);
  border: none;
  color: var(--accent-2);
  font-size: 13px;
  cursor: pointer;
  z-index: 2;
}

/* 旧样式保留（兼容） */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all .15s;
}
.source-card:hover { background: var(--bg-hover); border-color: var(--accent); }
.source-card.active { border-color: var(--accent); background: rgba(255,77,79,0.1); }

.source-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.source-meta { font-size: 11px; color: var(--text-dim); }
.source-meta .count { color: var(--green); margin-right: 6px; }

/* 选集 */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}

.episode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.episode-card:hover { background: var(--bg-hover); border-color: var(--accent-2); }

.episode-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.episode-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.ep-btn {
  flex: 1;
  font-size: 11px;
  padding: 4px 0;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  color: #fff;
  transition: opacity .15s;
}
.ep-btn:hover { opacity: .8; }
.ep-btn.play { background: var(--accent); }
.ep-btn.copy { background: var(--blue); }
.ep-btn.download { background: var(--green); }

/* ---------- 批量下载 ---------- */
.episode-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.batch-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.batch-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.batch-btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.batch-btn.primary:hover { opacity: .88; }
.batch-bar { display: inline-flex; gap: 8px; align-items: center; }

.episode-card.batch {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 10px;
}
.episode-card.batch .episode-name { flex: 1; }
.episode-card.batch.selected {
  background: rgba(79, 140, 255, .18);
  border-color: var(--blue);
}
.episode-check {
  width: 18px; height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--text-dim);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff;
  background: transparent;
}
.episode-card.selected .episode-check { background: var(--blue); border-color: var(--blue); }
.episode-done {
  font-size: 11px;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 9px;
  padding: 1px 6px;
  flex-shrink: 0;
  opacity: .9;
}

/* ---------- 播放器 ---------- */
.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 48px 6px 16px;
}
.player-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 100px);
}
.player-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 0 0 16px 16px;
}
.player-msg {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- 本地 ---------- */
.local-title { font-size: 18px; margin-bottom: 12px; }

.local-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.local-tab {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  padding: 7px 18px;
  border-radius: 18px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.local-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.local-tip {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.pick-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 9px 20px;
  font-size: 13px;
  cursor: pointer;
}
.pick-btn:hover { opacity: .85; }

.local-list { display: flex; flex-direction: column; gap: 8px; }

.local-group-title {
  font-size: 12px;
  color: var(--text-dim);
  margin: 10px 2px 2px;
}
.local-group-title:first-child { margin-top: 0; }

.local-group { margin-bottom: 6px; }
.local-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all .15s;
}
.local-group-head:hover { border-color: var(--accent-2); }
.local-group-head.open { border-color: var(--accent-2); background: var(--bg-hover); }
.local-group-name { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.local-group-count { font-size: 11px; color: var(--text-dim); }
.local-group-arrow { font-size: 12px; color: var(--text-dim); transition: transform .15s; }
.local-group-head.open .local-group-arrow { transform: rotate(90deg); }
.local-group-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.local-group-body.hidden { display: none; }

.local-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.local-item-icon {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #6db3ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.local-item-info { flex: 1; min-width: 0; }
.local-item-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.local-item-size { font-size: 11px; color: var(--text-dim); }

.local-item-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.3s;
}
.progress-text {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.local-item-btn {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  color: #fff;
}
.local-item-btn.play { background: var(--accent); }
.local-item-btn.save {
  background: linear-gradient(135deg, var(--green), #45d98b);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(47, 191, 113, .4);
}
.local-item-btn.delete { background: var(--bg-hover); color: var(--text-dim); border: 1px solid var(--border); }

.local-empty { text-align: center; padding: 30px; color: var(--text-dim); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(30,33,43,0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 22px;
  font-size: 13px;
  z-index: 2000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: toastIn .25s ease;
  max-width: 80vw;
  word-break: break-all;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4152; }

/* ---------- 下载任务面板 ---------- */
.task-panel {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(680px, 94vw);
  max-height: 84vh;
  overflow-y: auto;
  padding: 24px;
}
.task-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.task-title { margin: 0; font-size: 18px; }
.task-tip { font-size: 12px; color: var(--text-dim, #889); margin-bottom: 16px; }
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-empty { text-align: center; color: var(--text-dim, #889); padding: 30px 0; font-size: 13px; }
.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.task-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 13px; font-weight: 600; word-break: break-all; margin-bottom: 4px; }
.task-status { font-size: 12px; margin-bottom: 4px; }
.task-status.downloading, .task-status.pending, .task-status.processing { color: var(--accent-2, #7aa2ff); }
.task-status.completed { color: #5cd08a; }
.task-status.failed { color: #e56262; }
.task-status.canceled { color: var(--text-dim, #889); }
.task-log { font-size: 11px; color: var(--text-dim, #889); word-break: break-all; max-height: 32px; overflow: hidden; }
.task-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.task-btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.task-btn:hover { border-color: var(--accent); color: var(--accent-2); }
.task-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-btn.primary:hover { opacity: .88; color: #fff; }
.task-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.task-bar { flex: 1; height: 6px; background: var(--bg-soft); border-radius: 3px; overflow: hidden; }
.task-bar-inner { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2, #7aa2ff)); border-radius: 3px; transition: width .3s; }
.task-pct { font-size: 11px; color: var(--text-dim, #889); white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
  .brand { flex: 1; min-width: 0; }
  .brand-name { font-size: 16px; }
  .brand-sub { display: none; }
  .nav-btn { padding: 8px 14px; font-size: 12px; }
  .search-wrap { order: 3; max-width: none; width: 100%; }
  .search-btn { padding: 10px 16px; }
  .typebar { top: 0; }
  .movie-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .detail-head { flex-direction: column; align-items: stretch; }
  .detail-poster { width: 100%; max-width: 200px; margin: 0 auto 12px; aspect-ratio: 3/4; border-radius: 12px; }
  .detail-poster img { border-radius: 12px; }
  .detail-info { text-align: center; }
  .detail-tags { justify-content: center; }
  .detail-title { font-size: 18px; text-align: center; }
  .detail-blurb { text-align: left; -webkit-line-clamp: 4; }
}
/* ---------- 详情页（播放页面） ---------- */
.detail-page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}
.detail-page.hidden { display: none; }

.detail-player-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.detail-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

.detail-player-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-player-close {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}

.detail-player-wrap {
  position: relative;
  padding-top: 56.25%;
  background: #000;
}

.detail-video {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 100%;
}

/* 视频覆盖按钮（上一集/下一集）*/
.video-overlay-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.8);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: all .2s;
  z-index: 100;
  opacity: 0;
}
.detail-player-wrap:hover .video-overlay-btn { opacity: 1; }
.video-overlay-btn:hover { background: rgba(255,77,79,0.8); border-color: var(--accent); }
.video-prev-btn { left: 16px; }
.video-next-btn { right: 16px; }

/* 全屏时显示按钮 */
.detail-player-wrap.is-fullscreen .video-overlay-btn { opacity: 1; z-index: 9999; }
.detail-player-wrap.is-fullscreen .skip-tip { opacity: 1; z-index: 9999; }
.detail-player-wrap.is-fullscreen .detail-player-msg { z-index: 9999; }

/* 跳过片头片尾提示 */
.skip-tip {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,77,79,0.85);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10;
  transition: opacity .3s;
}

.detail-player-msg {
  position: absolute;
  bottom: 8px;
  left: 16px;
  color: var(--text-dim);
  font-size: 12px;
}

/* 播放器控制栏（源/集 横向滚动） */
.player-controls-bar {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 6px 0;
}
.player-controls-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}
.player-controls-label {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 20px;
}
.player-source-scroll,
.player-episode-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.player-source-scroll::-webkit-scrollbar,
.player-episode-scroll::-webkit-scrollbar { display: none; }
.player-source-scroll[style*="flex-wrap: wrap"],
.player-episode-scroll[style*="flex-wrap: wrap"] {
  flex-wrap: wrap !important;
  overflow-x: hidden;
}

.pctrl-chip {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.pctrl-chip:hover { background: var(--bg-hover); color: var(--text); }
.pctrl-chip.active { background: rgba(255,77,79,0.15); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pctrl-empty { font-size: 12px; color: var(--text-dim); padding: 4px 0; }
.pctrl-expand-btn {
  flex-shrink: 0; padding: 5px 12px; border-radius: 14px; background: transparent;
  border: 1px solid var(--accent); color: var(--accent); font-size: 12px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.pctrl-expand-btn:hover { background: rgba(255,77,79,0.1); }

.expand-btn-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-left: 6px;
}

.player-ep-bar { border-top: none; padding-top: 0; }

/* 跳过片头片尾设置 */
.skip-settings-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.skip-settings-label {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.skip-settings-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.skip-settings-inputs label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.skip-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 12px;
  text-align: center;
}
.skip-input:focus { border-color: var(--accent); outline: none; }
.skip-save-btn {
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  transition: opacity .15s;
}
.skip-save-btn:hover { opacity: 0.85; }

/* 上一集/下一集按钮 */
.player-nav-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.player-nav-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.player-nav-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.detail-content-wrap {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-content-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

@media (max-width: 600px) {
  .detail-content-inner { padding: 12px 16px 60px; }
  .detail-player-title { font-size: 14px; }
}

/* ---------- 搜索历史下拉 ---------- */
.search-wrap { position: relative; }
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
}
.search-dropdown-item {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.search-dropdown-item:hover { background: var(--bg-hover); }
.search-dropdown-clear {
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  font-size: 12px;
  text-align: center;
}

/* ---------- 继续观看 ---------- */
.play-history-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 0;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.play-history-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.play-history-grid::-webkit-scrollbar { height: 4px; }
.play-history-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.play-history-card {
  flex-shrink: 0;
  width: 180px;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.play-history-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.play-history-thumb {
  width: 100%;
  height: 100px;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.play-history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play-history-placeholder { font-size: 28px; color: var(--text-dim); }
.play-history-info { padding: 8px 10px; }
.play-history-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.play-history-progress { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.play-history-bar {
  height: 3px;
  background: var(--bg-soft);
  border-radius: 2px;
  overflow: hidden;
}
.play-history-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}

@media (max-width: 600px) {
  .play-history-card { width: 150px; }
  .play-history-thumb { height: 80px; }
}

/* ---------- 顶部导航按钮 ---------- */
.nav-actions { display: flex; gap: 8px; margin-left: 12px; flex-shrink: 0; }
.nav-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.nav-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 播放历史全屏页 ---------- */
.history-page {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.history-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.history-page-title { font-size: 18px; font-weight: 600; flex: 1; text-align: center; }
.history-back-btn, .history-clear-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
}
.history-back-btn:hover, .history-clear-btn:hover { background: var(--bg-hover); }
.history-clear-btn { color: var(--text-dim); }
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px;
}
.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}
.history-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.history-card:hover { background: var(--bg-hover); }
.history-card-thumb {
  width: 120px;
  height: 80px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-placeholder { font-size: 24px; color: var(--text-dim); }
.history-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.history-card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-card-progress { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.history-card-bar {
  height: 4px;
  background: var(--bg-soft);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.history-card-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
}
.history-card-time { font-size: 11px; color: var(--text-dim); }
@media (max-width: 600px) {
  .history-card-thumb { width: 90px; height: 60px; }
  .history-card-title { font-size: 13px; }
}
