:root {
  --bg: #0a0c11;
  --panel: #151a24;
  --panel-2: #1d2330;
  --line: #262d3d;
  --text: #e9edf6;
  --muted: #8e97ac;
  --dim: #5f6a82;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --ok: #37d399;
  --warn: #ffb04a;
  --bad: #ff6b81;
  --radius: 14px;
  --shadow: 0 20px 52px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 560px at 12% -8%, #1c2237 0%, rgba(10, 12, 17, 0) 60%),
    radial-gradient(900px 480px at 92% 0%, #241a2e 0%, rgba(10, 12, 17, 0) 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  transition: .16s ease;
  white-space: nowrap;
}
button:hover { border-color: #3d4659; background: #242b3a; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); }
button.primary {
  border: 0;
  font-weight: 700;
  color: #14101a;
  background: linear-gradient(135deg, #ff7ba3, #a78bfa);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px clamp(12px, 3vw, 34px);
  background: rgba(10, 12, 17, .84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 26px; filter: drop-shadow(0 0 14px rgba(255, 92, 138, .55)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-text strong { font-size: 17px; letter-spacing: .6px; }
.brand-text small { color: var(--dim); font-size: 10.5px; letter-spacing: 1.4px; }

.sources { display: flex; gap: 7px; flex-wrap: wrap; }
.sources button {
  padding: 6px 13px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.sources button.active {
  color: #14101a;
  border-color: transparent;
  background: linear-gradient(135deg, #ff8fb0, #b39bfb);
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(160, 120, 255, .3);
}

.search { display: flex; gap: 8px; margin-left: auto; flex: 1 1 240px; max-width: 430px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  outline: none;
  transition: .16s;
}
.search input:focus { border-color: #7c5cff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .16); }
.search button {
  border: 0;
  font-weight: 700;
  color: #14101a;
  background: linear-gradient(135deg, #ff8fb0, #b39bfb);
}

/* ---------- 视图容器 ---------- */
.view {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 34px) 34px;
}

.crumb { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 12.5px; margin-bottom: 10px; flex-wrap: wrap; }
.crumb a:hover { color: var(--text); }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .sub b { color: var(--accent); }

/* ---------- 首页 hero ---------- */
.hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(16px, 3vw, 26px);
  background:
    radial-gradient(600px 220px at 0% 0%, rgba(255, 92, 138, .16), rgba(0, 0, 0, 0) 70%),
    radial-gradient(600px 240px at 100% 0%, rgba(124, 92, 255, .18), rgba(0, 0, 0, 0) 70%),
    var(--panel);
  margin-bottom: 22px;
}
.hero h1 { margin: 0 0 6px; font-size: clamp(20px, 2.4vw, 27px); }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; }
.hero .jump { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero .jump a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  font-size: 13px;
}
.hero .jump a:hover { border-color: #4a5470; background: rgba(255, 255, 255, .07); }

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}
.section-head h2 { margin: 0; font-size: 17px; }
.section-head .count { color: var(--dim); font-size: 12px; }
.section-head .more { margin-left: auto; font-size: 12.5px; color: var(--accent-2); }
.section-head .more:hover { text-decoration: underline; }

/* ---------- 筛选面板 ---------- */
.filter-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 6px 14px;
  margin-bottom: 16px;
}
.filter-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .06);
  align-items: flex-start;
}
.filter-row:last-child { border-bottom: 0; }
.filter-row > .label {
  flex: none;
  width: 74px;
  color: var(--dim);
  font-size: 12.5px;
  padding-top: 5px;
  letter-spacing: .5px;
}
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opts button {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.opts button:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.opts button.active {
  color: #14101a;
  background: #d7dcec;
  font-weight: 700;
}
.opts button.more-tag { color: var(--accent-2); border: 1px dashed #3b3f57; }

/* ---------- 结果条 + 分页 ---------- */
.result-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.result-bar .stat { color: var(--muted); font-size: 13px; }
.result-bar .stat b { color: var(--text); }
.pager { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.pager button { padding: 6px 12px; font-size: 12.5px; }
.pager .jump { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12.5px; }
.pager .jump input {
  width: 56px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
}

/* ---------- 网格与卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 18px 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 12px;
}
.card:hover { background: transparent; }
.card .thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(155deg, #1d2331, #101319);
  border: 1px solid var(--line);
  transition: .18s ease;
}
.card:hover .thumb { border-color: #4a5470; transform: translateY(-3px); box-shadow: 0 16px 30px rgba(0, 0, 0, .5); }
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.card .thumb img.ready { opacity: 1; }
.card:hover .thumb img.ready { transform: scale(1.04); }
.card .thumb .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #39425a;
  font-size: 24px;
  letter-spacing: 1px;
}
.card .thumb .play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(10, 12, 18, .72);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: .18s;
  backdrop-filter: blur(4px);
}
.card:hover .thumb .play { opacity: 1; }
.card .badge {
  position: absolute;
  top: 7px;
  left: 7px;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(8, 10, 15, .74);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #dbe2f2;
  backdrop-filter: blur(4px);
}
.card .name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.card .remarks {
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 详情页 ---------- */
.detail-hero {
  position: relative;
  display: flex;
  gap: clamp(16px, 3vw, 30px);
  padding: clamp(16px, 3vw, 28px);
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--panel);
}
.detail-hero::before {
  content: "";
  position: absolute;
  inset: -30%;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  filter: blur(38px) saturate(1.3);
  opacity: .28;
  pointer-events: none;
}
.detail-hero > * { position: relative; }
.detail-hero .poster {
  flex: none;
  width: clamp(132px, 20vw, 208px);
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  object-fit: cover;
  background: #12151d;
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .5);
}
.detail-hero .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.detail-hero h1 { margin: 0; font-size: clamp(19px, 2.4vw, 26px); line-height: 1.3; }
.detail-hero .meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; align-items: center; }
.detail-hero .meta .dot { color: #3a4155; }
.detail-hero .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-hero .chips span {
  font-size: 11.5px;
  color: #bfc7dc;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 999px;
  padding: 2px 9px;
}
.detail-hero .desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-height: 9em;
  overflow-y: auto;
  white-space: pre-wrap;
}
.detail-hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }

.episodes-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.episodes-head h2 { margin: 0; font-size: 17px; }
.episodes-head .count { color: var(--dim); font-size: 12px; }
.episodes-head .range { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.episodes-head .range button { padding: 4px 10px; font-size: 12px; }

.ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 9px;
}
.ep-grid button {
  padding: 10px 6px;
  border-radius: 10px;
  font-size: 12.5px;
  background: var(--panel);
  overflow: hidden;
  text-overflow: ellipsis;
}
.ep-grid button:hover { border-color: var(--accent); color: #ffd0de; }

/* ---------- 搜索状态 ---------- */
.src-status { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.src-status .item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
}
.src-status .item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.src-status .item.ok .dot { background: var(--ok); }
.src-status .item.bad { color: #ffc2cb; border-color: #5d2b39; }
.src-status .item.bad .dot { background: var(--bad); }
.src-status .item.warn .dot { background: var(--warn); }

/* ---------- 占位 / 提示 ---------- */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 18px 14px; }
.skeleton { aspect-ratio: 3 / 4; border-radius: 12px; background: linear-gradient(100deg, #141924 30%, #1d2432 50%, #141924 70%); background-size: 240% 100%; animation: shine 1.25s linear infinite; }
@keyframes shine { from { background-position: 140% 0; } to { background-position: -40% 0; } }

.notice {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 16px;
  padding: 22px;
  color: var(--muted);
  font-size: 13.5px;
}
.notice.bad { border-color: #5d2b39; background: #1e1319; color: #ffc2cb; }
.notice h3 { margin: 0 0 8px; color: var(--text); font-size: 15px; }
.notice code { background: rgba(255, 255, 255, .07); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.notice .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- 播放器 ---------- */
.player {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 4, 7, .94);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vw, 26px);
}
.player-inner {
  width: min(1180px, 100%);
  max-height: 100%;
  overflow-y: auto;
  position: relative;
  background: #0b0e14;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.player-stage { position: relative; background: #000; border-radius: 18px 18px 0 0; overflow: hidden; }
.player-stage video { width: 100%; max-height: 72vh; display: block; background: #000; }
.player-msg {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  padding: 26px;
  color: #ffc2cb;
  font-size: 13.5px;
  line-height: 1.7;
  background: rgba(0, 0, 0, .68);
}
.player-msg.show { display: grid; }
.player-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; padding: 0; border-radius: 50%; z-index: 3; display: grid; place-items: center; }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.player-title { font-weight: 700; font-size: 14px; }
.player-links { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.player-links button { font-size: 12px; padding: 6px 12px; }
.player-links button.active { border-color: var(--accent); color: #ffd0de; }
.player-eps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 7px;
  padding: 0 16px 16px;
  max-height: 26vh;
  overflow-y: auto;
}
.player-eps:empty { display: none; }
.player-eps button { font-size: 12px; padding: 7px 4px; }
.player-eps button.active { border-color: var(--accent); color: #ffd0de; }

/* ---------- 检测面板 ---------- */
.panel-wrap {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(4, 6, 10, .72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
}
.panel {
  position: relative;
  width: min(560px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #161b26, #0e1118);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 28px 6px 0; font-size: 17px; }
.panel-tip { color: var(--dim); font-size: 12.5px; margin: 0 0 16px; }
.panel-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.health-body { display: flex; flex-direction: column; gap: 10px; }
.health-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.health-item .top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.health-item .top .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.health-item.ok .top .dot { background: var(--ok); }
.health-item.bad .top .dot { background: var(--bad); }
.health-item .top .ms { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 11.5px; }
.health-item .detail { color: var(--muted); font-size: 12px; margin-top: 6px; word-break: break-all; }

/* ---------- 其它 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 200;
  background: #1d2331;
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: min(92vw, 540px);
  text-align: center;
}

/* 启动自检面板 */
.bootfail {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(4, 6, 10, .9);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 18px;
}
.bootfail-inner {
  width: min(600px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1a1520, #0f1016);
  border: 1px solid #5d2b39;
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.bootfail-inner h2 { margin: 0 0 10px; font-size: 18px; color: #ffd0da; }
.bootfail-inner p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.bootfail-row {
  padding: 9px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .08);
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}
.bootfail-row b { color: var(--text); }
.bootfail-tip { font-size: 12.5px !important; color: var(--dim) !important; }
.bootfail-inner code {
  background: rgba(255, 255, 255, .08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
}
.bootfail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 12px; }

.foot {
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 16px clamp(12px, 3vw, 34px) 26px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 780px) {
  .topbar { gap: 10px; padding: 10px 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px 10px; }
  .view { padding: 14px 12px 26px; }
  .detail-hero { flex-direction: column; }
  .detail-hero .poster { width: 128px; }
  .filter-row { flex-direction: column; gap: 4px; }
  .filter-row > .label { width: auto; padding-top: 0; }
  .player-stage video { max-height: 44vh; }
  .pager { margin-left: 0; }
}
