:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --border: #e2e8f0;
  --text: #1f2937;
  --text-soft: #5b6675;
  --text-faint: #8a94a6;
  --brand: #1f6feb;
  --brand-soft: #e8f0fe;
  --accent: #0f9d8c;
  --warn-bg: #fff7e6;
  --warn-border: #ffe0a3;
  --warn-text: #8a5a00;
  --level-national: #6d4aff;
  --level-provincial: #1f6feb;
  --level-municipal: #0f9d8c;
  --level-district: #d98324;
  --star: #f5a623;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .06);
  --maxw: 980px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶部导航 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand-text { font-size: 18px; display: flex; align-items: baseline; gap: 6px; }
.brand-text small { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.nav { display: flex; gap: 2px; }
.nav a {
  padding: 8px 12px; min-height: var(--tap); display: inline-flex; align-items: center;
  border-radius: 10px; color: var(--text-soft); font-weight: 600; font-size: 15px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }

.app { max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 40px; }

/* 通用区块 */
.hero {
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow);
}
.kicker { display: inline-block; font-size: 13px; font-weight: 700; color: var(--accent); background: #e6f7f3; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.hero .title { display: block; font-size: clamp(22px, 5vw, 30px); font-weight: 800; margin: 4px 0; }
.hero .subtitle { color: var(--text-soft); font-size: 15px; max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 15px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a5fd0; text-decoration: none; }
.btn.ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.stat .number { display: block; font-size: clamp(22px, 6vw, 30px); font-weight: 800; color: var(--brand); }
.stat span:last-child { color: var(--text-soft); font-size: 13px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-title { font-size: 18px; font-weight: 800; }
.more { font-size: 14px; font-weight: 600; }

/* 说明框 */
.notice { margin-top: 16px; background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 12px; padding: 14px 16px; color: var(--warn-text); font-size: 14px; }
.notice .notice-title { display: block; font-weight: 800; margin-bottom: 4px; }
.fixed-copy { margin-top: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: var(--text-soft); font-size: 13px; }
.fixed-copy p { margin: 6px 0; }
.fixed-copy strong { color: var(--text); }

/* FAQ */
.faq { margin-top: 14px; display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; font-weight: 700; font-size: 15px; padding: 12px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "⌄"; float: right; color: var(--text-faint); }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq .faq-a { font-size: 14px; color: var(--text-soft); padding: 0 0 12px; }

/* 搜索与筛选 */
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 0 14px; min-height: var(--tap); box-shadow: var(--shadow); }
.search .search-icon { color: var(--text-faint); font-size: 18px; }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 10px 0; color: var(--text); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.select { position: relative; flex: 1 1 140px; min-width: 130px; }
.select select { width: 100%; min-height: var(--tap); padding: 10px 34px 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 15px; color: var(--text); appearance: none; cursor: pointer; }
.select::after { content: "⌄"; position: absolute; right: 12px; top: 50%; transform: translateY(-60%); color: var(--text-faint); pointer-events: none; font-size: 18px; }
.count { color: var(--text-soft); font-size: 14px; display: block; margin: 4px 2px 12px; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 56px 16px 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; display: flex; flex-direction: column; gap: 8px; }
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16,24,40,.10), 0 12px 28px rgba(16,24,40,.08); text-decoration: none; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-soft); }
.tag.level-national_other, .tag.level-national_whitelist { background: #efe9ff; color: var(--level-national); }
.tag.level-provincial { background: #e8f0fe; color: var(--level-provincial); }
.tag.level-municipal { background: #e6f7f3; color: var(--level-municipal); }
.tag.level-district { background: #fdf0e0; color: var(--level-district); }
.tag.category { background: #eef2f7; color: var(--text-soft); }
.status { font-size: 12px; font-weight: 700; color: var(--accent); background: #e6f7f3; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.card .name { font-size: 17px; font-weight: 800; color: var(--text); line-height: 1.4; }
.card .meta { font-size: 14px; color: var(--text-soft); }
.card .foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.card .foot .wl { color: var(--text-soft); font-weight: 600; }
.card .region-line { font-size: 13px; color: var(--text-faint); }

/* 收藏星标（卡片右上角图标按钮） */
.star { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-faint); font-size: 18px; cursor: pointer; display: grid; place-items: center; line-height: 1; transition: color .12s ease, background .12s ease; }
.star:hover { background: var(--surface-2); color: var(--text-soft); }
.star.on { color: #e09900; }

/* 详情页收藏按钮（文字药丸） */
.fav-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); font-size: 14px; font-weight: 700; cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.fav-pill:hover { background: var(--surface-2); }
.fav-pill.on { border-color: #f5d08a; background: #fff9ed; color: #b37400; }

/* 白名单卡片 */
.wl-card { flex-direction: row; align-items: flex-start; gap: 14px; }
.wl-card .num { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; font-size: 16px; }
.wl-card .body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.wl-card .wl-top { display: flex; flex-wrap: wrap; gap: 6px; }
.wl-card .wl-name { font-weight: 800; font-size: 16px; }
.wl-card .wl-org { font-size: 13px; color: var(--text-soft); }

.empty { text-align: center; color: var(--text-faint); padding: 40px 0; }
.empty .empty-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--text-soft); }

/* 详情 */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); color: var(--text-soft); font-weight: 600; }
.detail-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.detail-head h1 { font-size: clamp(20px, 5vw, 26px); margin: 6px 0 12px; line-height: 1.35; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-meta { margin-top: 14px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.detail-meta .row { display: flex; gap: 10px; font-size: 14px; }
.detail-meta .row .k { flex: 0 0 84px; color: var(--text-faint); }
.detail-meta .row .v { color: var(--text); flex: 1; }

.timeline-title { font-size: 18px; font-weight: 800; margin: 26px 0 12px; }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.tl-item::before { content: ""; position: absolute; left: -16px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--brand-soft); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.tl-type { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.tl-date { font-size: 13px; color: var(--text-faint); }
.tl-title { font-weight: 700; font-size: 15px; line-height: 1.45; }
.tl-issuer { font-size: 13px; color: var(--text-soft); margin: 4px 0; }
.tl-link { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; margin-top: 4px; word-break: break-all; }
.tl-grade { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* 白名单页说明 */
.explain { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 12px; padding: 14px 16px; margin: 16px 0; color: var(--warn-text); font-size: 14px; }
.explain .explain-title { display: block; font-weight: 800; margin-bottom: 6px; }
.explain p { margin: 4px 0; }
.source-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0; }
.source-value { font-weight: 700; }
.source-tip { font-size: 13px; color: var(--text-faint); }

/* 页脚 */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 22px 16px 40px; color: var(--text-faint); font-size: 13px; border-top: 1px solid var(--border); }
.footer-meta { font-size: 12px; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.footer-meta .meta-row { margin: 3px 0; }
.footer-meta code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.footer-note { font-weight: 700; color: var(--text-soft); margin: 0 0 4px; }
.footer-sub { margin: 0; }

/* 外链离开确认弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal[aria-hidden="false"] { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal-box { position: relative; width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.modal-body { font-size: 15px; color: var(--text-soft); margin: 0 0 10px; }
.modal-url { font-size: 13px; color: var(--text-faint); background: var(--surface-2); padding: 10px 12px; border-radius: 10px; word-break: break-all; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* 响应式 */
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .detail-meta { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .app { padding-top: 24px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 30px 28px; }
}
