:root {
  --bg-void: #0b0d12;
  --bg-panel: #12151c;
  --bg-surface: #171b24;
  --bg-elevated: #1e2330;
  --border: #262b3a;
  --border-soft: #1c2130;

  --text: #edeff5;
  --text-dim: #8891a5;
  --text-faint: #565d70;

  --accent: #3d6bff;
  --accent-strong: #6b8eff;
  --accent-glow: rgba(61, 107, 255, .35);

  --signal: #ff9f1c;
  --success: #33d17a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --font-ui: -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

html.light {
  --bg-void: #f5f6fa;
  --bg-panel: #ffffff;
  --bg-surface: #f0f2f7;
  --bg-elevated: #e8ebf2;
  --border: #d5d9e5;
  --border-soft: #e4e7ef;

  --text: #1a1d26;
  --text-dim: #5a6173;
  --text-faint: #8a92a5;

  --accent: #2b5cff;
  --accent-strong: #4a77ff;
  --accent-glow: rgba(43, 92, 255, .25);

  --signal: #e68a00;
  --success: #1e9d5a;
} body { min-height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg-void);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(circle, rgba(61,107,255,.18) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- HEADER ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 13, 18, .85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 4px 16px var(--accent-glow);
}

.brand-text h1 { font-size: 17px; font-weight: 700; line-height: 1.1; }
.brand-text .sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }

.header-status { display: flex; align-items: center; gap: 10px; }

.status-text {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.btn-refresh {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s var(--ease), background .15s;
}

.btn-refresh:hover { background: var(--bg-surface); }
.btn-refresh.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- MAIN ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero {
  margin-bottom: 40px;
  text-align: center;
}

.hero h2 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, #9bb0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  color: var(--text-dim);
  font-size: 14px;
}

/* ---------- STATS GRID ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color .2s, transform .2s;
}

.stat-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
}

.stat-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-strong);
  line-height: 1.1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---------- LATEST ---------- */
.latest-section {
  margin-bottom: 32px;
}

.latest-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -.01em;
}

.latest-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
}

.latest-card .loading {
  color: var(--text-faint);
  font-size: 13px;
}

.latest-thumb {
  width: 76px; height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.latest-thumb-placeholder {
  width: 76px; height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.latest-info { flex: 1; min-width: 0; }
.latest-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- CTA ---------- */
.cta-section {
  margin-top: 50px;
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.cta-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cta-section .lede { margin-bottom: 20px; }

.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: filter .15s, transform .15s;
}

.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* ---------- FOOTER ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 24px;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  font-family: var(--font-mono);
}

.footer-inner .credit-name { color: var(--text-dim); font-weight: 600; }
.footer-inner .credit-license { opacity: .7; margin-top: 2px; }

/* ---------- MOBILE ---------- */
@media (max-width: 600px) {
  .hero h2 { font-size: 24px; }
  .header-inner { padding: 12px 16px; }
  main { padding: 24px 16px 60px; }
  .stat-value { font-size: 22px; }
}
/* ---------- Theme transition ---------- */
body, .header, .stat-card, .latest-card, .cta-section, .btn-refresh {
  transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

html.light .bg-glow {
  background: radial-gradient(circle, rgba(61,107,255,.10) 0%, transparent 60%);
}

html.light .hero h2 {
  background: linear-gradient(135deg, #1a1d26 0%, #3d6bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

html.light .header {
  background: rgba(245, 246, 250, .85);
}

html.light .brand-mark {
  color: #fff;
}