:root {
  --bg: #11151c;
  --card: #1a1f28;
  --border: #2a313d;
  --text: #e8ecf2;
  --muted: #8a94a3;
  --accent: #9db8e8;
  --accent-text: #11151c;
  --line: #9db8e8;
  --grid: rgba(255, 255, 255, 0.07);
  --c0: #e5616a;
  --c1: #ef9a5a;
  --c2: #d8bf5c;
  --c3: #79bf86;
  --c4: #3fb37a;
  --band-alpha: 0.13;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --border: #e1e4ea;
    --text: #151a22;
    --muted: #677283;
    --accent: #3a64b5;
    --accent-text: #ffffff;
    --line: #3a64b5;
    --grid: rgba(0, 0, 0, 0.07);
    --c0: #d4434d;
    --c1: #e07a2e;
    --c2: #c09a1f;
    --c3: #4f9e5c;
    --c4: #23885a;
    --band-alpha: 0.10;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

h1 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.now {
  display: flex;
  align-items: center;
  gap: 14px;
}

.now-value {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.badge {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  color: #11151c;
  background: var(--muted);
  white-space: nowrap;
}

.ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 22px;
}

.ranges button {
  font: inherit;
  font-size: 15px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ranges button:hover { border-color: var(--accent); }

.ranges button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.stat {
  padding: 18px 22px;
  border-left: 1px solid var(--border);
  min-width: 0;
}

.stat:first-child { border-left: 0; }

.stat-label { color: var(--muted); font-size: 14px; }

.stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  margin: 6px 0 4px;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-card {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 14px;
}

#chart {
  width: 100%;
  height: 460px;
}

.chart-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  margin: 6px 0 0;
  padding: 0 8px;
}

.hint { color: var(--muted); font-size: 13px; opacity: 0.85; }

#chart {
  cursor: crosshair;
  /* Vertical swipes scroll the page; horizontal slides go to the chart. */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#chart.selecting { touch-action: none; }

.hint.live {
  color: var(--text);
  opacity: 1;
  font-family: var(--mono);
}

.ranges .custom-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 14px;
}

.ranges .custom-chip b {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1;
  opacity: 0.75;
}

.ranges .custom-chip:hover b { opacity: 1; }

.legend {
  list-style: none;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 14px;
  padding: 0;
}

.legend li { display: flex; align-items: center; gap: 7px; }

.panel-legend { margin-top: 12px; font-size: 13px; gap: 6px 16px; }

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.panel {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 16px;
}

.panel-wide { grid-column: 1 / -1; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.panel-sub { color: var(--muted); font-size: 13px; }
.panel-sub.mono { font-family: var(--mono); }

.panel-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#dist { height: 240px; }
#heat, #lows { height: 440px; }
#years { height: 300px; }

.zones {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  display: grid;
  gap: 14px;
}

.zones li {
  display: grid;
  grid-template-columns: 8.5em minmax(0, 1fr) 4em;
  align-items: center;
  column-gap: 12px;
  row-gap: 3px;
}

.z-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  white-space: nowrap;
}

.z-name i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.z-track { height: 10px; }

.z-track b {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
}

.z-pct {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.z-sub {
  grid-column: 2 / -1;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.foot {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.foot a { color: var(--muted); }
.foot a:hover { color: var(--text); }

.lang {
  font: inherit;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  cursor: pointer;
}

.lang:hover { color: var(--text); border-color: var(--muted); }

.disclaimer { margin: 4px 0 0; opacity: 0.8; }

@media (max-width: 720px) {
  .wrap { padding: 20px 16px 32px; }
  h1 { font-size: 24px; }
  .meta { font-size: 13px; }
  .now-value { font-size: 42px; }
  .ranges { gap: 8px; margin: 20px 0 16px; }
  .ranges button { padding: 7px 12px; font-size: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 14px 16px; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .stat-value { font-size: 22px; }
  .chart-card { padding: 10px 6px 12px; }
  #chart { height: 340px; }
  .panels { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 16px; }
  .panel { padding: 14px 12px 12px; }
  .panel h2 { font-size: 16px; }
  .panel-head { margin-bottom: 10px; }
  .zones li { grid-template-columns: 7.5em minmax(0, 1fr) 3.6em; column-gap: 10px; }
  .z-name, .z-pct { font-size: 13px; }
  .z-sub { grid-column: 1 / -1; padding-left: 17px; }
  #dist { height: 210px; }
  #years { height: 240px; }
}
