:root {
  --bg: #0b1020;
  --bg-elevated: #121a2f;
  --bg-card: #162038;
  --bg-card-hover: #1c2948;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e8eefc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --accent-warm: #fbbf24;
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 18px 50px rgba(2, 8, 23, 0.45);
  --radius: 18px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(167, 139, 250, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

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

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04101f;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
}

.brand-text strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.brand-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text-muted);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: color-mix(in srgb, var(--bg-card) 80%, transparent);
  text-decoration: none;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}
.icon-btn:hover { border-color: var(--accent); }

.hero {
  padding: 3.2rem 0 1.5rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

.hero-copy h1 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 38rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.pill strong { color: var(--text); font-weight: 600; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.15);
}

.hero-panel {
  background: linear-gradient(160deg, rgba(56,189,248,0.12), rgba(167,139,250,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
}
.stat .num {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.stat .label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0 1rem;
}

.tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}
.tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
}
.tab.active {
  background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(167,139,250,0.18));
  color: var(--text);
  font-weight: 600;
}

.search {
  min-width: min(280px, 100%);
  flex: 1;
  max-width: 340px;
}
.search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font: inherit;
  outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,0.15); }

.section {
  display: none;
  padding-bottom: 2.5rem;
}
.section.active { display: block; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.section-head h2 {
  margin: 0;
  font-size: 1.35rem;
}
.section-head p {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card:hover {
  transform: translateY(-2px);
  background: var(--bg-card-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.warm {
  color: #f59e0b;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.25);
}
.time {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  flex: 1;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.15rem;
}
.source, .handle {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.handle {
  font-family: var(--mono);
  color: var(--accent-2);
}
.metrics {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

.about {
  margin: 0.5rem 0 3rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.about h2 { margin: 0 0 0.6rem; font-size: 1.2rem; }
.about p { margin: 0.45rem 0; color: var(--text-muted); }
.about ul { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--text-muted); }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.site-footer .note {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.08);
  border: 1px solid rgba(251, 113, 133, 0.2);
  color: #fda4af;
}
[data-theme="light"] .site-footer .note {
  color: #9f1239;
  background: rgba(251, 113, 133, 0.08);
}

.hidden { display: none !important; }

@media (max-width: 860px) {
  .hero-grid,
  .cards { grid-template-columns: 1fr; }
  .nav { flex-direction: column; align-items: stretch; }
  .nav-links { justify-content: flex-start; }
  .toolbar { align-items: stretch; }
  .search { max-width: none; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

/* —— Detail / article pages —— */
.card {
  position: relative;
}
.card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  text-indent: -9999px;
  overflow: hidden;
}
.card-title-link {
  color: inherit;
  text-decoration: none;
  position: relative;
  z-index: 2;
}
.card-title-link:hover { text-decoration: underline; }
.card-foot .btn-link,
.card-foot .source,
.card-foot .handle,
.card-foot .metrics {
  position: relative;
  z-index: 2;
}

.page-detail .article-wrap {
  padding: 1.5rem 0 3rem;
  max-width: 760px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  text-decoration: none;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem 1.75rem;
  box-shadow: var(--shadow);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.article h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
}
.article-body p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 1.02rem;
}
.article-body p:last-child { margin-bottom: 0; }
.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  align-items: center;
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.btn-link.subtle { color: var(--text-muted); font-weight: 500; }
