:root {
  --bg: #f6f7fb;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --text: #16181d;
  --text-soft: #5c6270;
  --text-faint: #9aa1ad;
  --border: #e7e9f0;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --primary-dark: #4338ca;
  --shadow: 0 4px 18px rgba(20, 22, 40, .06);
  --shadow-hover: 0 12px 32px rgba(20, 22, 40, .12);
}

[data-theme="dark"] {
  --bg: #0d1017;
  --bg-soft: #131721;
  --bg-card: #161a26;
  --text: #eef0f5;
  --text-soft: #a3aab8;
  --text-faint: #6b7280;
  --border: #232a3a;
  --primary: #818cf8;
  --primary-soft: #1e2440;
  --primary-dark: #a5b4fc;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }

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

/* header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-soft) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; height: 60px; gap: 16px; }
.brand { font-size: 19px; font-weight: 800; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 12px var(--primary); }
.spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; transition: all .2s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.admin-link { font-size: 13px; color: var(--text-soft); padding: 6px 10px; border-radius: 8px; }
.admin-link:hover { color: var(--primary); }

/* hero */
.hero { padding: 54px 0 26px; text-align: center; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; margin: 0 0 14px; letter-spacing: -.6px; }
.hero h1 .accent { color: var(--primary); }
.hero p { color: var(--text-soft); font-size: 16px; max-width: 620px; margin: 0 auto; }
.hero .search {
  margin: 26px auto 0; max-width: 560px; display: flex; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 6px 6px 18px;
  box-shadow: var(--shadow);
}
.hero .search input { flex: 1; border: none; background: transparent; color: var(--text); font-size: 15px; outline: none; }
.hero .search button { border: none; background: var(--primary); color: #fff; padding: 9px 20px; border-radius: 999px; font-size: 14px; cursor: pointer; font-weight: 600; }
.hero .search button:hover { background: var(--primary-dark); }

/* section */
.section { padding: 34px 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-size: 20px; font-weight: 800; }
.section-title .ic { font-size: 22px; }
.section-title .more { margin-left: auto; font-size: 13px; color: var(--text-soft); font-weight: 500; }
.section-title .more:hover { color: var(--primary); }

/* primary cards */
.grid-primary { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.pcard {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.pcard .avatar {
  width: 48px; height: 48px; border-radius: 12px; object-fit: contain; background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center; font-size: 24px; padding: 5px;
}
.pcard .name { font-size: 15px; font-weight: 700; }
.pcard .desc { font-size: 12px; color: var(--text-soft); line-height: 1.4; min-height: 34px; }

/* category grid (secondary) */
.grid-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.cat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.cat-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.cat-head .ic { font-size: 20px; }
.cat-head .name { font-size: 16px; font-weight: 800; }
.cat-head .count { font-size: 11px; color: var(--text-faint); background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; }
.cat-links { display: flex; flex-wrap: wrap; gap: 7px; }
.cat-link { font-size: 13px; color: var(--text-soft); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; transition: all .15s; }
.cat-link:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }

/* list page */
.breadcrumb { padding: 26px 0 0; font-size: 13px; color: var(--text-soft); }
.breadcrumb a:hover { color: var(--primary); }
.list-hero { padding: 20px 0 8px; }
.list-hero h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.list-hero p { color: var(--text-soft); margin: 0; }
.list-grid { padding: 24px 0 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lcard { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; gap: 14px; transition: transform .18s, box-shadow .18s, border-color .18s; }
.lcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.lcard .avatar { width: 46px; height: 46px; border-radius: 12px; object-fit: contain; background: var(--primary-soft); padding: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.lcard .name { font-size: 16px; font-weight: 700; }
.lcard .desc { font-size: 13px; color: var(--text-soft); margin-top: 3px; }
.lcard .tags { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11px; color: var(--text-faint); background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 26px 0; text-align: center; color: var(--text-soft); font-size: 13px; margin-top: 20px; }

/* responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 32px; }
  .grid-primary { grid-template-columns: repeat(2, 1fr); }
  .grid-cat { grid-template-columns: 1fr; }
  .list-grid { grid-template-columns: 1fr; }
  .brand { font-size: 17px; }
}
