:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --text: #16191d;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2f6fed;
  --accent-soft: #e8f0ff;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --panel: #151b23;
    --panel-2: #1b232d;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #263039;
    --accent: #6ea8fe;
    --accent-soft: #1b2a44;
    --ok: #3fb950;
    --warn: #d29922;
    --danger: #f85149;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 17px; }
h2 { font-size: 15px; }

.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.topbar-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 抓取进度条 ---------- */
.crawl-progress {
  flex: 1 1 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
}
.crawl-progress[hidden] { display: none; }

.crawl-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.crawl-bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  transition: width 0.45s ease;
}

.crawl-progress.is-done .crawl-bar-fill { background: var(--ok); }

.crawl-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

#crawl-progress-time { font-variant-numeric: tabular-nums; }

#refresh[disabled] { opacity: 0.7; cursor: progress; }

.pill {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

button { font: inherit; cursor: pointer; }

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ghost:hover { background: var(--panel-2); border-color: var(--muted); }
.ghost:disabled { opacity: 0.6; cursor: default; }

/* ---------- layout ---------- */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tag {
  font-size: 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ---------- digest ---------- */
.digest-body { display: flex; flex-direction: column; gap: 10px; }

.headline {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.5;
}

.digest-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.digest-list li { line-height: 1.65; }

.watch {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.watch span { font-weight: 600; color: var(--text); }
.watch ul { margin: 6px 0 0; padding-left: 18px; }

.raw-digest {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--panel-2);
  border-radius: 10px;
  padding: 12px;
}

/* ---------- games ---------- */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-height: 118px;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.game-card.active { border-color: var(--accent); background: var(--accent-soft); }

.game-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-name { font-weight: 650; font-size: 14px; }
.game-en { font-size: 11px; color: var(--muted); }

.prio {
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}
.prio-P1 { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.prio-P2 { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.prio-P3 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.game-latest {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}
.game-time { font-size: 11px; color: var(--muted); margin-top: auto; }

.game-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }

.game-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.game-count { font-size: 11px; color: var(--muted); }

.dive-btn {
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 8px;
  padding: 3px 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.dive-btn:hover { background: var(--accent); color: #fff; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.badge-stage {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  font-weight: 650;
}
.badge-silent {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, var(--line));
  background: transparent;
  font-weight: 650;
}
.badge-dossier {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: transparent;
}

/* ---------- 情报简报 ---------- */
.verdict { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--text); }

.brief-changes {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  line-height: 1.6;
}

.insights { display: flex; flex-direction: column; gap: 9px; }

.insight {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
}
.insight h4 {
  margin: 0 0 5px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.insight p { margin: 0; font-size: 13px; line-height: 1.65; }

.evidence { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }

.conf {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 0 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.conf-高 { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.conf-中 { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.conf-低 { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.block-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 5px;
}

.silent-block,
.conflict-block {
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.silent-block ul,
.conflict-block ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- feed ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--muted); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.timeline { list-style: none; margin: 0; padding: 0; }

.row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  padding: 13px 2px;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: none; }

.row-time { font-size: 12px; color: var(--muted); padding-top: 2px; }

.row-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.game-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}

.kind {
  font-size: 11px;
  border-radius: 6px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.kind-launch { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.kind-test { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.kind-preorder { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.kind-collab { color: #8b5cf6; border-color: #8b5cf655; }
.kind-shutdown { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.site { font-size: 11px; color: var(--muted); }

.row-title {
  font-size: 14.5px;
  font-weight: 550;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
}
.row-title:hover { color: var(--accent); }

.row-summary {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.row-take {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 5px 10px;
  word-break: break-word;
}
.row-take::before { content: "解读 · "; color: var(--muted); font-weight: 600; font-size: 11px; }

.hot {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.hot-3 { color: #fff; background: var(--danger); border-color: var(--danger); }
.hot-2 { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }

.empty { text-align: center; color: var(--muted); padding: 26px 0; margin: 0; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
}
.modal[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 8px; font-size: 16px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.modal-head h2 { font-size: 16px; margin: 0 0 3px; }
.modal-head p { margin: 0; font-size: 12px; line-height: 1.5; }

.modal-actions { display: flex; gap: 8px; flex: none; }
.modal-actions button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-weight: 600;
}

.modal-body {
  overflow: auto;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dive-progress { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; flex: none; }
.dive-progress[hidden] { display: none; }
.dive-progress p { margin: 0; font-size: 12px; }

/* ---------- 深挖档案 ---------- */
.dossier-verdict {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dossier-verdict p { margin: 0; font-size: 14px; line-height: 1.7; }
.verdict-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

.dossier-sec h3 { font-size: 13px; margin: 0 0 8px; }

.fact-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.6; }
.fact-date { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.fact-src { margin-left: 6px; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.fact-link { font-size: 11px; }

.tl { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.55; }
.tl-date { display: inline-block; min-width: 84px; color: var(--muted); font-variant-numeric: tabular-nums; }

.src-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; line-height: 1.5; }
.src-list li span { display: block; font-size: 11px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 50;
  max-width: 88vw;
}

/* ---------- login ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 19px; margin-bottom: 6px; }
.login-card p { margin: 0 0 18px; font-size: 13px; }

form { display: flex; flex-direction: column; gap: 8px; }

label { font-size: 12px; color: var(--muted); }

input[type="password"] {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
input[type="password"]:focus { border-color: var(--accent); }

form button {
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
form button:disabled { opacity: 0.7; }

.error { color: var(--danger); font-size: 12.5px; margin: 4px 0 0; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  main { padding: 14px; gap: 14px; }
  .topbar { padding: 10px 14px; }
  .topbar-meta .pill { display: none; }
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .game-card { min-height: 108px; padding: 11px 12px; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row-time { font-size: 11px; }
  .modal { padding: 10px; }
  .modal-card { max-height: 94vh; padding: 14px; }
  .modal-head { flex-wrap: wrap; }
  .modal-actions { width: 100%; justify-content: flex-end; }
  .tl-date { min-width: 74px; }
}
