:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #e4e6eb;
  --text: #1c1e21;
  --text-2: #5f6672;
  --text-3: #8a919e;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --star: #f59e0b;
  --mark-bg: #fef08a;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 12px;
}
[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e8eaed;
  --text-2: #a2aab6;
  --text-3: #6b7280;
  --accent: #818cf8;
  --accent-soft: #262b45;
  --star: #fbbf24;
  --mark-bg: #4d3c00;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 34px; line-height: 1; }
.brand-text h1 { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon { position: absolute; left: 12px; font-size: 14px; opacity: .7; pointer-events: none; }
#searchInput {
  width: min(420px, 62vw);
  padding: 9px 14px 9px 36px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#searchInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }

.btn-group { display: flex; gap: 8px; }
.btn {
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon { padding: 8px 12px; font-size: 15px; }

.cat-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s;
}
.cat-chip:hover { color: var(--accent); border-color: var(--accent); }
.cat-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.main { max-width: 1200px; margin: 0 auto; padding: 20px; }
.stats-bar { font-size: 13px; color: var(--text-3); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stats-bar b { color: var(--accent); }

.cat-section {
  margin-bottom: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}
.cat-head:hover { background: var(--surface-2); }
.cat-icon { font-size: 20px; }
.cat-title { font-size: 16px; font-weight: 600; }
.cat-desc { font-size: 12px; color: var(--text-3); margin-left: 4px; }
.cat-count { margin-left: auto; font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 2px 10px; border-radius: 999px; }
.cat-arrow { font-size: 12px; color: var(--text-3); transition: transform .25s; }
.cat-section.collapsed .cat-arrow { transform: rotate(-90deg); }
.cat-section.collapsed .cat-body { display: none; }

.cat-body { padding: 4px 18px 18px; }
.cat-body.hidden { display: none; }

.group { margin-top: 16px; }
.group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.group-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  background: var(--surface);
  transition: all .2s;
  cursor: pointer;
}
.item:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-1px); }
.item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.item-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
}
.item-rels {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.item-rel {
  font-size: 11px;
  line-height: 1.4;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  text-decoration: none;
  transition: all .15s;
}
.item-rel:hover { border-color: var(--accent); color: var(--accent); }
.item-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.item-name .star { color: var(--star); font-size: 12px; }
.item-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.item-external { font-size: 11px; color: var(--text-3); margin-left: auto; opacity: .6; }

mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }

.empty-tip {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 14px;
}
.empty-tip .big { font-size: 40px; margin-bottom: 10px; }

.site-footer {
  max-width: 1200px;
  margin: 10px auto 40px;
  padding: 24px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}
.site-footer p { margin-bottom: 6px; }
.site-footer a { color: var(--accent); text-decoration: none; }

.top-btn {
  position: fixed;
  right: 24px;
  bottom: 30px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 60;
}
.top-btn.show { opacity: 1; pointer-events: auto; }
.top-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 720px) {
  .brand-sub { display: none; }
  .topbar { padding: 12px 14px; }
  .search-wrap { order: 3; flex: 1 1 100%; }
  #searchInput { width: 100%; }
  .main { padding: 14px; }
  .cat-head { padding: 12px 14px; }
  .cat-body { padding: 2px 14px 14px; }
  .group-items { grid-template-columns: 1fr; }
}

/* ===== ez.lol 风格：分类总览卡片 ===== */
.overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.cat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all .2s;
}
.cat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-card-icon { font-size: 30px; line-height: 1.2; }
.cat-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.cat-card-count { font-size: 12px; color: var(--text-3); }
.cat-card-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all .25s;
}
.cat-card:hover .cat-card-desc { opacity: 1; max-height: 90px; margin-top: 4px; }

.back-btn {
  margin-bottom: 14px;
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.cat-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.cat-detail-icon { font-size: 34px; }
.cat-detail-title { font-size: 18px; font-weight: 600; }
.cat-detail-desc { font-size: 12px; color: var(--text-3); width: 100%; }
.cat-detail-count { margin-left: auto; font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 4px 12px; border-radius: 999px; white-space: nowrap; }

.all-cat-block { margin-bottom: 22px; }
.all-cat-block .cat-head { border-radius: var(--radius); border: 1px solid var(--border); }

.result-meta { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.result-meta b { color: var(--accent); }

@media (max-width: 720px) {
  .overview { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .cat-card-desc { opacity: 1; max-height: none; }
}
