/* ==========================================================================
   AQI Dashboard · 完全重构 · 立丹科技
   品牌：深色 + 金色强调，AQI 等级色作功能色
   ========================================================================== */

:root {
  --bg-0: #08080C;
  --bg-1: #12121A;
  --bg-2: #1B1B26;
  --bg-3: #252532;

  --gold:      #D4A373;
  --gold-soft: #E8C19A;
  --gold-deep: #B48656;

  --text:      #ECECEE;
  --text-dim:  #9A9AA6;
  --text-mute: #6B6B78;

  --line:        rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);

  --aqi-good:     #00B86B;
  --aqi-moderate: #FFC233;
  --aqi-light:    #FF8C1A;
  --aqi-medium:   #E8344E;
  --aqi-heavy:    #8C4BBE;
  --aqi-severe:   #7E1C2E;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  --ease: cubic-bezier(.4, 0, .2, 1);

  --hdr-h: 60px;
  --nav-h: 52px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: Inter, "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
@media (max-width: 767px) { html, body { font-size: 15px; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 800px 600px at 15% -10%, rgba(212, 163, 115, 0.10), transparent 60%),
    radial-gradient(ellipse 900px 700px at 100% 20%, rgba(106, 168, 255, 0.06), transparent 60%),
    radial-gradient(ellipse 1000px 800px at 50% 120%, rgba(0, 184, 107, 0.05), transparent 60%);
  pointer-events: none;
}

button { font-family: inherit; cursor: pointer; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-soft); }

.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace; font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: var(--hdr-h);
  background: rgba(8, 8, 12, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.hdr-inner {
  max-width: 1280px; margin: 0 auto;
  height: 100%; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hdr-brand { display: flex; align-items: center; gap: 12px; color: var(--gold); }
.hdr-logo { width: 32px; height: 32px; flex: 0 0 auto; }
.hdr-titles { min-width: 0; }
.hdr-t1 { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.hdr-t2 { font-size: 11px; color: var(--text-mute); margin-top: 3px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.hdr-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--aqi-good);
  box-shadow: 0 0 0 0 rgba(0, 184, 107, 0.6);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 184, 107, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(0, 184, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 184, 107, 0); }
}
@media (max-width: 767px) {
  .hdr-t2 { display: none; }
  .hdr-inner { padding: 0 14px; }
  .hdr-update { font-size: 11px; }
}

/* ---------- Nav (章节) ---------- */
.site-nav {
  position: fixed; top: var(--hdr-h); left: 0; right: 0; z-index: 55;
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  height: var(--nav-h);
}
.nav-progress {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--line);
}
.nav-progress-fill {
  height: 100%; width: 0%; transition: width .4s var(--ease);
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
}
.nav-inner { max-width: 1280px; margin: 0 auto; height: 100%; padding: 0 12px; display: flex; align-items: center; }
.nav-scroll {
  display: flex; gap: 4px; overflow-x: auto;
  scrollbar-width: none;
  width: 100%;
}
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: all .2s var(--ease);
  min-height: 36px;
  white-space: nowrap;
}
.nav-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-btn.is-active {
  color: var(--bg-0);
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(212, 163, 115, 0.28);
}
.nav-mobile { display: none; }
@media (max-width: 767px) {
  .nav-scroll { display: none; }
  .nav-mobile {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 0 6px;
  }
  .nav-current-label {
    font-size: 14px; font-weight: 600; color: var(--text);
  }
  .nav-current-label::before {
    content: '● '; color: var(--gold);
  }
  .nav-current-idx {
    font-size: 12px; color: var(--text-dim);
    font-family: "JetBrains Mono", monospace;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--line);
    padding: 4px 10px; border-radius: 999px;
  }
}

/* ---------- Main 与 Section 基础 ---------- */
.site-main {
  padding-top: calc(var(--hdr-h) + var(--nav-h));
}
.sec {
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 20px;
  scroll-margin-top: calc(var(--hdr-h) + var(--nav-h) + 8px);
}
@media (max-width: 767px) { .sec { padding: 28px 14px; } }
.sec-title {
  display: flex; align-items: baseline; gap: 12px;
  margin: 0 0 20px;
}
.sec-title .idx {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: .04em;
}
.sec-title h2 {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.sec-subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin: -8px 0 24px;
  max-width: 720px;
}

.next-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 28px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  transition: all .2s var(--ease);
}
.next-link:hover {
  background: rgba(212, 163, 115, 0.1);
  transform: translateX(2px);
}
.next-link svg { width: 14px; height: 14px; }

/* ---------- Card 体系 ---------- */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card.card-lift:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.card-primary {
  background:
    radial-gradient(ellipse 600px 400px at 20% 0%, rgba(212, 163, 115, 0.06), transparent 70%),
    linear-gradient(180deg, rgba(27, 27, 38, 0.9), var(--bg-1));
  border: 1px solid rgba(212, 163, 115, 0.18);
}
.card-tert {
  background: transparent;
  border: 1px dashed var(--line-strong);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h3 {
  font-size: 15px; font-weight: 600; margin: 0;
  color: var(--text);
}
.card-head .tag {
  font-size: 11px; color: var(--text-mute);
  font-family: "JetBrains Mono", monospace;
}
.card-head .tag-gold {
  color: var(--gold);
  padding: 2px 8px;
  border: 1px solid rgba(212, 163, 115, 0.3);
  border-radius: 999px;
  background: rgba(212, 163, 115, 0.06);
}

/* ---------- Grid 通用 ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-2.grid-collapse, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-3.grid-tight, .grid-4.grid-tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Hero ---------- */
.sec-hero { padding-top: 32px; padding-bottom: 60px; }
.hero-wrap {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 36px;
  align-items: center;
}
@media (max-width: 900px) { .hero-wrap { grid-template-columns: 1fr; gap: 24px; } }
.hero-ring {
  position: relative;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.hero-ring svg { width: 100%; height: 100%; display: block; }
.hero-ring-center {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  text-align: center;
}
.hero-aqi-num {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(72px, 11vw, 120px);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -.02em;
}
.hero-aqi-label {
  font-size: 17px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 999px;
}
.hero-aqi-caption {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 4px;
}

.hero-right { display: flex; flex-direction: column; gap: 20px; }
.hero-headline {
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
}
.hero-headline .accent { color: var(--gold); }
.hero-subhead {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
}
.actions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .actions-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
.action-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 8px; border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--line);
  gap: 6px;
  text-align: center;
  min-height: 88px;
  justify-content: center;
}
.action-icon { font-size: 26px; line-height: 1; }
.action-name { font-size: 12px; color: var(--text-dim); }
.action-hint { font-size: 13px; font-weight: 600; color: var(--text); }
.action-card[data-level="avoid"] .action-hint,
.action-card[data-level="stop"]  .action-hint { color: var(--aqi-medium); }
.action-card[data-level="must"]  .action-hint { color: var(--gold); }

.hero-mini {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.hero-mini-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.hero-mini-title { font-size: 13px; color: var(--text-dim); }
.hero-mini-peak { font-size: 12px; color: var(--text-mute); }
.hero-mini-chart { height: 140px; }

/* ---------- KPI 卡 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
  min-height: 96px;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: var(--gold);
  opacity: .7;
}
.kpi-label { font-size: 12px; color: var(--text-dim); }
.kpi-value {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.15;
  word-break: keep-all;
}
.kpi-unit { font-size: 12px; color: var(--text-mute); margin-left: 4px; }
.kpi-note { font-size: 11px; color: var(--text-mute); }

/* ---------- 模型切换 toggle ---------- */
.model-toggle {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 2px;
}
.model-toggle button {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 999px;
  min-height: 32px;
  transition: all .2s var(--ease);
}
.model-toggle button.active {
  color: var(--bg-0);
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  font-weight: 600;
}

/* ---------- 图表容器 ---------- */
.chart { width: 100%; min-height: 320px; }
.chart-sm { min-height: 220px; }
.chart-lg { min-height: 400px; }
@media (max-width: 767px) {
  .chart    { min-height: 260px; }
  .chart-lg { min-height: 320px; }
}

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 480px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table th { color: var(--text-dim); font-weight: 500; font-size: 12px; }
.data-table td { color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .highlight td {
  background: rgba(212, 163, 115, 0.06);
  color: var(--gold);
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
}
.badge-ok { color: var(--aqi-good); border-color: rgba(0, 184, 107, 0.3); background: rgba(0, 184, 107, 0.08); }
.badge-gold { color: var(--gold); border-color: rgba(212, 163, 115, 0.3); background: rgba(212, 163, 115, 0.08); }
.badge-warn { color: var(--aqi-light); border-color: rgba(255, 140, 26, 0.3); background: rgba(255, 140, 26, 0.08); }
.badge-err { color: var(--aqi-medium); border-color: rgba(232, 52, 78, 0.3); background: rgba(232, 52, 78, 0.08); }

/* 移动端表格 → 卡片 */
.mobi-list { display: none; }
@media (max-width: 640px) {
  .hide-on-mobi { display: none; }
  .mobi-list { display: grid; gap: 10px; }
  .mobi-item {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
  }
  .mobi-item .mi-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
  .mobi-item .mi-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
  .mobi-item .mi-row .k { color: var(--text-dim); }
  .mobi-item .mi-row .v { color: var(--text); font-family: "JetBrains Mono", monospace; }
}

/* ---------- 特征大卡 ---------- */
.fcard {
  padding: 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
}
.fcard h4 { margin: 0 0 6px; font-size: 14px; color: var(--text); }
.fcard p  { margin: 0; font-size: 12px; color: var(--text-dim); line-height: 1.6; }
.fcard code {
  font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--gold);
  background: rgba(212,163,115,0.08); padding: 1px 5px; border-radius: 4px;
  display: inline-block; margin: 2px 2px 0 0;
}

/* ---------- 流程箭头 ---------- */
.flow {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.flow-step {
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.flow-step .count {
  font-family: "JetBrains Mono", monospace;
  color: var(--gold);
  margin-right: 6px;
  font-weight: 700;
}
.flow-arrow {
  color: var(--text-mute);
  font-size: 14px;
  flex: 0 0 auto;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  padding: 32px 20px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
}
.site-footer .back-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--gold-deep);
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 20px;
  transition: all .2s var(--ease);
  min-height: 40px;
}
.site-footer .back-link:hover {
  background: rgba(212, 163, 115, 0.08);
  transform: translateX(-2px);
}
.site-footer .back-link svg { width: 14px; height: 14px; }
.site-footer p { margin: 4px 0; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg-0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  transition: opacity .4s var(--ease), visibility .4s var(--ease);
}
.loader.hide { opacity: 0; visibility: hidden; }
.loader-ring {
  width: 42px; height: 42px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text { color: var(--text-dim); font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); }

/* ---------- SHAP 瀑布 ---------- */
.shap-row { display: grid; grid-template-columns: 160px 1fr 60px; align-items: center; gap: 12px; padding: 6px 0; }
.shap-name { font-size: 12px; color: var(--text-dim); }
.shap-bar-wrap { position: relative; height: 22px; background: rgba(255,255,255,0.04); border-radius: 6px; overflow: hidden; }
.shap-bar { position: absolute; top: 0; height: 100%; border-radius: 6px; }
.shap-bar.pos { background: rgba(232, 52, 78, 0.7); right: 50%; }
.shap-bar.neg { background: rgba(0, 184, 107, 0.7); left: 50%; }
.shap-zero { position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: var(--line-strong); }
.shap-val { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--text); text-align: right; }
@media (max-width: 767px) { .shap-row { grid-template-columns: 96px 1fr 52px; gap: 8px; } .shap-name { font-size: 11px; } }

/* 小工具类 */
.muted { color: var(--text-dim); }
.dim   { color: var(--text-mute); }
.gold  { color: var(--gold); }
.nowrap{ white-space: nowrap; }
.stack-sm > * + * { margin-top: 6px; }
.stack   > * + * { margin-top: 14px; }
.hstack  { display: flex; align-items: center; gap: 8px; }
.gap-16  { gap: 16px; }
.center  { text-align: center; }

ul.tick { list-style: none; padding: 0; margin: 0; }
ul.tick li {
  padding: 4px 0 4px 22px;
  position: relative;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}
ul.tick li::before {
  content: '✓'; position: absolute; left: 0; color: var(--gold);
  font-weight: 700;
}
ul.tick li strong { color: var(--text); font-weight: 600; }

/* 局限性块 */
.limit-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border-left: 3px solid var(--aqi-medium);
  margin-bottom: 10px;
}
.limit-item h4 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.limit-item p  { margin: 0; font-size: 12px; color: var(--text-dim); line-height: 1.6; }
