*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  background: #0f1117;
  color: #dde;
  min-height: 100vh;
}

nav {
  background: #1a1d26;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid #2a2d3a;
  flex-wrap: wrap;
}

nav a { color: #99aacc; text-decoration: none; font-size: 0.9rem; }
nav a:hover { color: #fff; }
nav .brand { font-weight: 700; font-size: 1.1rem; color: #fff; margin-right: 0.5rem; }

.nav-links { display: flex; gap: 1.25rem; align-items: center; }
.nav-link { color: #99aacc; }
.nav-link.active { color: #fff; font-weight: 600; }

.nav-about { font-size: 0.75rem; color: #556 !important; margin-left: auto; }
.nav-about:hover { color: #99aacc !important; }
.nav-about.active { color: #99aacc !important; font-weight: normal !important; }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.75rem; color: #aab; text-transform: uppercase; letter-spacing: 0.04em; }
.subtitle { color: #99a; font-size: 0.95rem; margin-bottom: 1.75rem; }

/* Summary cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.card {
  background: #1a1d26;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}
.card-label { font-size: 0.72rem; color: #778; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.card-value { font-size: 1.9rem; font-weight: 700; color: #eef; line-height: 1.1; }
.card-value-neg { color: #ee7766; }
.card-unit { font-size: 0.72rem; color: #556; margin-top: 0.3rem; }

/* Chart */
.chart-wrap {
  background: #1a1d26;
  border: 1px solid #2a2d3a;
  border-radius: 8px;
  padding: 1rem 1rem 0.5rem;
  margin-bottom: 0.5rem;
}

.info-list {
  margin: 0.5rem 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(180px, max-content) 1fr;
  gap: 0.5rem 1.25rem;
}
.info-list dt { color: #99aacc; font-weight: 500; }
.info-list dd { color: #99a; margin: 0; }
.info-list a { color: #4a9eff; text-decoration: none; }
.info-list a:hover { text-decoration: underline; }
.about-links { display: flex; gap: 1rem; margin-top: 0.6rem; font-size: 0.9rem; }
.about-links a { color: #4a9eff; text-decoration: none; }
.about-links a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .info-list { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .info-list dt { margin-top: 0.5rem; }
}

.range-slider {
  position: relative;
  flex: 1;
  min-width: 160px;
  height: 24px;
  display: flex;
  align-items: center;
}
.range-slider .range-track {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  background: #2a2d3a;
  border-radius: 2px;
  pointer-events: none;
}
.range-slider .range-fill {
  position: absolute;
  height: 4px;
  background: #4a88ee;
  border-radius: 2px;
  pointer-events: none;
}
.range-slider input[type=range] {
  position: absolute;
  left: 0; width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.range-slider input[type=range]::-webkit-slider-runnable-track { background: transparent; }
.range-slider input[type=range]::-moz-range-track { background: transparent; }
.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  pointer-events: auto;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #4a88ee;
  border: 2px solid #1a1d26;
  cursor: pointer;
  margin-top: -5px;
}
.range-slider input[type=range]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #4a88ee;
  border: 2px solid #1a1d26;
  cursor: pointer;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 0.25rem 0.75rem;
  font-size: 0.85rem;
  color: #99a;
}
.toggle-row .group { display: flex; align-items: center; gap: 0.5rem; }

.seg-btns { display: flex; gap: 2px; }
.seg-btn {
  background: #12141e;
  border: 1px solid #2a2d3a;
  border-radius: 4px;
  color: #667;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
}
.seg-btn:hover { color: #aab; border-color: #445; }
.seg-btn.active { background: #1e2d4a; color: #7aaaf0; border-color: #4a88ee; }

.cursor-legend {
  font-size: 0.8rem;
  color: #99a;
  min-height: 1.2rem;
  padding: 0 0.25rem 0.4rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.cursor-legend-sep { color: #445; }
.cursor-val { color: #dde; font-variant-numeric: tabular-nums; }

@media (max-width: 640px) {
  main { padding: 1.25rem 1rem; }
  h1 { font-size: 1.3rem; }
  .card-value { font-size: 1.5rem; }
}
