:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card2: #22262f;
  --text: #e6e8ee;
  --muted: #9aa0ac;
  --accent: #4f8cff;
  --accent2: #6aa1ff;
  --border: #2a2f3a;
  --danger: #ff5b5b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px; background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  width: 100%; box-sizing: border-box;
}
.topbar-inner {
  display: flex; align-items: center; gap: 20px;
  max-width: 1200px; margin: 0 auto; width: 100%;
}
.brand { font-weight: 700; font-size: 18px; white-space: nowrap; }
.tabs { display: flex; gap: 6px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-right .top-btn { background: var(--card2); color: var(--text); border: 1px solid var(--border); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.top-right .top-btn:hover { border-color: var(--accent); color: var(--accent2); }
.top-right .top-btn.active { background: var(--card2); color: var(--accent2); font-weight: 600; }
.tab {
  background: transparent; border: none; color: var(--muted);
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.tab.active { background: var(--card2); color: var(--accent2); font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.view { display: none; }
.view.active { display: block; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .ghost { margin-left: auto; margin-bottom: 0; }
.search-options { margin-top: -8px; }
.chk-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.chk-opt input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent, #4f8cff); }
.chk-opt input[type="checkbox"]:disabled + * { opacity: .7; }
.res-title { flex: 1; min-width: 200px; font-size: 14px; word-break: break-all; }
.res-sub { color: var(--muted); font-size: 12px; }
.seg { display: flex; background: var(--card); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 7px 16px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }
input, select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 8px; font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
#search-input { flex: 1; min-width: 200px; }
button.primary { background: var(--accent); border: none; color: #fff; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; }
button.primary:hover { background: var(--accent2); }
button.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); padding: 6px 14px; border-radius: 8px; cursor: pointer; margin-bottom: 16px; }

/* 搜索页面增强 */
.search-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 300px; }
.search-box .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
.search-box input { width: 100%; padding: 12px 44px 12px 44px; font-size: 15px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15); }
.search-box input::placeholder { color: var(--muted); }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.search-clear:hover { color: var(--text); background: var(--card2); }
.search-actions { display: flex; gap: 8px; align-items: center; }
.search-options-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.search-filters { display: flex; gap: 8px; margin-left: auto; }
.search-filters select { padding: 6px 10px; background: var(--card2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; min-width: 130px; }
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; max-height: 300px; overflow-y: auto; z-index: 20; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.search-suggestions.active { display: block; }
.search-suggestion-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover, .search-suggestion-item.active { background: var(--card2); }
.search-suggestion-item .suggestion-icon { font-size: 16px; opacity: 0.7; flex-shrink: 0; }
.search-suggestion-item .suggestion-main { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-suggestion-item .suggestion-meta { font-size: 12px; color: var(--muted); }

/* 资源列表卡片增强 - 搜索结果与详情页统一 */
.res-list-container { max-height: none; overflow: visible; }
.res-list-container::-webkit-scrollbar { width: 8px; }
.res-list-container::-webkit-scrollbar-track { background: var(--card); border-radius: 4px; }
.res-list-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.res-list-container::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.res-list { display: flex; flex-direction: column; gap: 6px; }
.res-group { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px dashed var(--border); border-radius: 8px; }
.res-group-more { align-self: center; margin-top: 2px; }

/* 剧集磁力：按质量分主类，类下分子类 */
.tv-quality-block, .quality-block { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.tv-quality-head, .quality-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card2); font-size: 14px; font-weight: 600; }
.tv-quality-title, .quality-title { color: var(--accent2); }
.tv-quality-count, .quality-count { font-size: 12px; color: var(--muted); font-weight: 400; }
.tv-season-block { margin-bottom: 14px; }
.tv-season-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px 10px 0 0; font-size: 15px; font-weight: 700; margin-bottom: 8px; cursor: pointer; user-select: none; }
.tv-season-head:hover { background: var(--card); }
.tv-season-head.collapsed { border-radius: 10px; margin-bottom: 0; }
.tv-season-toggle { font-size: 12px; color: var(--muted); transition: transform 0.15s; }
.tv-season-head.collapsed .tv-season-toggle { transform: rotate(-90deg); }
.tv-season-title { color: var(--text); }
.tv-season-count { font-size: 12px; color: var(--muted); font-weight: 400; }
.tv-season-block .tv-quality-block, .tv-season-block .quality-block { margin-bottom: 8px; }
.tv-season-block .tv-quality-block:last-child, .tv-season-block .quality-block:last-child { margin-bottom: 0; }
.tv-sub-block { padding: 8px 12px; border-top: 1px solid var(--border); }
.tv-sub-block:first-child { border-top: none; }
.tv-sub-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; cursor: pointer; user-select: none; }
.tv-sub-head:hover .tv-sub-title { color: var(--text); }
.tv-sub-toggle { font-size: 11px; color: var(--muted); transition: transform 0.15s; }
.tv-sub-head.collapsed .tv-sub-toggle { transform: rotate(-90deg); }
.tv-sub-head.collapsed { margin-bottom: 0; }
.tv-sub-title { font-size: 12px; color: var(--muted); font-weight: 600; }
.tv-sub-count { font-size: 11px; color: var(--muted); }
.tv-sub-block .res-group-inner { display: flex; flex-direction: column; gap: 6px; }
.tv-season-block .tv-sub-block .tv-quality-block { border: none; border-radius: 0; margin-bottom: 0; padding: 4px 0; border-top: 1px dashed var(--border); }
.tv-season-block .tv-sub-block .tv-quality-block:first-of-type { border-top: none; }
.tv-season-block .tv-sub-block .tv-quality-head { background: transparent; padding: 4px 0; font-size: 13px; }
.tv-season-block .tv-sub-block .tv-quality-title { color: var(--accent2); }
.res-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 0; display: flex; align-items: center; gap: 12px; transition: border-color 0.15s, box-shadow 0.15s; }
.res-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(79, 140, 255, 0.1); }
.res-card .name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; word-break: break-word; }
.res-card .meta { flex-shrink: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; flex-wrap: wrap; white-space: nowrap; }
.res-card .size { color: var(--muted); white-space: nowrap; }
.res-card .quality { color: var(--accent); white-space: nowrap; font-weight: 500; }
.res-card .pass { color: var(--accent2); white-space: nowrap; font-weight: 600; }
.res-card .site { color: var(--accent2); white-space: nowrap; }
.res-actions { display: flex; gap: 6px; flex-shrink: 0; }
.res-actions .res-btn { text-align: center; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.res-btn { background: var(--card2); border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.15s; white-space: nowrap; }
.res-btn:hover { border-color: var(--accent); color: var(--accent2); }
.res-open { border-color: var(--accent); color: var(--accent2); }
.res-actions .res-open { text-decoration: none; color: var(--accent2); font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--accent); background: transparent; transition: all 0.15s; white-space: nowrap; }
.res-actions .res-open:hover { background: var(--accent); color: #fff; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.media-card { background: var(--card); border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform .15s; position: relative; }
.media-card:hover { transform: translateY(-3px); }
.poster-wrap { position: relative; }
.media-card .poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--card2); display: block; }
.type-tag { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.65); color: var(--accent2); font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 6px; backdrop-filter: blur(2px); }
.rating { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.65); color: #ffd166; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 6px; backdrop-filter: blur(2px); }
.res-search-btn { position: absolute; bottom: 6px; left: 6px; background: rgba(79, 140, 255, 0.9); color: #fff; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; border: none; cursor: pointer; white-space: nowrap; opacity: 0; transition: opacity .15s; z-index: 2; }
.media-card:hover .res-search-btn { opacity: 1; }
.res-search-btn:hover { background: var(--accent2); }
.media-card .info { padding: 10px 12px; }
.media-card .title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.media-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }
.badge { background: var(--card2); color: var(--accent2); font-size: 11px; padding: 1px 7px; border-radius: 6px; }
.rcount { color: var(--accent); font-size: 11px; padding: 1px 7px; background: var(--card2); border-radius: 6px; }
.media-card .sub .unreleased { color: #f59e0b; font-size: 11px; font-weight: 600; white-space: nowrap; }
.media-card .sub .res-search-btn { position: static; opacity: 1; background: var(--accent2); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.media-card .sub .res-search-btn:hover { background: var(--accent); }

/* 详情 */
.detail-head { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-poster { width: 200px; border-radius: 12px; aspect-ratio: 2/3; object-fit: cover; background: var(--card2); }
.detail-info { flex: 1; min-width: 260px; }
.detail-info h1 { font-size: 24px; margin-bottom: 6px; }
.detail-lang { display: inline-block; font-size: 13px; font-weight: 500; color: var(--accent2); background: var(--card2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 4px; margin-left: 8px; vertical-align: middle; }
.detail-meta { color: var(--muted); font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.detail-meta-ext { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.detail-meta-ext .release-date { color: var(--muted); }
.detail-meta-ext .genres { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-meta-ext .genre-tag { background: var(--card2); color: var(--accent2); font-size: 11px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.detail-meta-ext .runtime { color: var(--muted); background: var(--card2); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.detail-meta-ext .status { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.detail-meta-ext .status.released { background: rgba(34, 197, 94, 0.15); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.3); }
.detail-meta-ext .status.unreleased { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }

/* 详情页所属合集 */
.detail-collection { margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.detail-collection .collection-link { color: var(--accent2); text-decoration: none; font-weight: 500; }
.detail-collection .collection-link:hover { text-decoration: underline; }

/* 合集详情页 */
.collection-head { display: flex; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.collection-head .detail-poster { width: 200px; border-radius: 12px; aspect-ratio: 2/3; object-fit: cover; background: var(--card2); }
/* 合集头：有背景图时铺满作为背景，内容浮于其上 */
.collection-head.has-backdrop { position: relative; overflow: hidden; border-radius: 12px; padding: 28px; }
.collection-head.has-backdrop .collection-backdrop { position: absolute; inset: 0; z-index: 0; }
.collection-head.has-backdrop .collection-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: 0.35; }
.collection-head.has-backdrop .collection-head-content { position: relative; z-index: 1; display: flex; gap: 20px; flex-wrap: wrap; }
.collection-head.has-backdrop .collection-head-content .detail-info h1,
.collection-head.has-backdrop .collection-head-content .detail-overview { text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.collection-grid .media-card-skel { background: var(--card2); border-radius: 8px; }

/* 三站权威评分块（豆瓣/IMDb/TMDB），模仿 subhd 评分样式 */
.detail-ratings { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
/* 右侧独立评分列：纵向堆叠三站评分，与封面、信息平级 */
.detail-ratings-col { display: flex; align-items: stretch; min-width: 160px; }
.detail-ratings-col .detail-ratings { flex-direction: column; gap: 10px; margin: 0; }
.rating-cell { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 88px; padding: 8px 12px; border-radius: 8px; background: var(--card2, #1e2430); }
.rating-badge { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 4px; color: #fff; }
.rating-badge.douban { background: #2e963d; }
.rating-badge.imdb { background: #e6b91e; color: #222; }
.rating-badge.tmdb { background: #4f8cff; color: #fff; }
.rating-num { font-size: 20px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.rating-num a { color: inherit; text-decoration: none; }
.rating-num a:hover { text-decoration: underline; }
.rating-votes { font-size: 11px; color: var(--muted, #9aa0ac); }
.detail-overview { color: var(--muted); font-size: 14px; }
.detail-crew { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.detail-crew .crew-item b { color: var(--text); font-weight: 600; margin-right: 4px; }
.cast-list { margin-bottom: 24px; }
.cast-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.cast-scroll::-webkit-scrollbar { height: 8px; }
.cast-scroll::-webkit-scrollbar-track { background: var(--card); border-radius: 4px; }
.cast-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.cast-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.cast-card { flex: 0 0 auto; width: 110px; background: var(--card); border-radius: 10px; overflow: hidden; text-align: center; scroll-snap-align: start; }
.cast-poster { width: 100%; height: 147px; background: var(--card2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cast-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }
.cast-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--muted); }
.cast-name { font-size: 13px; font-weight: 600; padding: 8px 6px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-char { font-size: 12px; color: var(--muted); padding: 0 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-avatar-link { display: block; }
.cast-avatar-link .cast-poster { transition: opacity .15s ease; }
.cast-avatar-link:hover .cast-poster { opacity: .8; }
.person-link { color: var(--accent, #4f8cff); text-decoration: none; }
.person-link:hover { text-decoration: underline; }
.link-btn { display: inline-block; margin: 4px 0 12px; padding: 6px 14px; border: 1px solid var(--accent, #4f8cff); color: var(--accent, #4f8cff); background: transparent; border-radius: 6px; font-size: 13px; text-decoration: none; }
.link-btn:hover { background: rgba(79, 140, 255, 0.12); }
h2.section { margin: 8px 0 14px; font-size: 18px; }
.res-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.res-section-head h2.section { margin: 8px 0 14px; }
.res-refresh { flex-shrink: 0; padding: 3px 12px; font-size: 12px; }
.res-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

/* 资源列表（共用 .res-card，见上） */
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.card { background: var(--card); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h3 { margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.muted { color: var(--muted); }
.muted code { background: var(--card2); padding: 1px 6px; border-radius: 4px; }

/* 源站 */
.src-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.src-row:last-child { border-bottom: none; }
.src-name { font-weight: 600; }
.src-type { font-size: 12px; color: var(--muted); margin-left: 8px; }

/* 用户系统 */
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--accent2); font-size: 13px; }
.auth-card { max-width: 380px; margin: 40px auto; }
.auth-tabs { margin-bottom: 16px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input { width: 100%; }
.auth-form button.primary { margin-top: 4px; }
.auth-error { min-height: 20px; margin-top: 10px; color: var(--danger); }
.code-item { font-family: monospace; font-size: 16px; font-weight: 700; letter-spacing: 2px; }

/* 设置行与开关 */
.set-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.set-row label { font-size: 14px; }
.set-row .set-label { font-size: 14px; }
.set-row .check-inline { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.set-row .check-inline input { width: auto; flex: none; }
.set-row input[type="password"], .set-row input[type="text"] { flex: 1; min-width: 220px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: var(--card2); border: 1px solid var(--border); border-radius: 24px; cursor: pointer; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 2px; background: var(--muted); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); background: #fff; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card2); color: var(--text); padding: 10px 20px; border-radius: 8px;
  border: 1px solid var(--border); opacity: 0; transition: all .25s; pointer-events: none; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* 骨架屏 */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.skeleton-card { background: var(--card); border-radius: 12px; overflow: hidden; }
.skeleton-poster { width: 100%; aspect-ratio: 2/3; background: linear-gradient(90deg, var(--card2) 25%, var(--border) 50%, var(--card2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-info { padding: 10px 12px; }
.skeleton-title { height: 18px; background: linear-gradient(90deg, var(--card2) 25%, var(--border) 50%, var(--card2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; margin-bottom: 8px; }
.skeleton-sub { height: 14px; width: 60%; background: linear-gradient(90deg, var(--card2) 25%, var(--border) 50%, var(--card2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }

@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 详情页资源后台加载中提示 */
.res-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 0; color: var(--muted); font-size: 14px; }
.res-loading .spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* 滚动续载指示器与底部提示 */
.list-loader { display: flex; justify-content: center; align-items: center; padding: 20px 0; gap: 8px; color: var(--muted); font-size: 13px; }
.loader-spin { width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.list-end { text-align: center; padding: 20px 0; color: var(--muted); font-size: 13px; }

/* 空状态增强 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state .title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state .desc { font-size: 13px; margin-bottom: 16px; }
.empty-state .action { display: inline-flex; gap: 8px; align-items: center; }

/* 搜索建议下拉 */
.search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; max-height: 300px; overflow-y: auto; z-index: 20; display: none; }
.search-suggestions.active { display: block; }
.search-suggestion-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.1s; }
.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover, .search-suggestion-item.active { background: var(--card2); }
.search-suggestion-item .suggestion-icon { font-size: 14px; opacity: 0.7; flex-shrink: 0; }
.search-suggestion-item .suggestion-text { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 资源筛选栏 */
.res-filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.res-filter-bar .filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.res-filter-bar .filter-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-right: 4px; }
.res-filter-bar .filter-divider { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }
.res-filter-bar .filter-btn { background: var(--card2); border: 1px solid var(--border); color: var(--text); padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: all 0.15s; white-space: nowrap; }
.res-filter-bar .filter-btn:hover { border-color: var(--accent); color: var(--accent2); }
.res-filter-bar .filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.res-filter-bar .filter-select { background: var(--card2); border: 1px solid var(--border); color: var(--text); padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; min-width: 140px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0ac' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; }
.res-filter-bar .filter-select:focus { outline: none; border-color: var(--accent); }
#season-filter-bar .filter-episode { flex-basis: 100%; width: 100%; margin-top: 2px; }

/* 虚拟滚动占位器 */
.virtual-spacer-top, .virtual-spacer-bottom { pointer-events: none; }

/* 批量操作 */
.batch-actions { display: flex; gap: 8px; margin-bottom: 12px; padding: 10px; background: var(--card); border-radius: 8px; border: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.batch-actions .count { font-size: 13px; color: var(--muted); }
.batch-actions .batch-btn { background: var(--card2); border: 1px solid var(--border); color: var(--text); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.batch-actions .batch-btn:hover { border-color: var(--accent); color: var(--accent2); }
.batch-actions .batch-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Toast 增强 */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--card2); color: var(--text); padding: 10px 20px; border-radius: 8px; border: 1px solid var(--border); opacity: 0; transition: all .25s; pointer-events: none; z-index: 20; max-width: 90vw; word-break: break-word; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: #22c55e; background: rgba(34, 197, 94, 0.15); }
.toast.error { border-color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.toast.warning { border-color: #f59e0b; background: rgba(245, 158, 11, 0.15); }

/* 详情页资源卡片增强（共用 .res-card，见上） */
.res-card.selected { border-color: var(--accent); background: rgba(79, 140, 255, 0.05); }

.card { background: var(--card); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h3 { margin-bottom: 10px; }
.card-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.muted { color: var(--muted); }
.muted code { background: var(--card2); padding: 1px 6px; border-radius: 4px; }

/* 源站 */
.src-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.src-row:last-child { border-bottom: none; }
.src-actions { display: flex; gap: 6px; align-items: center; }
.src-actions select { max-width: 110px; }
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th, .perm-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.perm-table input[type="checkbox"] { accent-color: var(--accent, #4c9aff); }
.perm-table input:disabled { opacity: 0.45; cursor: not-allowed; }
.person-credits { display: flex; flex-direction: column; gap: 2px; }
.person-credit { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.person-credit:hover { background: var(--card2, rgba(255,255,255,.04)); }
.person-credit .credit-type { flex: 0 0 auto; font-size: 11px; color: var(--accent, #4c9aff); border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; }
.person-credit .credit-title { flex: 0 1 auto; color: var(--text, #eee); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-credit .credit-meta { flex: 0 0 auto; color: var(--muted, #9aa0ac); font-size: 13px; }
.person-credit .credit-rcount { flex: 0 0 auto; font-size: 12px; color: var(--accent, #4c9aff); background: rgba(76, 154, 255, .12); border-radius: 4px; padding: 1px 6px; }
.person-credit .credit-role { flex: 0 1 auto; color: var(--muted, #9aa0ac); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: auto; }
.src-name { font-weight: 600; }
.src-type { font-size: 12px; color: var(--muted); margin-left: 8px; }
.src-status { display: flex; align-items: center; gap: 8px; }
.src-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.src-status-dot.online { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.src-status-dot.offline { background: #ef4444; }
.src-status-dot.unknown { background: #f59e0b; }
.src-test-btn { font-size: 11px; padding: 4px 10px; }

/* 进度条 */
.progress-bar { height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }

/* 标签页徽章 */
.tab .badge { margin-left: 6px; font-size: 10px; padding: 1px 5px; }

@media (max-width: 640px) {
  .detail-head { flex-direction: column; }
  .detail-poster { width: 100%; max-width: 200px; }
  .collection-head { flex-direction: column; }
  .collection-head.has-backdrop .collection-head-content { flex-direction: column; }
  .collection-head .detail-poster { width: 100%; max-width: 200px; }
}

/* 设置页：源站分组勾选 */
.src-group { margin-bottom: 14px; }
.src-group-title { font-weight: 700; font-size: 13px; color: var(--muted, #9aa0ac); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .5px; }
.src-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; min-width: 0; }
.src-toggle .src-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent, #4f8cff); flex-shrink: 0; }
.tg-row { align-items: center; }
.tg-del { margin-left: auto; }
.src-cfg { margin: 6px 0 4px 24px; padding: 10px 12px; background: var(--card2, #1b1f27); border-radius: 6px; display: grid; gap: 8px; }
.src-cfg-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted, #9aa0ac); }
.src-cfg-field input { padding: 6px 8px; border-radius: 5px; border: 1px solid var(--border, #333); background: var(--bg, #111); color: var(--fg, #eee); width: 100%; box-sizing: border-box; }
.src-cfg-actions { display: flex; gap: 8px; margin-top: 4px; }

/* 设置页子分页 */
.settings-subtabs { margin-bottom: 18px; }
.search-subtabs { margin-bottom: 18px; }
#view-settings .card { margin-bottom: 16px; }

/* 设置页：源站紧凑网格（一行 8 个） */
.src-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.src-cell { background: var(--card2, #1b1f27); border: 1px solid var(--border, #333); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.src-cell .src-toggle { display: flex; align-items: center; gap: 6px; flex: none; }
.src-cell .src-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-cell .src-status-dot { margin-left: auto; flex-shrink: 0; }
.src-cell .src-speed { font-size: 11px; color: var(--muted, #888); margin-top: -2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-cell-actions { display: flex; gap: 6px; }
.src-cell-actions .res-btn { padding: 3px 8px; font-size: 12px; flex: 1; }
.src-cell .src-cfg { margin: 4px 0 0; padding: 8px; }
.src-cell .src-error { font-size: 11px; }

@media (max-width: 1200px) { .src-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 640px) { .src-grid { grid-template-columns: repeat(2, 1fr); } }

/* 手风琴折叠面板 */
.accordion { display: flex; flex-direction: column; gap: 10px; }
.accordion-item { border: 1px solid var(--border); border_radius: 10px; background: var(--card); overflow: hidden; }
.accordion-header { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: transparent; border: none; color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; transition: background 0.15s; }
.accordion-header:hover { background: var(--card2); }
.acc-icon { font-size: 18px; flex-shrink: 0; }
.acc-title { flex: 1; }
.acc-count { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--card2); border-radius: 10px; padding: 1px 8px; flex-shrink: 0; }
.acc-chevron { font-size: 12px; color: var(--muted); transition: transform 0.2s; flex-shrink: 0; }
.accordion-item.open .acc-chevron { transform: rotate(180deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.25s ease, padding 0.25s ease; }
.accordion-item.open .accordion-content { max-height: 2000px; padding: 0 16px 16px; }
.accordion-content .card { margin-bottom: 0; border: none; border-radius: 0; background: transparent; box-shadow: none; }

/* 源站工具栏 */
.src-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.src-search-input { flex: 1; min-width: 180px; padding: 6px 10px; background: var(--card2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.src-search-input:focus { outline: none; border-color: var(--accent); }
.src-filter-select { padding: 6px 10px; background: var(--card2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; min-width: 110px; }
.src-filter-select:focus { outline: none; border-color: var(--accent); }
.src-batch-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.src-batch-actions .res-btn { padding: 4px 10px; font-size: 12px; }

/* 搜索首页 - Google 风格 */
.view.search-home { display: none; }
.view.search-home.active { display: flex; justify-content: center; align-items: flex-start; min-height: calc(100vh - 80px); padding: 60px 20px 40px; }
.search-home-wrapper { width: 100%; max-width: 1200px; margin: 0 auto; text-align: center; }
.search-home-brand { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 8px; letter-spacing: -0.5px; }
.search-home-subtitle { font-size: 15px; color: var(--muted); margin-bottom: 40px; font-weight: 400; }
.search-home-box { max-width: 560px; margin: 0 auto 24px; }
.search-home-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 560px; margin: 0 auto 20px; flex-wrap: wrap; }
.search-home-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.search-home-options { flex: 1; min-width: 0; }
.search-home-options-bar { display: flex; gap: 12px; justify-content: flex-start; align-items: center; flex-wrap: wrap; }
.search-home-options-bar .chk-opt { display: inline-flex; align-items: center; height: 42px; font-size: 13px; color: var(--muted); }
#search-results { text-align: left; margin-top: 20px; }
#search-resource-results { text-align: left; }
.search-count { margin: 18px 0 4px; font-size: 14px; color: var(--muted); }
.search-home-inner { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 28px; box-shadow: 0 1px 6px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08); transition: box-shadow 0.2s, border-color 0.2s; }
.search-home-inner:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1); border-color: var(--accent); }
.search-home-inner:focus-within { box-shadow: 0 2px 10px rgba(0,0,0,0.15), 0 2px 6px rgba(0,0,0,0.1); border-color: var(--accent); }
.search-home-inner input { width: 100%; padding: 16px 56px 16px 52px; font-size: 18px; background: transparent; border: none; outline: none; color: var(--text); font-family: inherit; }
.search-home-inner input::placeholder { color: var(--muted); }
.search-home-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); pointer-events: none; }
.search-home-clear { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s; }
.search-home-inner:hover .search-home-clear, .search-home-inner:focus-within .search-home-clear { opacity: 1; }
.search-home-clear:hover { color: var(--text); background: var(--card2); }
.search-home-select { padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 14px; min-width: 100px; cursor: pointer; height: 42px; box-sizing: border-box; }
.search-home-select:focus { outline: none; border-color: var(--accent); }
.search-home-btn { padding: 0 20px; font-size: 14px; font-weight: 500; border-radius: 6px; min-width: 120px; height: 42px; transition: all 0.15s; cursor: pointer; box-sizing: border-box; }
.search-home-btn.primary { background: var(--accent); border: none; color: #fff; }
.search-home-btn.primary:hover { background: var(--accent2); }
.search-home-btn.ghost { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.search-home-btn.ghost:hover { background: var(--card2); border-color: var(--accent); color: var(--accent2); }
.search-home-filter-select { padding: 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; min-width: 140px; height: 42px; box-sizing: border-box; cursor: pointer; }
.search-home-filter-select:focus { outline: none; border-color: var(--accent); }

/* 首页随机推荐（搜索框为空时） */
.home-random { margin-top: 8px; text-align: left; }
.home-random-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1200px; margin: 0 auto 14px; flex-wrap: wrap; }
.home-random-title { font-size: 18px; font-weight: 700; color: var(--text); }
.home-random-btn { padding: 0 14px; font-size: 13px; border-radius: 6px; min-width: 0; height: 32px; }
.home-random-btn:hover { background: var(--card2); border-color: var(--accent); color: var(--accent2); }
.home-random .grid { justify-content: flex-start; }

@media (max-width: 640px) {
  .search-home { padding: 40px 16px 30px; }
  .search-home-brand { font-size: 24px; }
  .search-home-subtitle { font-size: 14px; margin-bottom: 32px; }
  .search-home-inner input { padding: 14px 48px 14px 48px; font-size: 16px; }
  .search-home-icon { left: 14px; font-size: 18px; }
  .search-home-clear { right: 14px; width: 28px; height: 28px; }
  .search-home-actions { gap: 8px; }
  .search-home-btn { min-width: 100px; }
  .search-home-select { min-width: 90px; }
}