:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d1f24;
  --muted: #6b7280;
  --border: #ebedf0;
  --primary: #5b5bf5;
  --primary-soft: #eef0ff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 20px rgba(16, 24, 40, .08);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #6a5cf6, #9b5cf6);
  box-shadow: var(--shadow-sm);
}
.brand-text { letter-spacing: .5px; }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}
#search {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fafbfc;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
#search:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(91, 91, 245, .12);
}
.clear-btn {
  position: absolute;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #e3e5e9;
  color: #555;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.submit-btn {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6a5cf6, #9b5cf6);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s;
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- 顶部 Hero ---------- */
.hero {
  background: linear-gradient(135deg, #6a5cf6 0%, #8b5cf6 48%, #a855f7 100%);
  color: #fff;
  padding: 56px 20px 48px;
  text-align: center;
}
.hero-inner { max-width: 880px; margin: 0 auto; }
.hero-title {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: .5px;
}
.hero-title span {
  background: linear-gradient(90deg, #fff, #ecd9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  font-size: 15px;
  line-height: 1.75;
  color: rgba(255, 255, 255, .92);
  margin: 0 auto 28px;
  max-width: 640px;
}

/* ---------- 分类快捷导航 ---------- */
.catnav {
  position: sticky;
  top: 64px;
  z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.catnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.catnav-inner::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: #f1f2f5;
  color: #444;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.cat-pill:hover { background: #e6e7eb; }
.cat-pill.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 内容区 ---------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.content { flex: 1; min-width: 0; }

/* ---------- 左侧导航栏 ---------- */
.sidebar {
  display: none;                 /* 移动端隐藏，用顶部胶囊导航 */
  width: 212px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding: 4px 0 10px;
  border-right: 1px solid var(--border);
}
.sidebar-title {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 14px 8px;
  letter-spacing: .5px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  margin: 2px 6px;
  border-radius: 9px;
  color: #444;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.side-item:hover { background: #f1f2f5; }
.side-item .emoji { font-size: 16px; }
.side-item .label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 16px;
}
.section-head h2 { font-size: 20px; margin: 0; }
#catalog .section-head h2 { position: relative; padding-left: 13px; }
#catalog .section-head h2::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 19px;
  border-radius: 4px;
  background: linear-gradient(135deg, #6a5cf6, #9b5cf6);
}
.section-sub { color: var(--muted); font-size: 13px; }
#catalog .section-head:first-child { margin-top: 8px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 14px;
}

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  overflow: hidden;
  display: flex;
  gap: 12px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #d9d6ff;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6a5cf6, #9b5cf6);
  opacity: 0;
  transition: opacity .14s ease;
}
.card:hover::before { opacity: 1; }
.card-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: var(--shadow-sm);
}
.card-body { min-width: 0; }
.card-name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-name .go {
  opacity: 0;
  color: var(--primary);
  font-size: 13px;
  transition: opacity .12s;
}
.card:hover .card-name .go { opacity: 1; }
.card-desc {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--muted);
  background: #f1f2f5;
  border-radius: 6px;
}

/* 热门推荐卡片稍大 */
#featured-grid .card { padding: 18px; }
#featured-grid .card-avatar { width: 46px; height: 46px; font-size: 19px; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
.empty-state p { font-size: 18px; margin: 0 0 6px; color: var(--text); }
.empty-state span { font-size: 14px; }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: #fff;
  margin-top: 44px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 38px 20px 26px;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 36px;
}
.footer-brand .brand { margin-bottom: 12px; }
.footer-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  max-width: 300px;
  margin: 0;
}
.footer-disclaimer h4 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--text);
}
.footer-disclaimer p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.75;
  margin: 0 0 10px;
}
.footer-bottom {
  border-top: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-text { display: none; }
  .submit-btn { padding: 8px 12px; font-size: 13px; }
  main { padding: 18px 12px 50px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card { padding: 12px; }
  .card-avatar { width: 34px; height: 34px; font-size: 15px; }
  .hero { padding: 38px 16px 32px; }
  .hero-title { font-size: 25px; }
  .hero-sub { font-size: 13.5px; margin-bottom: 22px; }
  .footer-inner { grid-template-columns: 1fr; gap: 22px; padding: 28px 16px 20px; }
  .footer-bottom { flex-direction: column; gap: 4px; }
}

/* 左侧栏仅在宽屏显示；移动端改用顶部胶囊导航 */
@media (min-width: 900px) {
  .sidebar { display: block; }
  .catnav { display: none; }
}

/* 搜索时隐藏导航（分类被动态过滤，导航此时失去意义） */
.searching .sidebar,
.searching .catnav { display: none !important; }
