:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --panel2: #f6f6f6;
  --raise: #ffffff;
  --border: #efefed;
  --border2: #e5e3df;
  --fg: #2c2620;
  --fg-dim: #6d6155;
  --muted: #7b6e5e;
  --accent: #c26a3c;
  --accent2: #a9542c;
  --accent-ink: #fffaf3;
  --accent-soft: rgba(194, 106, 60, 0.05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Hoefler Text", Georgia, "Songti SC", STSong, "Noto Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.6 var(--sans);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main, .topbar, .footer { position: relative; }
a { color: var(--accent2); text-decoration: none; text-underline-offset: 3px; }
button, input { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent2); color: var(--accent-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 4px; }

/* 让搜索和目录成为首页主体，以纯白底色配合宋体和棕色点缀。 */
.topbar, .hero, .catalog, .footer {
  width: min(100% - 80px, 1280px);
  margin-inline: auto;
}
.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border2);
}
.brand { display: inline-flex; align-items: baseline; color: var(--fg); }
.brand-mark { font: 600 24px var(--serif); }
.brand-tld { font: italic 17px var(--serif); color: var(--accent2); }
.topbar-meta { display: inline-flex; align-items: center; gap: 10px; }
.topbar-note { font-size: 12px; color: var(--fg-dim); }
.seal {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent2);
  font: 11px var(--serif);
  transform: rotate(-10deg);
}
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding-block: 30px 28px;
}
.hero h1 {
  margin: 0;
  font: 600 clamp(25px, 2.5vw, 34px)/1.3 var(--serif);
  letter-spacing: -.025em;
}
.ink { color: var(--accent2); white-space: nowrap; }
.lead { margin: 8px 0 0; color: var(--fg-dim); font-size: 14px; }
.search-wrap { position: relative; flex: 0 1 360px; min-width: 260px; }
.search {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 42px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--fg);
  background: var(--raise);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { position: absolute; top: 14px; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: 12px/1 var(--mono);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap:focus-within .search-kbd { display: none; }

.catalog { padding-bottom: 30px; }
.catalog-head {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 10px;
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
}
.catalog-title { flex: none; margin: 0; font: 600 17px var(--serif); }
.filters { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 13px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.chip:hover { color: var(--accent2); background: var(--panel2); }
.chip.active { color: var(--accent2); background: var(--accent-soft); border-color: rgba(169, 84, 44, .22); font-weight: 600; }
.chip-count { font: 11px var(--mono); }
.result-count { flex: none; margin-left: auto; font-size: 12px; color: var(--fg-dim); font-variant-numeric: tabular-nums; }

/* 多列目录：每件工具一行，信息分为名称、用途和类别。 */
.tool-directory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 28px;
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.tool-entry {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 78px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.tool-entry:hover, .tool-entry:focus-within { background: var(--panel); }
.tool-entry.hidden { display: none; }
.tool-icon { display: grid; place-items: center; width: 28px; height: 28px; font-size: 24px; line-height: 1; }
.tool-icon img { display: block; width: 28px; height: 28px; }
.tool-copy { min-width: 0; }
.tool-heading { display: flex; align-items: center; gap: 6px; }
.tool-name { min-width: 0; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; }
.tool-link { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--fg); }
/* 名称作为锚文本，点击与键盘焦点覆盖整个目录项。 */
.tool-link::after { content: ""; position: absolute; inset: 0; cursor: pointer; }
.tool-entry:hover .tool-link, .tool-link:focus-visible { color: var(--accent2); text-decoration: underline; }
.tool-link:focus-visible { outline: none; }
.tool-link:focus-visible::after { outline: 2px solid var(--accent2); outline-offset: 2px; border-radius: 3px; }
.tool-tagline { overflow: hidden; margin: 3px 0 0; font-size: 12px; color: var(--fg-dim); line-height: 1.5; white-space: nowrap; text-overflow: ellipsis; }
.tool-meta { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tool-category { font-size: 10px; line-height: 1.5; color: var(--fg-dim); }
.tool-arrow { color: var(--accent2); font-size: 14px; line-height: 1; }
.badge { flex: none; padding: 1px 4px; border-radius: 3px; font-size: 10px; line-height: 1.5; font-weight: 500; }
.badge-featured { color: var(--accent2); background: var(--accent-soft); }
.badge-beta { color: #785514; background: rgba(176, 122, 31, .12); }
.badge-draft { color: var(--fg-dim); background: var(--panel2); }
.empty { padding: 56px 16px; text-align: center; color: var(--fg-dim); }
.empty p { margin: 0 0 16px; }
.reset-button { min-height: 44px; padding: 8px 16px; border: 1px solid var(--border2); border-radius: 5px; color: var(--accent2); background: var(--raise); font-size: 14px; }
.reset-button:hover { border-color: var(--accent); }

.footer { display: flex; align-items: baseline; flex-wrap: wrap; gap: 16px; padding-block: 20px 32px; border-top: 1px solid var(--border2); color: var(--fg-dim); font-size: 12px; }
.footer-mark { font: 600 16px var(--serif); color: var(--fg); }
.footer-line { font-style: italic; }
.footer-copy { margin-left: auto; }
.footer-copy a { color: inherit; }
.footer a:hover { text-decoration: underline; }

@media (max-width: 1199px) {
  .tool-directory { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; }
  .catalog-head { flex-wrap: wrap; gap: 8px 16px; }
  .filters { order: 1; width: 100%; }
}
@media (max-width: 899px) {
  .topbar, .hero, .catalog, .footer { width: calc(100% - 48px); }
  .tool-directory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { gap: 20px; }
  .hero h1 { font-size: 27px; }
  .search-wrap { flex-basis: 300px; }
}
@media (max-width: 639px) {
  .topbar, .hero, .catalog, .footer { width: calc(100% - 32px); }
  .topbar { min-height: 58px; }
  .topbar-note { font-size: 11px; }
  .seal { display: none; }
  .hero { display: block; padding-block: 22px; }
  .hero h1 { font-size: 27px; }
  .lead { font-size: 13px; }
  .search-wrap { min-width: 0; margin-top: 18px; }
  .search-kbd { display: none; }
  .catalog-head { padding-block: 12px 0; gap: 6px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding-block: 6px; }
  .chip { min-height: 44px; padding-inline: 12px; }
  .tool-directory { grid-template-columns: 1fr; margin-top: 0; }
  .tool-entry { min-height: 74px; gap: 12px; padding-inline: 6px; }
  .tool-name { font-size: 16px; }
  .tool-tagline { font-size: 13px; }
  .tool-meta { flex-direction: row; gap: 10px; }
  .tool-category { font-size: 11px; }
  .footer { gap: 8px 16px; }
  .footer-line { display: none; }
}
@media (pointer: coarse) { .chip { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
