:root {
  --primary: #5448f0;
  --primary-2: #7a5cf0;
  --bg: #f4f5f8;
  --card: #fff;
  --text: #333;
  --text-2: #888;
  --border: #e8e9ef;
  --shadow: 0 2px 8px rgba(20, 20, 40, 0.05);
  --radius: 12px;
}
[data-theme='dark'] {
  --bg: #12131a;
  --card: #1c1e27;
  --text: #e6e6ec;
  --text-2: #9a9ab0;
  --border: #2a2d3a;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.25s, color 0.25s;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
.hide { display: none !important; }

/* ---------- 顶栏 ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); flex-shrink: 0; }
.logo img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--text); font-size: 14px; white-space: nowrap;
}
.nav a:hover, .nav a.on { background: rgba(84, 72, 240, 0.08); color: var(--primary); }
.nav-item { position: relative; display: flex; }
.nav-item > a { display: flex; align-items: center; gap: 5px; }
.nav-arrow { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: 0.6; }
.nav-drop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 120;
  display: none; min-width: 200px; padding: 8px;
  grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 2px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.nav-item:hover .nav-drop, .nav-item:focus-within .nav-drop { display: grid; }
.nav-drop a { border-radius: 8px; padding: 7px 10px; }
.nav a.on, .nav-item:hover > a { background: rgba(84, 72, 240, 0.08); color: var(--primary); }
.header-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-login {
  padding: 6px 14px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--text); font-size: 14px; white-space: nowrap;
}
.btn-login:hover { border-color: var(--primary); color: var(--primary); }
.burger { display: none; flex-direction: column; gap: 4px; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; align-items: center; justify-content: center; }
.burger span { display: block; width: 16px; height: 2px; background: var(--text); border-radius: 2px; }

/* ---------- 布局 ---------- */
.home-outer, .list-outer { display: grid; grid-template-columns: 250px 1fr; gap: 20px; padding-top: 20px; padding-bottom: 40px; }

/* ---------- 侧栏 ---------- */
.sidebar { position: sticky; top: 76px; align-self: start; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; max-height: calc(100vh - 92px); overflow-y: auto; }
.cat-tree { padding: 14px 12px; }
.cat-tree h4 { margin: 0 0 10px; font-size: 15px; color: var(--text); }
.cat-tree ul { list-style: none; margin: 0; padding: 0; }
.cat-tree .cat > a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 14px;
}
.cat-tree .cat > a:hover { background: rgba(84, 72, 240, 0.08); color: var(--primary); }
.cat-tree .count { font-size: 12px; color: var(--text-2); background: var(--bg); border-radius: 999px; padding: 0 8px; }
.cat-sub { padding-left: 12px; }
.cat-sub a { display: block; padding: 5px 10px; font-size: 13px; color: var(--text-2); border-radius: 6px; }
.cat-sub a:hover { color: var(--primary); background: rgba(84, 72, 240, 0.06); }

/* ---------- 搜索 hero ---------- */
.search-hero { padding: 18px 20px; margin-bottom: 20px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-radius: 16px; color: #fff; }
.search-hero h1 { margin: 0 0 4px; font-size: 22px; }
.search-hero .sub { margin: 0 0 14px; font-size: 13px; opacity: 0.9; }
.search-hero .sub strong { font-size: 15px; }
.search-box { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 10px; padding: 10px 14px; color: var(--text-2); }
.search-box svg { flex-shrink: 0; }
.search-box input { flex: 1; border: 0; outline: 0; font-size: 15px; color: var(--text); background: transparent; }
.search-results { margin-top: 10px; background: #fff; border-radius: 10px; overflow: hidden; color: var(--text); }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-results a:hover { background: #f5f5ff; }
.search-results a:last-child { border-bottom: 0; }
.search-results img { width: 24px; height: 24px; border-radius: 6px; }
.search-results .sr-name { font-weight: 600; }
.search-results .sr-desc { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .sr-none { padding: 12px 14px; text-align: center; color: var(--text-2); }

/* ---------- 分类区块 ---------- */
.cat-section { margin-bottom: 26px; }
.sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sec-head h2 { margin: 0; font-size: 18px; }
.sec-head h2 a { color: var(--text); }
.sec-head h2 a:hover { color: var(--primary); }
.sec-head .more { margin-left: auto; font-size: 13px; color: var(--text-2); }
.sec-head .more:hover { color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--text-2); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chips-more { font-size: 12px; color: var(--text-2); }

/* ---------- 工具卡片 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.site-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.site-card:hover { transform: translateY(-2px); border-color: rgba(84, 72, 240, 0.4); box-shadow: 0 6px 18px rgba(30, 30, 80, 0.1); }
.site-icon { position: relative; width: 40px; height: 40px; flex-shrink: 0; }
.site-icon .tile {
  position: absolute; inset: 0; display: grid; place-items: center;
  border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 700; font-size: 18px;
}
.site-icon img { position: relative; width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.site-icon.lg { width: 64px; height: 64px; }
.site-icon.lg img { width: 64px; height: 64px; border-radius: 14px; }
.site-icon.lg .tile { border-radius: 14px; font-size: 26px; }
.site-body { flex: 1; min-width: 0; }
.site-name { margin: 0 0 2px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-name a { color: var(--text); }
.site-name a:hover { color: var(--primary); }
.site-desc { margin: 0; font-size: 12px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.site-detail { position: absolute; right: 8px; bottom: 6px; font-size: 12px; color: var(--primary); opacity: 0; transition: opacity 0.15s; }
.site-card:hover .site-detail { opacity: 1; }
.badge { display: inline-block; margin-top: 4px; padding: 0 6px; font-size: 11px; color: #16a34a; background: rgba(22, 163, 74, 0.1); border-radius: 4px; }

/* ---------- 列表/详情 ---------- */
.crumb { font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.crumb a { color: var(--text-2); }
.crumb a:hover { color: var(--primary); }
.crumb em { margin: 0 6px; font-style: normal; }
.list-main h1, .info-page h1, .seo-page h1 { margin: 0 0 6px; font-size: 24px; }
.page-desc { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }

.detail-card { display: flex; gap: 20px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; align-items: flex-start; }
.detail-info h1 { margin: 0 0 8px; font-size: 26px; }
.detail-info .site-desc { font-size: 14px; -webkit-line-clamp: unset; margin-bottom: 12px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; font-size: 13px; color: var(--text-2); }
.tag { padding: 2px 10px; background: var(--bg); border-radius: 999px; font-size: 12px; color: var(--text-2); }
.tag.free { color: #16a34a; background: rgba(22, 163, 74, 0.1); }
.btn-go { display: inline-block; padding: 10px 22px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-radius: 10px; font-weight: 600; box-shadow: 0 4px 12px rgba(84, 72, 240, 0.3); }
.btn-go:hover { opacity: 0.9; color: #fff; }

/* ---------- 跳转页 ---------- */
.go-page { min-height: 60vh; display: grid; place-items: center; padding: 40px 16px; }
.go-card { text-align: center; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.go-card .site-icon { margin: 0 auto 14px; }
.go-card h1 { margin: 0 0 10px; font-size: 20px; }
.go-card .site-desc { margin-bottom: 12px; }
.go-tip { font-size: 13px; color: var(--text-2); margin: 0 0 14px; }
.go-note { font-size: 12px; color: var(--text-2); margin: 14px 0 0; word-break: break-all; }

/* ---------- 文章/长尾 ---------- */
.seo-page { padding-top: 20px; padding-bottom: 40px; }
.article { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.article h1 { margin: 0 0 6px; }
.updated { font-size: 12px; color: var(--text-2); margin: 0 0 18px; }
.article h2 { font-size: 18px; margin: 26px 0 10px; padding-left: 10px; border-left: 3px solid var(--primary); }
.article .faq { margin: 0 0 8px; padding-left: 20px; }
.article .faq li { margin-bottom: 6px; }

/* ---------- 占位页 ---------- */
.info-page { padding-top: 24px; padding-bottom: 40px; }
.notice { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 10px; padding: 16px 18px; margin: 16px 0; box-shadow: var(--shadow); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 20px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding: 18px 16px; font-size: 13px; color: var(--text-2); }
.footer-in a { color: var(--text-2); }
.footer-in a:hover { color: var(--primary); }
.footer-in p { margin: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .home-outer, .list-outer { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .cat-tree { display: none; }
  .detail-card { flex-direction: column; }
  .burger { display: flex; }
  .nav { position: absolute; top: 60px; left: 0; right: 0; background: var(--card); flex-direction: column; padding: 10px 16px; border-bottom: 1px solid var(--border); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 10px; }
  .nav-item { display: block; }
  .nav-drop {
    position: static; display: grid; width: auto; min-width: 0; margin: 2px 0 6px;
    padding: 4px 0 4px 12px; border: 0; box-shadow: none; border-left: 2px solid var(--border);
  }
  .nav-item:hover .nav-drop, .nav-item:focus-within .nav-drop { display: grid; }
}