* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f6f7f9;
  color: #24292f;
}

header h1 {
  margin: 0 0 8px;
  font-size: 22px;
}

.header-row {
  display: flex;
  align-items: baseline;
  gap: 24px;
}

.header-row h1 {
  margin: 0;
  white-space: nowrap;
}

.subtitle {
  margin: 0 0 16px;
  color: #57606a;
  font-size: 13px;
  line-height: 1.6;
}

.legend-note {
  padding: 1px 6px;
  border-radius: 4px;
}

.note-blue {
  color: #2563eb;
  background: #eff6ff;
}

.note-red {
  color: #b91c1c;
  background: #fef2f2;
}

.note-purple {
  color: #7c3aed;
  background: #f3e8ff;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  margin-bottom: 16px;
}

.control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control label {
  font-size: 14px;
  white-space: nowrap;
}

.control-slider {
  flex: 1 1 420px;
}

.control-slider input[type="range"] {
  flex: 1;
  width: auto;
  min-width: 200px;
}

.control input[type="number"] {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 14px;
}

.control-presets button {
  padding: 4px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa;
  font-size: 13px;
  cursor: pointer;
}

.control-presets button:hover {
  background: #eaeef2;
}

.control-inline label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.chart-wrap {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 12px;
}

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

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  align-items: center;
  padding: 2px 4px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid #eaeef2;
  font-size: 13px;
  color: #24292f;
}

.cc-group label {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.chart-note {
  margin: 8px 4px 0;
  font-size: 12px;
  color: #57606a;
  line-height: 1.6;
}

.stats-wrap {
  margin: 8px 4px 0;
  overflow-x: auto;
}

.stats-table {
  border-collapse: collapse;
  font-size: 12px;
  color: #57606a;
}

.stats-table th,
.stats-table td {
  border: 1px solid #d0d7de;
  padding: 4px 12px;
  text-align: left;
  white-space: nowrap;
}

.stats-table th {
  background: #f6f8fa;
  color: #24292f;
  font-weight: 600;
}

.formula-block {
  border-top: 1px dashed #d0d7de;
  margin-top: 10px;
  padding-top: 6px;
}

.formula-title {
  margin: 2px 0 4px;
}

.formula-block .stats-table {
  margin-bottom: 4px;
}
