:root {
  --ink: #17262b;
  --muted: #5f6f74;
  --background: #f7f9f8;
  --surface: #ffffff;
  --subtle: #eef3f2;
  --line: #d7e0de;
  --primary: #164e63;
  --accent: #0f766e;
  --warning: #9a5d08;
  --danger: #a23a32;
}

.dark {
  --ink: #edf4f3;
  --muted: #aab9b7;
  --background: #111918;
  --surface: #182220;
  --subtle: #202d2a;
  --line: #34423f;
  --primary: #62aec0;
  --accent: #5ab4a8;
  --warning: #e4ae56;
  --danger: #ed8177;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font: 15px/1.5 'Nunito Sans', sans-serif; }
a { color: inherit; }
.site-header { min-height: 56px; padding: 0 max(20px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header a { font-family: 'Montserrat', sans-serif; font-weight: 700; text-decoration: none; }
.site-header span { color: var(--muted); font-size: .875rem; }
main { max-width: 1180px; margin: 0 auto; padding: 40px 20px 64px; }
.page-header { max-width: 780px; margin-bottom: 28px; }
h1, h2, h3 { font-family: 'Montserrat', sans-serif; line-height: 1.2; }
h1 { margin: 0 0 12px; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.035em; }
.page-header > p { margin: 0; color: var(--muted); font-size: 1.125rem; }
.page-header .disclaimer { margin-top: 18px; padding: 12px 0 12px 16px; border-left: 3px solid var(--accent); font-size: .95rem; }
.toolbar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px 8px 0 0; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
select { min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--background); color: var(--ink); font: 600 1rem 'Nunito Sans', sans-serif; }
select:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; }
.summary div { padding: 18px 20px; border-right: 1px solid var(--line); }
.summary div:last-child { border-right: 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 4px 0 0; color: var(--primary); font: 700 1.65rem/1.2 'Montserrat', sans-serif; }
.summary p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel h2 { margin: 0 0 16px; font-size: 1.15rem; }
.panel h3 { margin: 20px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .95rem; }
.panel-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.chart-legend i, .chart-legend b { display: inline-block; width: 16px; height: 3px; margin-right: 5px; background: var(--accent); vertical-align: middle; }
.chart-legend b { background: var(--warning); }
.chart-wrap { overflow-x: auto; }
svg { width: 100%; min-width: 560px; height: auto; }
.axis { stroke: var(--line); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 11px; }
.score-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.average-line { fill: none; stroke: var(--warning); stroke-width: 2; stroke-dasharray: 7 6; }
.dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.annotation { margin: 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--subtle); color: var(--muted); }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.methods { grid-column: 1 / 3; }
.cohort-row { display: grid; grid-template-columns: 1fr 46px; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cohort-row:last-child { border-bottom: 0; }
.cohort-row span, .narrative p, .methods li { color: var(--muted); }
.cohort-row strong { text-align: right; }
.mini-bar { grid-column: 1 / 3; height: 6px; overflow: hidden; background: var(--subtle); }
.mini-bar i { display: block; height: 100%; background: var(--accent); }
.narrative p { margin-top: 0; }
.methods ul { columns: 2; gap: 40px; margin: 0; padding-left: 20px; }
.methods li { break-inside: avoid; margin: 0 0 10px; }

@media (max-width: 760px) {
  .toolbar, .summary, .details-grid { grid-template-columns: 1fr; }
  .summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary div:last-child { border-bottom: 0; }
  .methods { grid-column: auto; }
  .methods ul { columns: 1; }
}

@media (max-width: 480px) {
  .site-header { padding: 10px 16px; }
  main { padding: 32px 16px 48px; }
  .panel-header { display: block; }
  .chart-legend { margin-top: 10px; }
}
