:root {
  --background: #ffffff;
  --text: #222222;
  --muted: #666666;
  --border: #d7d7d7;
  --grid: #e8e8e8;
  --cases: #c23b32;
  --deaths: #2f6f9f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

button, select { font: inherit; }

main {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  padding: 36px 0;
}

.page-header {
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 4px 0 6px;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.15;
  font-weight: 700;
}

.course-label {
  margin: 0;
  color: #555;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.page-header .subtitle {
  margin: 0;
  font-size: 18px;
  color: #555;
}

.introduction {
  margin-bottom: 28px;
  padding: 18px 20px;
  background: #f4f7fa;
  border-left: 4px solid var(--deaths);
}

.introduction h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.introduction p {
  max-width: 900px;
  margin: 7px 0;
  color: #444;
}

.scene-heading > p:last-child,
.notes p {
  max-width: 760px;
  color: var(--muted);
}

.progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 32px;
}

.progress button {
  padding: 10px;
  border: 1px solid var(--border);
  background: #f7f7f7;
  text-align: center;
  cursor: pointer;
}

.progress button:hover { border-color: #777; }

.progress button.active {
  color: white;
  background: var(--deaths);
  border-color: var(--deaths);
}

.scene-heading { min-height: 130px; }
.scene-number { margin: 0; color: var(--deaths); font-weight: bold; }
.scene-heading h2 { margin: 4px 0 8px; font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 700; }
.scene-heading > p:last-child { margin-top: 0; }

.chart-container {
  position: relative;
  border: 1px solid var(--border);
  padding: 20px;
  background: white;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  min-height: 50px;
  font-family: sans-serif;
  font-size: 13px;
}

.chart-header p { margin: 0; }
#chart-unit { color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 18px; height: 3px; }

#chart { display: block; width: 100%; height: auto; }
.axis text { fill: var(--muted); font: 11px sans-serif; }
.axis path { display: none; }
.axis line, .grid line { stroke: var(--grid); }
.grid path { display: none; }
.series { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.delay-band { fill: #eeeeee; }
.delay-label { fill: #444; font: bold 11px sans-serif; text-transform: uppercase; }

.annotation line { stroke: #444; stroke-dasharray: 3 3; }
.annotation circle { fill: white; stroke: var(--cases); stroke-width: 3; }
.annotation rect { fill: white; stroke: #555; }
.annotation .title { font: bold 12px sans-serif; }
.annotation .detail { fill: var(--muted); font: 11px sans-serif; }

.tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: #222;
  color: white;
  padding: 8px 10px;
  font: 12px/1.4 sans-serif;
}

.tooltip strong { display: block; }
.interaction-note { color: var(--muted); font: 13px sans-serif; }

.explorer-controls {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  font-family: sans-serif;
  font-size: 14px;
}

.explorer-controls:not([hidden]) { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.explorer-controls select, .explorer-controls button { padding: 6px 8px; border: 1px solid #999; background: white; }
.explorer-controls button { cursor: pointer; }
.explorer-controls button.active { background: var(--text); color: white; }
.control-label { margin-left: 12px; }

.scene-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-top: 20px;
}

.scene-controls button {
  width: 100px;
  padding: 8px 12px;
  border: 1px solid #777;
  background: white;
  cursor: pointer;
}

.scene-controls button:last-child { justify-self: end; }
.scene-controls button:disabled { opacity: .35; cursor: default; }
.scene-controls span { font-family: sans-serif; color: var(--muted); font-size: 13px; }

.notes {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.notes h2 { font-size: 1.4rem; }
.notes p { font-size: .95rem; }

@media (max-width: 600px) {
  main { padding: 24px 0; }
  .progress button { font-size: 12px; padding: 8px 4px; }
  .scene-heading { min-height: 190px; }
  .chart-container { padding: 12px 8px; }
  .chart-header { display: block; }
  .legend { justify-content: flex-start; margin-top: 8px; }
  .control-label { margin-left: 0; }
}
