:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #15181f;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --line: #e4e6eb;
  --brand: #1d4ed8;
  --brand-soft: #eef3ff;
  --hot: #c8102e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- 头部 ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #4f74ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 16px;
}

.brand-text h1 { font-size: 16px; margin: 0; font-weight: 700; }
.brand-text p { margin: 0; font-size: 12px; color: var(--muted); }

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- 加载 ---------- */

.loading {
  max-width: 640px;
  margin: 120px auto;
  text-align: center;
  color: var(--muted);
}
.loading p { margin: 0 0 8px; font-size: 15px; }
.loading .sub { font-size: 13px; }
.err { color: var(--hot); }

/* ---------- 主区 ---------- */

#app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 64px;
}

.hero { padding: 30px 0 20px; }
.hero h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: 0.2px; }
.hero p {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------- 筛选面板 ---------- */

.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.filter-head h3 { margin: 0; font-size: 14px; }

.link {
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 13px;
  padding: 2px 4px;
}

.group { margin-bottom: 16px; }

.group-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-scroll { max-height: 176px; overflow-y: auto; padding-right: 4px; }
.chips-col { flex-direction: column; align-items: stretch; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip input { display: none; }
.chip b { font-weight: 400; font-size: 11px; color: var(--muted); }
.chip:hover { border-color: #b9c6ee; }
.chip:has(input:checked) {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.chip:has(input:checked) b { color: var(--brand); }

.chips-col .chip { border-radius: 8px; justify-content: flex-start; }

.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.text-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.hint { margin: 6px 0 0; font-size: 11px; color: var(--muted); }

.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.check-line input { margin-top: 3px; accent-color: var(--brand); }

/* ---------- 结果区 ---------- */

.results { min-width: 0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.stat { font-size: 14px; color: var(--ink-2); }
.stat b { color: var(--hot); font-size: 16px; }

.q-input { max-width: 300px; margin-left: auto; }

.cards { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: #b9c6ee; box-shadow: var(--shadow); }

.card-head { display: flex; align-items: baseline; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.hc {
  flex: none;
  color: var(--hot);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.org { margin: 5px 0 0; font-size: 13px; color: var(--ink-2); }

.where {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.where .lv {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f2f4f8;
  font-size: 11px;
}

.tags { margin: 9px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  color: var(--ink-2);
  background: #f4f6fa;
  border-radius: 5px;
  padding: 2px 7px;
}

.major-line {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.major-line span {
  color: var(--ink-2);
  font-weight: 600;
  margin-right: 8px;
}

/* ---------- 详情 ---------- */

.detail {
  margin-top: 14px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
  cursor: default;
}
.detail-loading { margin: 0; color: var(--muted); font-size: 13px; }

.intro {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f8f9fc;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.detail dl { margin: 0; display: grid; gap: 8px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink-2); word-break: break-word; }

.tip {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 11px;
  background: var(--brand-soft);
  border-radius: 8px;
  color: var(--brand);
}

/* ---------- 分页 / 空态 ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}
.pager button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--ink-2);
}
.pager button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--muted); }

.empty {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
}
.empty p { margin: 0 0 8px; }
.empty ul { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.empty li { margin-top: 4px; }

/* ---------- 移动端 ---------- */

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .filters {
    position: static;
    max-height: none;
  }
  .chips-scroll { max-height: 140px; }
  .q-input { max-width: none; margin-left: 0; width: 100%; }
  .hero h2 { font-size: 19px; }
  #app { padding: 0 16px 48px; }
  .header-inner { padding: 12px 16px; }
}