:root {
  --primary: #4f6ef7;
  --primary-dark: #3b56d4;
  --accent: #7c5cff;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --text-sub: #6b7280;
  --border: #e7eaf0;
  --sidebar-bg: #ffffff;
  --sidebar-text: #3a3f51;
  --sidebar-text-sub: #8a8fa1;
  --sidebar-active: #eef1ff;
  --sidebar-hover: #f7f8fc;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(30, 40, 80, 0.06), 0 8px 24px rgba(30, 40, 80, 0.05);
  --sidebar-width: 230px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ===== 侧边栏 ===== */
.site-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px;
  font-weight: 800; font-size: 18px;
}
.sidebar-brand .logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.sidebar-brand .logo-text { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.sidebar-search {
  margin: 0 14px 8px; padding: 0 12px;
  display: flex; align-items: center;
  background: #f1f3f8; border-radius: 8px; height: 36px;
  position: relative;
}
.sidebar-search-icon { display: flex; align-items: center; color: var(--text-sub); margin-right: 6px; }
.sidebar-search-icon svg { width: 16px; height: 16px; }
.sidebar-search input { flex: 1; border: none; background: transparent; outline: none; font-size: 13px; color: var(--text); }
.sidebar-search input::placeholder { color: #a4a8b6; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 6px 8px 12px;
}
.sidebar-menu { list-style: none; }
.sidebar-item { position: relative; }
.sidebar-link-row { display: flex; align-items: center; }
.sidebar-link-row.active .sidebar-link { background: var(--sidebar-active); color: var(--primary); font-weight: 600; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
  flex: 1; min-width: 0;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--primary); }
.sidebar-link.active { background: var(--sidebar-active); color: var(--primary); font-weight: 600; }
.sidebar-icon { display: inline-flex; align-items: center; color: currentColor; opacity: .9; flex-shrink: 0; }
.sidebar-icon svg { width: 18px; height: 18px; }
.sidebar-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-more {
  color: var(--sidebar-text-sub); display: inline-flex; align-items: center;
  padding: 6px 8px; cursor: pointer; border-radius: 6px; transition: transform .2s;
}
.sidebar-more:hover { color: var(--primary); }
.sidebar-item.open .sidebar-more { transform: rotate(90deg); }

.sidebar-submenu {
  list-style: none; max-height: 0; overflow: hidden;
  transition: max-height .25s ease;
  padding-left: 26px;
}
.sidebar-item.open .sidebar-submenu { max-height: 600px; }
.sidebar-sublink {
  display: block; padding: 6px 12px; border-radius: 6px;
  color: var(--sidebar-text-sub); font-size: 13px;
  transition: color .15s, background .15s;
}
.sidebar-sublink:hover { color: var(--primary); background: var(--sidebar-hover); }

.sidebar-bottom { padding: 8px; border-top: 1px solid var(--border); }

/* ===== 主内容区 ===== */
.main-wrap {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ===== Hero / 通用区块 ===== */
.hero { padding: 36px 0 18px; }
.hero h1 { font-size: 30px; font-weight: 800; margin-bottom: 10px; }
.hero h1 .grad { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--text-sub); font-size: 15px; }

.section { padding: 16px 0 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title .bar { display: inline-block; width: 4px; height: 18px; background: linear-gradient(180deg, var(--primary), var(--accent)); border-radius: 2px; }
.section-title .cat-icon { display: inline-flex; align-items: center; color: var(--primary); }
.section-title .cat-icon svg { width: 18px; height: 18px; }
.section-more { color: var(--primary); font-size: 13px; }
.section-more:hover { text-decoration: underline; }

/* ===== 工具卡片 ===== */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tool-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(79, 110, 247, 0.16); }
.card-top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 11px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.card-title-wrap { flex: 1; min-width: 0; }
.card-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-cat { font-size: 12px; color: var(--text-sub); }
.badges { display: flex; gap: 4px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.badge-hot { background: #fef2f2; color: #ef4444; }
.badge-new { background: #eff6ff; color: var(--primary); }
.card-desc { color: var(--text-sub); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; color: var(--primary); background: #eef1ff; padding: 2px 8px; border-radius: 6px; }
.visit { display: flex; align-items: center; gap: 2px; color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }

.empty { text-align: center; color: var(--text-sub); padding: 60px 0; }

/* ===== 分类页 ===== */
.page-head { padding: 28px 0 6px; }
.page-head h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.page-head p { color: var(--text-sub); font-size: 14px; }
.filter-bar { display: flex; align-items: center; gap: 12px; padding: 6px 0 14px; flex-wrap: wrap; }
.filter-bar .result-count { color: var(--text-sub); font-size: 14px; }
.sort-select { margin-left: auto; }
.sort-select select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px; outline: none; color: var(--text); }

/* ===== 详情页 ===== */
.detail-wrap { padding: 24px 0; }
.detail-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.detail-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.detail-head .avatar { width: 64px; height: 64px; border-radius: 16px; font-size: 28px; }
.detail-title { font-size: 24px; font-weight: 800; }
.detail-meta { color: var(--text-sub); margin-top: 4px; font-size: 14px; }
.detail-desc { font-size: 15px; color: var(--text); margin-bottom: 18px; }
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.btn-visit { display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; padding: 11px 24px; border-radius: 10px; font-size: 15px; font-weight: 600; }
.btn-visit:hover { opacity: .92; }
.related-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }

/* ===== 关于页 ===== */
.about-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.about-card h2 { margin: 22px 0 8px; font-size: 17px; }
.about-card p, .about-card li { color: var(--text-sub); margin-bottom: 8px; font-size: 14px; }
.about-card ul { padding-left: 20px; }

/* ===== 底部 ===== */
.site-footer { background: #1c2030; color: #c6cad6; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 32px; padding: 36px 20px 20px; }
.footer-brand p { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.footer-col h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-col a { display: block; font-size: 13px; margin-bottom: 8px; opacity: .85; }
.footer-col a:hover { color: #fff; opacity: 1; }
.footer-note { font-size: 12px; line-height: 1.7; opacity: .7; }
.footer-logo .logo-mark { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.footer-logo .logo-text { -webkit-text-fill-color: #fff; background: none; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.footer-bottom .container { padding: 16px 20px; font-size: 13px; opacity: .7; text-align: center; }

/* ===== 响应式 ===== */
@media (max-width: 820px) {
  :root { --sidebar-width: 64px; }
  .sidebar-brand .logo-text, .sidebar-text, .sidebar-search, .sidebar-more { display: none; }
  .sidebar-link { justify-content: center; padding: 12px 0; }
  .hero h1 { font-size: 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .footer-grid { grid-template-columns: 1fr; }
}