:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #f5f0e8;
  --text: #1c1917;
  --text-2: #44403c;
  --muted: #78716c;
  --line: #ede6db;
  --line-strong: #e2d9cc;
  --brand: #c2410c;
  --brand-strong: #9a3412;
  --brand-soft: #fdf1e9;
  --brand-soft-2: #fbe3d4;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 8px 24px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 16px 44px rgba(28, 25, 23, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ---------- Top bar ---------- */
.topbar { padding: 32px 0 4px; }
.topbar-inner { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo {
  width: 54px; height: 54px; flex: 0 0 auto;
  border-radius: 15px;
  background: linear-gradient(135deg, #d9531e, #b03a0f);
  display: grid; place-items: center;
  box-shadow: 0 8px 18px rgba(194, 65, 12, 0.28);
}
.brand-logo svg { width: 28px; height: 28px; }
.brand-text { min-width: 0; }
.brand-text h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.brand-text p { margin: 5px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.view-all {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  margin-top: 8px; font-size: 14px; font-weight: 700;
  color: var(--brand); text-decoration: none; white-space: nowrap;
  transition: gap 0.15s;
}
.view-all svg { width: 16px; height: 16px; }
.view-all:hover { gap: 9px; }

/* ---------- Stats ---------- */
.stats-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 8px;
  margin: 24px 0 18px;
}
.stat { flex: 1; text-align: center; padding: 2px 8px; min-width: 0; }
.stat b { display: block; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat span { display: block; margin-top: 7px; font-size: 13px; color: var(--muted); }

/* ---------- Announcement ---------- */
.ann-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  margin-bottom: 18px;
}
.ann-icon {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
}
.ann-main { flex: 1; min-width: 0; }
.ann-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.ann-text { font-size: 13.5px; color: var(--muted); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.ann-close {
  flex: 0 0 auto; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; line-height: 1; padding: 4px;
  border-radius: 8px;
}
.ann-close:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Search ---------- */
.search-box { position: relative; margin-bottom: 14px; }
.search-ico {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
#search {
  width: 100%; height: 50px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 52px 0 48px;
  font-size: 14.5px; color: var(--text); outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search::placeholder { color: #a8a29e; }
#search:focus { border-color: var(--brand-soft-2); box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.08); }
.search-hint {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 12.5px; color: var(--muted);
}

/* ---------- Filter pills ---------- */
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2); font-size: 13.5px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.pill svg { width: 16px; height: 16px; color: var(--muted); }
.pill:hover { border-color: var(--line-strong); }
.pill.active { background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand); }
.pill.active svg { color: var(--brand); }

/* ---------- Category tabs ---------- */
.tabs-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab:hover { background: var(--surface-2); }
.tab .count {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); border-radius: 999px;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.tab.active { background: var(--brand); color: #fff; }
.tab.active .count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* ---------- Summary ---------- */
.summary { font-size: 13.5px; color: var(--muted); margin: 4px 0 16px; }
.summary b { color: var(--text); font-weight: 700; }

/* ---------- Grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 46px; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.card.recommended { border-color: var(--brand-soft-2); box-shadow: 0 0 0 1px var(--brand-soft-2), var(--shadow-sm); }
.badge-rec {
  position: absolute; top: 16px; right: 16px;
  font-size: 11px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--brand-soft-2);
  padding: 3px 9px; border-radius: 999px;
}
.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-right: 58px; }
.card-icon {
  width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: 13px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
}
.card-meta { min-width: 0; }
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.card-domain { font-size: 12.5px; color: var(--muted); word-break: break-all; margin-top: 2px; }

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.card-tags .tag {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); border: 1px solid var(--line);
}

.card-reason {
  font-size: 13px; color: var(--muted); line-height: 1.7;
  margin: 0 0 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.endpoint {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 10px; margin-bottom: 12px;
}
.endpoint code {
  flex: 1; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto;
  font-size: 11.5px; font-weight: 700; color: var(--brand);
  background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 6px;
}
.copy svg { width: 13px; height: 13px; }
.copy:hover { background: var(--brand-soft); }

.card-actions { display: flex; gap: 8px; margin-top: auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; border-radius: 11px;
  font-size: 13.5px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.btn-primary { flex: 1; background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost { flex: 0 0 auto; padding: 0 16px; background: var(--surface); color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }

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

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-footer .admin-link { color: var(--muted); text-decoration: none; }
.site-footer .admin-link:hover { color: var(--brand); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1c1917; color: #fff;
  padding: 11px 18px; border-radius: 12px;
  font-size: 13.5px; z-index: 99;
  box-shadow: var(--shadow-lg); max-width: 90vw;
}
.toast[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar-inner { flex-direction: column; gap: 12px; }
  .brand-text h1 { font-size: 24px; }
  .brand-text p { font-size: 12.5px; }
  .view-all { margin-top: 0; }
  .stats-card { flex-wrap: wrap; gap: 14px 4px; padding: 20px 8px; }
  .stat { flex: 1 1 40%; }
  .stat b { font-size: 28px; }
  .grid { grid-template-columns: 1fr; }
}
