:root {
  --bg: #222529;
  --bg-soft: #2a2d33;
  --card: #2b2e34;
  --card-hover: #33363e;
  --border: #3a3e46;
  --text: #ececf1;
  --muted: #a1a5af;
  --purple: #a78bfa;
  --purple-2: #c4b5fd;
  --accent: #8b7cf6;
  --green: #6cc47a;
  --shadow: 0 8px 30px rgba(0, 0, 0, .4);
  --radius: 10px;
}

html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f0f1f5;
  --border: #dfe2e8;
  --text: #1f2430;
  --muted: #6b7280;
  --purple: #7c3aed;
  --purple-2: #6d28d9;
  --accent: #7c3aed;
  --green: #3f9145;
  --shadow: 0 8px 30px rgba(0, 0, 0, .1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

.hero { position: relative; max-width: 1280px; margin: 0 auto; padding: 34px 24px 8px; }
.theme-toggle {
  position: absolute; right: 28px; top: 30px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.theme-toggle svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.hero-inner { max-width: 100%; }
.hero-title {
  text-align: center;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  background: linear-gradient(100deg, #a78bfa, #c084fc 50%, #f0abfc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.title-icon { -webkit-text-fill-color: initial; }
.hero-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }

.notice {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 14px;
  font-size: 12px; color: var(--muted); line-height: 1.8;
}
.notice-row { display: flex; gap: 8px; align-items: flex-start; }
.notice-icon { flex-shrink: 0; font-size: 14px; line-height: 1.6; }
.notice-icon.info { color: #7c9cf5; }
.notice-icon.warn { color: #e0a458; }

.search-wrap { position: relative; margin-bottom: 12px; }
.search-icon {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted);
}
#search {
  width: 100%; padding: 11px 44px 11px 42px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .2s;
}
#search:focus { border-color: var(--accent); }
#search::placeholder { color: var(--muted); }
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border: none; border-radius: 50%;
  background: var(--border); color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; display: none;
}
.search-clear.show { display: block; }

.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 760px) { .filters { grid-template-columns: repeat(2, 1fr); } }
.filter { position: relative; }
.filter-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 12px; cursor: pointer;
  text-align: left; transition: border-color .2s;
}
.filter-btn:hover { border-color: #5a5f6b; }
.filter-btn.active { border-color: var(--accent); color: var(--purple-2); }
.filter-btn .fb-count {
  flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; margin-left: auto; margin-right: 8px;
  background: var(--accent); color: #fff; border-radius: 9px; font-size: 10px;
  display: none; align-items: center; justify-content: center;
}
.filter-btn .fb-count.show { display: flex; }
.filter-btn .fb-arrow { flex-shrink: 0; font-size: 9px; color: var(--muted); transition: transform .2s; }
.filter.open .fb-arrow { transform: rotate(180deg); }
.filter-panel {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0;
  max-height: 280px; overflow-y: auto; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px; z-index: 30; display: none;
}
.filter.open .filter-panel { display: block; }
.filter-panel::-webkit-scrollbar { width: 6px; }
.filter-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--muted);
}
.opt:hover { background: var(--card-hover); color: var(--text); }
.opt input { display: none; }
.opt .check {
  width: 15px; height: 15px; flex-shrink: 0; border: 1px solid var(--border);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: transparent;
}
.opt.selected { color: var(--text); }
.opt.selected .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt .opt-name { flex: 1; }
.opt .opt-num { font-size: 10px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px;
}
.stat-icon {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: rgba(139, 124, 246, .15); color: #9d8bff;
}
.stat-card:nth-child(2) .stat-icon { background: rgba(108, 156, 245, .15); color: #6c9cf5; }
.stat-card:nth-child(3) .stat-icon { background: rgba(79, 209, 197, .15); color: #4fd1c5; }
.stat-card:nth-child(4) .stat-icon { background: rgba(224, 164, 88, .15); color: #e0a458; }
.stat-label { display: block; font-size: 11px; color: var(--muted); }
.stat-num { display: block; font-size: 19px; font-weight: 700; color: var(--text); }
.stat-unit { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 3px; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px 40px; }
.list-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.list-header h2 { font-size: 17px; font-weight: 600; }
.list-count { font-size: 12px; color: var(--muted); }
.list-count b { color: var(--text); }

.active-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.active-tags:empty { display: none; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(139, 124, 246, .14); border: 1px solid rgba(139, 124, 246, .35);
  color: var(--purple-2); font-size: 11px; padding: 3px 9px; border-radius: 14px;
}
.tag-chip button { border: none; background: none; color: inherit; cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card-thumb {
  position: relative; aspect-ratio: 16 / 10;
  background: var(--bg-soft); overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s; }
.card-thumb img.loaded { opacity: 1; }
.card-thumb .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--border); font-size: 28px; }
.card-index {
  position: absolute; left: 8px; top: 8px; background: rgba(0, 0, 0, .65);
  color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 5px; font-family: monospace;
}
.card-body { padding: 10px 11px 11px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 12px; font-weight: 500; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px;
}
.card-title:hover { color: var(--purple-2); }
.card-genre {
  align-self: flex-start; margin-top: 7px; font-size: 10px;
  padding: 2px 7px; border-radius: 4px; color: var(--green);
  background: rgba(108, 196, 122, .13);
}
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.card-date { font-size: 10px; color: var(--muted); }
.card-links { display: flex; gap: 4px; }
.card-links span { font-size: 9px; padding: 1px 5px; border-radius: 4px; }
.card-links .q { color: #7ec8ff; background: rgba(126, 200, 255, .12); }
.card-links .b { color: #8fd694; background: rgba(143, 214, 148, .12); }

.empty { text-align: center; padding: 50px; color: var(--muted); font-size: 14px; }
.empty-icon { font-size: 48px; color: var(--border); margin-bottom: 10px; }
.btn-ghost { margin-top: 14px; padding: 8px 16px; background: transparent; border: 1px solid var(--border); border-radius: 7px; color: var(--text); cursor: pointer; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 28px; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: 6px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-ellipsis { color: var(--muted); padding: 0 4px; }
.page-jump { display: flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 12px; color: var(--muted); }
.page-jump input { width: 50px; padding: 6px 8px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12px; outline: none; }

.footer { text-align: center; padding: 24px 20px 40px; color: var(--muted); font-size: 11px; line-height: 1.9; border-top: 1px solid var(--border); }

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 20;
  width: 38px; height: 38px; border-radius: 50%; background: var(--card);
  border: 1px solid var(--border); color: var(--text); font-size: 18px; cursor: pointer;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { border-color: var(--accent); }

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; z-index: 1; width: min(720px, 100%); max-height: 90vh; overflow-y: auto;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.modal-panel::-webkit-scrollbar { width: 8px; }
.modal-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.modal-close {
  position: sticky; top: 10px; float: right; margin: 12px 14px 0 0; width: 30px; height: 30px;
  border-radius: 50%; z-index: 2; background: rgba(0, 0, 0, .4); border: 1px solid var(--border);
  color: #fff; font-size: 18px; cursor: pointer; line-height: 1;
}
.modal-body { padding: 20px 24px 26px; }
.detail-title { font-size: 18px; font-weight: 600; margin-bottom: 9px; padding-right: 36px; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.detail-tag { font-size: 10px; padding: 2px 8px; border-radius: 4px; background: rgba(139, 124, 246, .15); color: var(--purple-2); }
.detail-tag.r { background: rgba(224, 164, 88, .15); color: #e0a458; }
.detail-tag.g { background: rgba(108, 196, 122, .15); color: var(--green); }
.detail-date { font-size: 11px; color: var(--muted); margin-bottom: 14px; }

.gallery-main { position: relative; background: #000; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.gallery-main img { width: 100%; display: block; max-height: 420px; object-fit: contain; }
.gallery-count { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.gallery-nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.5); color: #fff; border: none; width: 30px; height: 44px; cursor: pointer; font-size: 18px; }
.gallery-nav-btn.prev { left: 0; border-radius: 0 6px 6px 0; }
.gallery-nav-btn.next { right: 0; border-radius: 6px 0 0 6px; }
.gallery-thumbs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.gallery-thumbs::-webkit-scrollbar { height: 5px; }
.gallery-thumbs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.gallery-thumbs img { width: 72px; height: 48px; object-fit: cover; border-radius: 5px; cursor: pointer; opacity: .6; border: 2px solid transparent; flex-shrink: 0; }
.gallery-thumbs img.active { opacity: 1; border-color: var(--accent); }

.detail-section { margin-bottom: 16px; }
.detail-section h3 { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.detail-desc { font-size: 13px; color: var(--text); white-space: pre-line; line-height: 1.8; background: var(--card); padding: 12px 14px; border-radius: 8px; max-height: 340px; overflow-y: auto; }
.detail-desc::-webkit-scrollbar { width: 6px; }
.detail-desc::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px;
  border-radius: 6px; text-decoration: none; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; transition: opacity .2s;
}
.link-btn:hover { opacity: .85; }
.link-btn.quark { background: rgba(126, 200, 255, .13); border-color: rgba(126, 200, 255, .3); color: #7ec8ff; }
.link-btn.baidu { background: rgba(143, 214, 148, .13); border-color: rgba(143, 214, 148, .3); color: #8fd694; }
.link-btn.xunlei { background: rgba(255, 180, 120, .13); border-color: rgba(255, 180, 120, .3); color: #ffb478; }
.link-btn.video { background: rgba(255, 130, 160, .13); border-color: rgba(255, 130, 160, .3); color: #ff829f; }
.link-btn.copy { background: var(--card); border-color: var(--border); color: var(--muted); }
.code-badge { font-size: 12px; color: var(--muted); }
.code-badge b { color: var(--green); font-family: monospace; font-size: 13px; }

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 9px 18px; border-radius: 7px; font-size: 12px; z-index: 70;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
