:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f0ee;
  --ink: #17171a;
  --muted: #74747c;
  --line: #e8e7e4;
  --accent: #c5221f;
  --accent-soft: #fbeceb;
  --hurt: #c46a00;
  --hurt-soft: #fbf1e4;
  --pending: #4f5bd5;
  --pending-soft: #eceefc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 4px 16px rgba(20, 20, 30, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111113; --surface: #1a1a1d; --surface-2: #232327; --ink: #ededef; --muted: #9a9aa3;
    --line: #2b2b30; --accent: #f2665e; --accent-soft: #3a1d1c; --hurt: #f0a44a; --hurt-soft: #36281a;
    --pending: #9aa3ff; --pending-soft: #23264a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #111113; --surface: #1a1a1d; --surface-2: #232327; --ink: #ededef; --muted: #9a9aa3;
  --line: #2b2b30; --accent: #f2665e; --accent-soft: #3a1d1c; --hurt: #f0a44a; --hurt-soft: #36281a;
  --pending: #9aa3ff; --pending-soft: #23264a; --shadow: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6; font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.top { position: sticky; top: 0; z-index: 1000; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.brand h1 { font-size: 1.05rem; font-weight: 650; margin: 0; letter-spacing: .01em; }
.tagline { margin: 0; color: var(--muted); font-size: .78rem; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: none; border: 0; padding: 6px 14px; border-radius: 999px; color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 概览数字 */
.summary { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; margin: 28px 0 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.kpi { padding: 16px 20px; border-left: 1px solid var(--line); }
.kpi:first-child { border-left: 0; }
.kpi b { display: block; font-size: 1.6rem; font-weight: 650; line-height: 1.2; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .8rem; }
.kpi.red b { color: var(--accent); }

.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 筛选 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select, form input, form select, form textarea {
  font: inherit; font-size: .9rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filters select { padding-right: 8px; cursor: pointer; }
.filters input:focus, .filters select:focus, form input:focus, form select:focus, form textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--surface-2); }
.filters input { flex: 1 1 260px; }
.count { color: var(--muted); font-size: .82rem; margin: 14px 0 10px; }

/* 事件列表 */
.timeline { list-style: none; padding: 0; margin: 0 0 40px; display: grid; gap: 10px; }
.item { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 34px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.item:hover, .item:focus-visible { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); box-shadow: var(--shadow); outline: none; }
.item::before { content: ""; position: absolute; left: 16px; top: 23px; width: 8px; height: 8px; border-radius: 50%; background: var(--hurt); }
.item.dead::before { background: var(--accent); }
.item.pending::before { background: var(--pending); }
.item-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .82rem; }
.item time { font-weight: 600; font-variant-numeric: tabular-nums; }
.item .place { color: var(--muted); }
.item h3 { margin: 6px 0 4px; font-size: 1.02rem; font-weight: 620; line-height: 1.45; }
.item p { margin: 0; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item p.suspect { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .8rem; }
.avatar { width: 20px; height: 20px; object-fit: cover; border-radius: 50%; vertical-align: -5px; margin-right: 4px; border: 1px solid var(--line); background: var(--surface-2); }

.tag { font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; line-height: 1.6; }
.tag.dead { color: var(--accent); background: var(--accent-soft); }
.tag.hurt { color: var(--hurt); background: var(--hurt-soft); }
.tag.pending { color: var(--pending); background: var(--pending-soft); }
.tag.convicted { color: var(--ink); background: var(--surface-2); }
.empty { color: var(--muted); padding: 40px 24px; text-align: center; list-style: none; }

/* 地图 */
#map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.note { color: var(--muted); font-size: .8rem; }

/* 卡片 / 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .06em; }
.card ul { padding-left: 18px; margin: 0; }
.card li { margin: 4px 0; }
.bars .bar { display: grid; grid-template-columns: 84px 1fr 32px; align-items: center; gap: 10px; font-size: .85rem; margin: 8px 0; }
.bars .fill { height: 8px; background: var(--accent); border-radius: 999px; min-width: 4px; }
.bars .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* 表单 */
.form-card { max-width: 720px; margin-bottom: 40px; }
.form-card h2 { margin: 0 0 6px; font-size: 1.15rem; }
.muted { color: var(--muted); font-size: .9rem; }
form { margin-top: 18px; }
form label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--muted); margin-bottom: 14px; flex: 1 1 160px; }
form .row { display: flex; flex-wrap: wrap; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: inherit; font-size: .88rem; font-weight: 500; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; transition: background .15s, opacity .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary:hover { opacity: .88; background: var(--ink); }
.form-msg { color: var(--accent); min-height: 1.4em; font-size: .85rem; }

/* 详情弹窗 */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); max-width: 600px; width: calc(100% - 32px); max-height: calc(100vh - 48px); padding: 26px; box-shadow: 0 24px 64px rgba(0,0,0,.18); }
dialog[open] { animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
dialog::backdrop { background: rgba(10,10,14,.4); backdrop-filter: blur(3px); }
dialog .photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; margin-bottom: 16px; }
dialog h2 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 650; line-height: 1.4; }
dialog dl { display: grid; grid-template-columns: 72px 1fr; gap: 10px 14px; margin: 20px 0; font-size: .9rem; }
dialog dt { color: var(--muted); font-size: .82rem; padding-top: 1px; }
dialog dd { margin: 0; overflow-wrap: anywhere; }
dialog dd a { font-size: .82rem; }
dialog .actions { justify-content: flex-end; }

.suspects { display: flex; flex-wrap: wrap; gap: 12px; }
.suspect-card { margin: 0; width: 100px; }
.suspect-card img { width: 100px; height: 124px; object-fit: cover; border-radius: 10px; display: block; background: var(--surface-2); }
.suspect-card figcaption { font-size: .76rem; line-height: 1.4; margin-top: 6px; }
.suspect-card figcaption b { display: block; font-weight: 600; }
.suspect-card figcaption span { color: var(--muted); }

.foot { color: var(--muted); font-size: .78rem; padding-top: 16px; padding-bottom: 40px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .summary { grid-auto-flow: row; grid-template-columns: 1fr 1fr; margin-top: 18px; }
  .kpi { border-left: 0; border-top: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi b { font-size: 1.35rem; }
  #map { height: 420px; }
  .filters select { flex: 1 1 40%; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding: 6px 10px; }
  dialog { padding: 20px; }
  dialog dl { grid-template-columns: 1fr; gap: 2px; }
  dialog dd { margin-bottom: 10px; }
}
