/* ============================================================
   地震日报 · 主题系统 v1 (2026-09-21)
   - 默认跟随浏览器 prefers-color-scheme
   - 可手动切换，偏好持久化到 localStorage
   - 地震配色：主蓝 #4A90D9 / 青 #06b6d4 / 警示红 #e74c3c
   ============================================================ */

:root {
  /* === 背景（页面渐变） === */
  --bg-grad-1: #f4f6fc;
  --bg-grad-2: #e8eaf6;
  --bg-grad-3: #d6dcf2;
  --bg-fixed: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 50%, var(--bg-grad-3) 100%);

  /* === 表面（卡片/区块） === */
  --surface: rgba(255, 255, 255, 0.72);
  --surface-hover: rgba(255, 255, 255, 0.88);
  --surface-elevated: rgba(255, 255, 255, 0.85);
  --surface-border: rgba(15, 23, 42, 0.08);
  --surface-divider: rgba(15, 23, 42, 0.05);

  /* === 文字 === */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-on-accent: #ffffff;

  /* === 强调色（地震主题） === */
  --accent-1: #4A90D9;
  --accent-2: #06b6d4;
  --accent-3: #2563eb;
  --accent-success: #16a34a;
  --accent-danger: #e74c3c;
  --accent-warning: #f59e0b;

  /* === 渐变 === */
  --gradient-text: linear-gradient(135deg, #4A90D9 0%, #06b6d4 50%, #2563eb 100%);
  --gradient-primary: linear-gradient(135deg, #4A90D9, #357ABD);
  --gradient-cta: linear-gradient(135deg, #4A90D9 0%, #357ABD 50%, #1e40af 100%);

  /* === TopNav === */
  --topnav-bg: rgba(255, 255, 255, 0.7);
  --topnav-border: rgba(15, 23, 42, 0.06);
  --topnav-text: #334155;
  --topnav-link-hover: rgba(15, 23, 42, 0.06);
  --topnav-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);

  /* === 阴影 === */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 4px 12px rgba(74, 144, 217, 0.25);

  /* === 高亮区块（高亮某条地震等） === */
  --highlight-bg: linear-gradient(135deg, rgba(231, 76, 60, 0.08), rgba(245, 158, 11, 0.08));
  --highlight-border: rgba(231, 76, 60, 0.25);

  /* === Meta 颜色（status bar） === */
  --theme-color: #f4f6fc;

  /* === ECharts === */
  --chart-text: #475569;
  --chart-axis: rgba(15, 23, 42, 0.18);
  --chart-split: rgba(15, 23, 42, 0.06);
  --chart-tooltip-bg: rgba(255, 255, 255, 0.95);
  --chart-tooltip-border: #4A90D9;
}

:root[data-theme="dark"] {
  /* === 背景 === */
  --bg-grad-1: #0a0e1f;
  --bg-grad-2: #1a1a2e;
  --bg-grad-3: #4A90D9;
  --bg-fixed: linear-gradient(135deg, #0a0e1f 0%, #1a1a2e 35%, #4A90D9 100%);

  /* === 表面 === */
  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --surface-elevated: rgba(255, 255, 255, 0.08);
  --surface-border: rgba(255, 255, 255, 0.12);
  --surface-divider: rgba(255, 255, 255, 0.05);

  /* === 文字 === */
  --text-primary: #ffffff;
  --text-secondary: #e8e8f0;
  --text-tertiary: #c8c8e0;
  --text-muted: #a8a8c0;
  --text-faint: #8a8aa8;
  --text-on-accent: #ffffff;

  /* === 强调色（亮一些） === */
  --accent-1: #4facfe;
  --accent-2: #06b6d4;
  --accent-3: #60a5fa;
  --accent-success: #43e97b;
  --accent-danger: #f5576c;
  --accent-warning: #fbbf24;

  /* === 渐变 === */
  --gradient-text: linear-gradient(135deg, #4facfe 0%, #06b6d4 50%, #60a5fa 100%);
  --gradient-primary: linear-gradient(135deg, #4facfe, #357ABD);
  --gradient-cta: linear-gradient(135deg, #4facfe 0%, #357ABD 50%, #1e40af 100%);

  /* === TopNav === */
  --topnav-bg: rgba(10, 14, 31, 0.75);
  --topnav-border: rgba(255, 255, 255, 0.06);
  --topnav-text: #e8e8f0;
  --topnav-link-hover: rgba(255, 255, 255, 0.12);
  --topnav-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);

  /* === 阴影 === */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 4px 12px rgba(74, 144, 217, 0.3);

  /* === 高亮区块 === */
  --highlight-bg: linear-gradient(135deg, rgba(245, 87, 108, 0.08), rgba(251, 191, 36, 0.08));
  --highlight-border: rgba(245, 87, 108, 0.25);

  /* === Meta === */
  --theme-color: #0a0e1f;

  /* === ECharts === */
  --chart-text: #a8a8c0;
  --chart-axis: rgba(255, 255, 255, 0.3);
  --chart-split: rgba(255, 255, 255, 0.08);
  --chart-tooltip-bg: rgba(15, 12, 41, 0.95);
  --chart-tooltip-border: #4facfe;
}

/* ============================================================
   基础重置
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-fixed);
  background-attachment: fixed;
  color: var(--text-secondary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.wrap { max-width: 920px; margin: 0 auto; }

/* ============================================================
   TopNav（所有页面共用）
   ============================================================ */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topnav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--topnav-border);
  border-radius: 0;
  padding: 12px 24px;
  margin: 0;
  box-shadow: var(--topnav-shadow);
  transform: translateY(0);
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1), background 0.2s;
  will-change: transform;
}
.topnav.nav-hidden { transform: translateY(-100%); }

.topnav .brand {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.topnav .brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  vertical-align: middle;
  object-fit: contain;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.topnav-links { display: flex; gap: 6px; }
.topnav-links a {
  color: var(--topnav-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
.topnav-links a:hover { background: var(--topnav-link-hover); }
.topnav-links a.active,
.topnav-links a.today-link {
  background: var(--gradient-primary);
  color: var(--text-on-accent);
}

/* ============================================================
   主题切换按钮（固定右下角）
   ============================================================ */
.theme-toggle {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 9999;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-elevated);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg);
}
.theme-toggle:active { transform: scale(0.96); }
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

@media (max-width: 600px) {
  .theme-toggle { right: 12px; bottom: 16px; width: 44px; height: 44px; font-size: 20px; }
}

/* ============================================================
   响应式（共享）
   ============================================================ */
@media (max-width: 768px) {
  .topnav { padding: 10px 16px; }
}
@media (max-width: 380px) {
  .topnav-links a { padding: 4px 8px; font-size: 11px; }
}