:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #fcfcfb;
  --surface-2: #f0efeb;
  --line: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #8a8983;
  --accent: #2a78d6;
  --accent-soft: #e6effa;
  --high: #d03b3b;
  --high-soft: #fbeaea;
  --med: #c27a12;
  --med-soft: #fbf1e1;
  --low: #8a8983;
  --low-soft: #efeeea;
  --ok: #2f8a4c;
  --cat-code: #2a78d6;
  --cat-video: #c2410c;
  --cat-social: #7c3aed;
  --cat-forum: #0f766e;
  --cat-news: #a16207;
  --cat-chinese: #be123c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #222220; --line: #33332f;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8c8b84;
    --accent: #3987e5; --accent-soft: #1b2a3d;
    --high: #ef6b6b; --high-soft: #3a1f1f; --med: #e2a14a; --med-soft: #3a2c17; --low: #9a998f; --low-soft: #2a2a27;
    --ok: #5cbf7a;
    --cat-code: #5b9cf0; --cat-video: #f08a5d; --cat-social: #a78bfa; --cat-forum: #4fbfb3; --cat-news: #e0b24f; --cat-chinese: #f17195;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { font-weight: 700; font-size: 14px; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a { font-size: 13px; color: var(--text-2); padding: 4px 10px; border-radius: 999px; }
.nav-links a.on, .nav-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.spacer { flex: 1; }
.pill-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 12px; cursor: pointer; }
.pill-btn:hover { border-color: var(--text-3); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }
.eyebrow { font-size: 12px; color: var(--text-2); font-weight: 600; letter-spacing: .04em; }
h1 { font-size: 28px; line-height: 1.25; margin: 6px 0 8px; letter-spacing: -.01em; }
.lede { color: var(--text-2); max-width: 760px; margin: 0 0 14px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

/* source status */
.status { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--low); flex: none; }
.dot.ok { background: var(--ok); } .dot.error { background: var(--high); } .dot.skipped { background: var(--text-3); opacity: .5; } .dot.mock { background: var(--med); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin: 24px 0 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; transition: border-color .15s; text-align: left; }
.kpi:hover { border-color: var(--text-3); }
.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.2; }
.kpi .l { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .s { font-size: 11px; color: var(--text-3); }
.kpi.new .v { color: var(--accent); }
.catbar { width: 8px; height: 8px; border-radius: 2px; }

/* filters */
.filters { position: sticky; top: 49px; z-index: 10; background: var(--bg); padding: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.filters select, .filters input[type=search], .filters input[type=date] { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; }
.filters input[type=search] { flex: 1 1 200px; min-width: 160px; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 11px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.seg button.on { background: var(--text); color: var(--bg); }
.count { font-size: 12px; color: var(--text-2); margin-left: auto; }

/* topic list */
.day { margin-top: 26px; }
.day-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.day-h h2 { font-size: 16px; margin: 0; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 34px 56px minmax(0, 1fr) 170px; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); cursor: pointer; align-items: start; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.rank { color: var(--text-3); font-size: 13px; padding-top: 2px; }
.score { text-align: center; }
.score b { display: block; font-size: 18px; line-height: 1.1; }
.tier { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-top: 4px; }
.tier.high { color: var(--high); background: var(--high-soft); } .tier.medium { color: var(--med); background: var(--med-soft); } .tier.low { color: var(--low); background: var(--low-soft); }
.title { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.title .alt { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 6px; }
.sum { color: var(--text-2); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.why { color: var(--text-3); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.src { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); border-left: 3px solid var(--cat, var(--text-3)); }
.flag { font-size: 11px; padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.flag.heat { color: var(--high); background: var(--high-soft); }
.flag.multi { color: var(--accent); background: var(--accent-soft); }
.flag.sample { color: var(--med); background: var(--med-soft); }
.flag.heur { color: var(--text-3); background: var(--low-soft); font-weight: 400; }
.side { font-size: 12px; color: var(--text-2); text-align: right; overflow-wrap: anywhere; }
.side .h { color: var(--text); font-weight: 600; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-2); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--surface); z-index: 50; transform: translateX(100%); transition: transform .22s ease; overflow-y: auto; box-shadow: var(--shadow); border-left: 1px solid var(--line); }
.drawer.on { transform: none; }
.drawer-in { padding: 22px 22px 48px; }
.drawer h3 { font-size: 21px; line-height: 1.35; margin: 8px 0 6px; overflow-wrap: anywhere; }
.drawer h4 { font-size: 13px; color: var(--text-2); margin: 22px 0 8px; letter-spacing: .03em; }
.close { float: right; }
.breakdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.bd { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }
.bd .v { font-size: 18px; font-weight: 700; }
.bd .l { font-size: 11px; color: var(--text-2); }
.note { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--text-2); }
.items { width: 100%; border-collapse: collapse; font-size: 13px; }
.items td { border-top: 1px solid var(--line); padding: 8px 6px; vertical-align: top; overflow-wrap: anywhere; }
.items tr:first-child td { border-top: 0; }
.trend svg { width: 100%; height: 72px; display: block; }
.vs ul { margin: 6px 0 0; padding-left: 18px; }
.ai-stamp { font-size: 11px; color: var(--text-3); margin-top: 18px; }
pre.report { white-space: pre-wrap; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-wrap: anywhere; }

footer.foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
footer.foot p { margin: 6px 0; }

/* admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel textarea { width: 100%; min-height: 520px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.btn { border: 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.form-row input, .form-row select { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; color: var(--text-2); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.msg { font-size: 13px; margin-left: 8px; }
.msg.err { color: var(--high); } .msg.ok { color: var(--ok); }
.scroll-x { overflow-x: auto; }

@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row { grid-template-columns: 28px 50px minmax(0, 1fr); }
  .row .side { grid-column: 3; text-align: left; }
  .nav-links { display: none; }
}
@media (max-width: 560px) {
  h1 { font-size: 23px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .row .rank { display: none; }
  .row .side { grid-column: 2; }
  .breakdown { grid-template-columns: repeat(2, 1fr); }
  .filters { top: 45px; }
}
