:root {
  /* 协调的「粮安绿 + 麦黄」配色，带层次 */
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-2: #f1f5ee;
  --text: #15241b;
  --text-soft: #5a6b5f;
  --border: #e2e9dd;
  --primary: #2f9e44;
  --primary-600: #268a3a;
  --primary-700: #1f7430;
  --primary-soft: #e7f6ec;
  --accent: #d99a2b;
  --accent-soft: #fbf1d8;
  --shadow-sm: 0 2px 8px rgba(20, 40, 25, .06);
  --shadow: 0 10px 30px rgba(20, 40, 25, .08);
  --shadow-lg: 0 18px 50px rgba(20, 40, 25, .16);
  --radius: 16px;
  --radius-sm: 11px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f6f9f3 0%, #eef3ea 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ===================== 顶部栏 ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .02);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px; font-size: 20px;
  background: linear-gradient(135deg, var(--primary), #3db85a);
  box-shadow: var(--shadow-sm);
}
.brand-name {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.search-wrap { flex: 1; display: flex; justify-content: center; }
.search-box { position: relative; width: min(560px, 100%); }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .5; pointer-events: none; }
#searchInput {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
#searchInput:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 4px rgba(47, 158, 68, .14); }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .2s, filter .2s;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--shadow); }
.btn-primary:active { transform: translateY(1px) scale(.98); }
.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s, color .2s, border-color .2s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: #cdd8c5; }
.topbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 700; text-decoration: none;
  color: var(--primary-700); background: var(--primary-soft);
  border: 1px solid transparent; white-space: nowrap;
  transition: background .2s, transform .15s var(--ease);
}
.topbar-link:hover { background: #d8f0df; transform: translateY(-1px); }

/* ===================== Hero 横幅 ===================== */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 56px 28px 60px;
  background:
    radial-gradient(120% 140% at 85% -10%, rgba(224, 163, 46, .35) 0%, transparent 55%),
    linear-gradient(135deg, #1f7430 0%, #2f9e44 55%, #3db85a 100%);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%);
  pointer-events: none;
}
.hero::before { width: 340px; height: 340px; top: -130px; right: -70px; }
.hero::after { width: 280px; height: 280px; bottom: -110px; left: -50px; background: radial-gradient(circle, rgba(224, 163, 46, .30), transparent 70%); }
.hero-inner { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; }
.hero-badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3);
  font-size: 13px; font-weight: 600; letter-spacing: .4px;
}
.hero-title {
  font-size: clamp(28px, 4.4vw, 46px); font-weight: 800; letter-spacing: -.5px;
  margin: 16px 0 12px; line-height: 1.15; text-shadow: 0 2px 14px rgba(0, 0, 0, .12);
}
.hero-sub {
  font-size: clamp(15px, 2vw, 17px); line-height: 1.75; opacity: .94;
  max-width: 660px; margin: 0;
}
.hero-stats { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.stat {
  background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 14px; padding: 14px 24px; min-width: 124px;
}
.stat-num { display: block; font-size: 30px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; opacity: .9; }

/* ===================== 布局 ===================== */
.layout { display: flex; gap: 24px; align-items: flex-start; padding: 24px 28px; }

/* 侧边栏面板化 */
.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 86px; align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.sidebar-head { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--text-soft); padding: 4px 10px 10px; text-transform: uppercase; }
.nav-tree { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; padding: 11px 14px;
  border: none; background: transparent; color: var(--text-soft);
  border-radius: 12px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s var(--ease), color .2s, transform .15s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-700)); color: #fff; box-shadow: var(--shadow-sm); }
.nav-ico { font-size: 16px; line-height: 1; }
.nav-label { flex: 1; }
.nav-count { margin-left: auto; font-size: 12px; background: var(--surface-2); color: var(--text-soft); padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.nav-item.active .nav-count { background: rgba(255, 255, 255, .25); color: #fff; }

/* ===================== 内容区 ===================== */
.content { flex: 1; min-width: 0; padding: 0; }
.section-title { position: relative; font-size: 22px; font-weight: 800; letter-spacing: -.3px; margin: 0 0 16px; padding-left: 15px; }
.section-title::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 5px; height: 22px; border-radius: 4px; background: linear-gradient(var(--primary), var(--primary-700));
}
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.result-count { color: var(--primary-700); background: var(--primary-soft); font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 999px; }
.featured-section { margin-bottom: 38px; }

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

/* 卡片：层次 + 悬浮反馈 */
.card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(16px);
  transition: transform .35s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease), opacity .5s var(--ease);
}
.card.reveal { opacity: 1; transform: translateY(0); }
.card::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: rgba(47, 158, 68, .4); }
.card:hover::after { transform: scaleX(1); }

.card-icon {
  font-size: 30px; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-soft), #d8f0df);
  border-radius: 14px;
}
.card-icon img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.card-name { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.card-cat {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--primary-700); background: var(--primary-soft);
  padding: 3px 11px; border-radius: 999px; width: fit-content;
}
.card-desc { margin: 0; font-size: 13.5px; color: var(--text-soft); line-height: 1.65; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--text-soft); background: var(--surface-2); padding: 3px 9px; border-radius: 7px; }
.card-go {
  align-self: flex-start; margin-top: 2px;
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: var(--text); color: #fff;
  padding: 9px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .2s, transform .15s var(--ease);
}
.card-go::after { content: "→"; transition: transform .2s var(--ease); }
.card-go:hover { background: linear-gradient(135deg, var(--primary), var(--primary-700)); }
.card-go:hover::after { transform: translateX(3px); }

.empty-state { text-align: center; color: var(--text-soft); padding: 70px 0; font-size: 15px; }
.empty-state::before { content: "🔍"; display: block; font-size: 40px; margin-bottom: 12px; opacity: .45; }

/* ===================== 弹窗 ===================== */
.modal {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  background: rgba(18, 30, 22, .5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .2s ease;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--surface); border-radius: 18px; width: min(480px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: popIn .25s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.icon-btn { border: none; background: transparent; font-size: 18px; cursor: pointer; color: var(--text-soft); border-radius: 8px; width: 32px; height: 32px; transition: background .2s; }
.icon-btn:hover { background: var(--surface-2); }
.add-form { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.add-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.add-form input[type=text],
.add-form input[type=url],
.add-form input:not([type]) {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; background: var(--surface-2); outline: none; font-weight: 400;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.add-form input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(47, 158, 68, .15); }
.add-form .checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.hint { font-size: 12px; color: var(--text-soft); margin: 0; line-height: 1.6; }
.hint code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }

/* ===================== 页脚 ===================== */
.site-footer { margin-top: 10px; background: var(--surface); border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1100px; margin: 0 auto; padding: 26px 28px 34px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  color: var(--text-soft); font-size: 13px;
}
.footer-logo { font-weight: 700; color: var(--text); }
.footer-note { opacity: .8; }

/* ===================== 响应式 ===================== */
@media (max-width: 860px) {
  .layout { flex-direction: column; gap: 16px; padding: 18px; }
  .sidebar { width: 100%; position: static; top: auto; }
  .sidebar-head { display: none; }
  .nav-tree { flex-direction: row; flex-wrap: wrap; }
  .nav-item { width: auto; }
  .nav-label { flex: 0 1 auto; }
  .nav-count { margin-left: 6px; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .search-wrap { order: 3; width: 100%; }
  .search-box { width: 100%; }
  .brand-name { font-size: 16px; }
  .hero { padding: 40px 18px 44px; }
  .hero-stats { gap: 10px; }
  .stat { flex: 1; min-width: 0; padding: 12px 14px; }
  .stat-num { font-size: 26px; }
  .content { padding: 0; }
  .section-title { font-size: 19px; }
}
