:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e3e6ec;
  --line-strong: #d0d5df;
  --fg: #1a1d24;
  --muted: #6b7484;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --dark: #101318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 20, 28, .06), 0 4px 14px rgba(16, 20, 28, .05);
}

* { box-sizing: border-box; }

/* 必须放在 flex/grid 规则之前生效：CSS 的 display 会覆盖 HTML 的 hidden 属性 */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
img { display: block; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand:hover { color: var(--accent); }
.topbar .spacer { flex: 1 1 auto; }
.topbar .hint { color: var(--muted); font-size: 13px; }

/* ---------- 同步 ---------- */
.sync-btn {
  border: 1px solid var(--line-strong); background: #fff; color: var(--fg);
  border-radius: 8px; padding: 5px 14px; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.sync-btn:hover:not(:disabled) { background: #f3f5f9; border-color: #b9c0cc; }
.sync-btn:disabled { opacity: .55; cursor: default; }
.sync-btn.attention { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.sync-btn.attention::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  display: inline-block; margin-left: 6px; vertical-align: middle;
}

.sync-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 16px 0 0; padding: 12px 16px;
  background: #eef5ff; border: 1px solid #c3d9ff; border-radius: var(--radius);
  color: #1b3a6b; font-size: 13.5px;
}
.sync-now {
  margin-left: auto; border: 0; border-radius: 8px; padding: 6px 16px;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.sync-now:hover { background: var(--accent-dark); }

/* ---------- 面包屑 ---------- */
.crumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 20px 0 4px; color: var(--muted); font-size: 13.5px;
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .5; }
.crumbs .cur { color: var(--fg); }

/* ---------- 首页 ---------- */
.hero { padding: 34px 0 8px; }
.hero h1 { font-size: 27px; margin: 0 0 8px; letter-spacing: .3px; }
.hero p { color: var(--muted); margin: 0; font-size: 14px; }

.cat-grid {
  display: grid; gap: 20px; margin-top: 26px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.cat-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  display: flex; flex-direction: column;
}
.cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 6px 22px rgba(16, 20, 28, .1);
}
.cat-band {
  height: 88px; background: linear-gradient(135deg, #2b3340, #4a5568);
  display: grid; place-items: center; color: #fff;
}
.cat-band span { font-size: 26px; font-weight: 700; letter-spacing: 4px; }
.cat-card:nth-child(2n) .cat-band { background: linear-gradient(135deg, #1f3a5f, #2563eb); }
.cat-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.cat-name { font-size: 19px; font-weight: 700; }
.cat-desc { color: var(--muted); font-size: 13.5px; }
.cat-foot {
  margin-top: auto; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding-top: 6px;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef2fb; color: #24406f; border-radius: 999px;
  padding: 4px 11px; font-size: 12.5px; font-weight: 600;
}
.pill.gray { background: #f0f1f4; color: var(--muted); }
.go { color: var(--accent); font-size: 14px; font-weight: 600; }

/* ---------- 分类页 ---------- */
.page-head { padding: 26px 0 0; }
.page-head h1 { font-size: 24px; margin: 0 0 6px; }
.page-head .meta { color: var(--muted); font-size: 13.5px; }

.item-block { margin-top: 30px; }
.item-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.item-head h2 { font-size: 17px; margin: 0; }
.item-head .n { color: var(--muted); font-size: 13px; }

.grid {
  display: grid; gap: 18px; margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}

.vcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.vcard:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 6px 22px rgba(16, 20, 28, .1); }
.vcard .thumb {
  display: block; position: relative; aspect-ratio: 16 / 10;
  background: var(--dark); overflow: hidden;
}
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.vcard .thumb.noposter img { display: none; }
.vcard .thumb.noposter::after {
  content: "无预览图"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #4b5566; font-size: 13px;
}
.vcard .thumb::before {
  content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.18);
  opacity: 0; transition: opacity .14s ease; z-index: 1;
}
.vcard:hover .thumb::before { opacity: 1; }
.vcard .play {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; z-index: 2;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  display: grid; place-items: center; font-size: 17px; padding-left: 4px;
  opacity: 0; transform: scale(.9); transition: opacity .14s ease, transform .14s ease;
}
.vcard:hover .play { opacity: 1; transform: scale(1); }
.vcard .dbadge {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(0,0,0,.72); color: #fff; font-size: 12px;
  padding: 2px 7px; border-radius: 5px; font-variant-numeric: tabular-nums;
}
/* 清单里有、但服务器上还没上传的视频 */
.vcard .vmissing {
  position: absolute; left: 8px; top: 8px; z-index: 3;
  background: #b45309; color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px;
}
.vcard.is-missing .thumb img { filter: grayscale(.85) brightness(.75); }
.vcard.is-missing .play { display: none; }
.vcard .vtitle .dim { color: var(--muted); font-weight: 400; }
.vcard .vbody { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.vcard .vtitle { font-weight: 600; word-break: break-word; line-height: 1.45; }
.vcard .vmeta { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.vcard .vmeta .dot { opacity: .45; }
.vcard .vactions { margin-top: auto; display: flex; gap: 8px; }

/* ---------- 分类页：条目卡片（只显示标题） ---------- */
.item-grid {
  display: grid; gap: 18px; margin-top: 22px;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
}
.icard {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.icard:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 6px 22px rgba(16, 20, 28, .1); }
.icard-top {
  height: 92px; padding: 0 18px; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #eef1f6, #e2e7f0); border-bottom: 1px solid var(--line);
}
.icard:nth-child(2n) .icard-top { background: linear-gradient(135deg, #eaf0fb, #dde7fa); }
.icard-name { font-size: 26px; font-weight: 700; letter-spacing: 1.5px; color: #1f2733; }
.icard-count {
  margin-left: auto; background: #fff; border: 1px solid var(--line-strong);
  color: #495468; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.icard-body { padding: 13px 18px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.icard-meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.icard-meta .dot { opacity: .45; }
.icard-go { color: var(--accent); font-size: 13.5px; font-weight: 600; margin-top: auto; }
.icard-note { color: var(--muted); font-size: 12px; }

/* ---------- 条目页：片段 chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: 5px 13px; font-size: 13px; transition: border-color .12s ease, background .12s ease;
}
.chip:hover { border-color: var(--accent); background: #f2f6ff; }
.chip.cur { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip .t { color: inherit; opacity: .7; font-size: 12px; }

.category-nav {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 36px;
  padding-top: 18px; border-top: 1px solid var(--line); font-size: 13.5px;
}
.category-nav a { color: var(--accent); }
.category-nav a:hover { text-decoration: underline; }

/* ---------- 按钮 ---------- */
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-align: center; cursor: pointer; font-family: inherit; font-size: 13.5px;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--fg);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: #f3f5f9; border-color: #b9c0cc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.done { border-color: #16a34a; color: #16a34a; background: #f0fdf4; }

/* ---------- 详情页 ---------- */
.detail {
  display: grid; gap: 22px; margin-top: 22px;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
}
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }

.player-box {
  background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 8px 30px rgba(10, 14, 20, .18);
}
.player-box video { width: 100%; max-height: 72vh; display: block; background: #000; }

.detail h1 { font-size: 21px; margin: 20px 0 10px; word-break: break-word; }

.info {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.info dl { margin: 0; display: grid; grid-template-columns: 88px minmax(0, 1fr); }
.info dt {
  padding: 10px 12px; color: var(--muted); font-size: 13px; background: #fafbfd;
  border-bottom: 1px solid var(--line);
}
.info dd {
  margin: 0; padding: 10px 12px; font-size: 13.5px; border-bottom: 1px solid var(--line);
  word-break: break-all;
}
.info dl > dt:last-of-type, .info dl > dd:last-of-type { border-bottom: 0; }
.info .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
/* MD5 单元格：等宽可换行，带复制按钮 */
.info .md5cell {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  word-break: break-all; line-height: 1.5;
  position: relative; padding-right: 58px;
}
.info .md5copy {
  position: absolute; right: 10px; top: 8px;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  border-radius: 5px; padding: 1px 7px; font-size: 11.5px;
  font-family: inherit; cursor: pointer;
}
.info .md5copy:hover { background: #f3f5f9; color: var(--fg); }

.dl-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.dl-actions .btn { flex: 1 1 130px; padding: 11px 14px; font-size: 14px; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 10px; }

.side-title { font-size: 13px; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.side-list { display: flex; flex-direction: column; gap: 8px; }
.side-item {
  display: flex; gap: 10px; align-items: center; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .12s ease, background .12s ease;
}
.side-item:hover { border-color: var(--line-strong); background: #fbfcfe; }
.side-item.cur { border-color: var(--accent); background: #f2f6ff; }
.side-thumb {
  width: 76px; height: 46px; flex: 0 0 76px; border-radius: 6px; overflow: hidden;
  background: var(--dark);
}
.side-thumb img { width: 100%; height: 100%; object-fit: cover; }
.side-txt { min-width: 0; }
.side-name {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side-meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ---------- 状态 ---------- */
.state { color: var(--muted); padding: 40px 0; }
.state.err { color: #b42318; white-space: pre-wrap; }
.state.err code { background: #fef3f2; padding: 1px 6px; border-radius: 4px; }
.empty {
  background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--muted); margin-top: 24px;
}
.empty code { background: #f0f1f4; padding: 2px 7px; border-radius: 5px; color: var(--fg); }

footer.site {
  max-width: 1080px; margin: 56px auto 0; padding: 18px 20px 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
