:root {
  color-scheme: light;
  --paper: #fafafa;
  --panel: #ffffff;
  --ink: #181c1f;
  --muted: #687076;
  --line: #e4e6e8;
  --line-strong: #cfd4d8;
  --accent: #1f5f8b;
  --accent-soft: #eaf2fb;
  --gold: #966217;
  --green: #476b3c;
  --shadow: 0 12px 28px rgba(24, 28, 31, 0.06);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 clamp(12px, 2.2vw, 24px) clamp(20px, 2.5vw, 28px);
}

.summary-strip {
  display: block;
  gap: 12px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 250, 0.94);
  backdrop-filter: blur(12px);
}

.summary-title {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.28rem);
  line-height: 1.2;
  font-weight: 760;
}

.results-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.results-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  white-space: nowrap;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.42rem);
  line-height: 1.15;
  font-weight: 820;
}

h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-weight: 840;
}

h2 { font-size: 1rem; }
h3 { font-size: 0.95rem; }

.site-links {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.site-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.snapshot-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 720;
}

.semina-note {
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #fff;
}

.semina-note-label {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 820;
  text-transform: uppercase;
}

.semina-note p {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.48;
}

.semina-note a {
  color: var(--accent);
  font-weight: 760;
  text-decoration: none;
}

.semina-note a:hover {
  text-decoration: underline;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric,
.score-panel,
.problem-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metric {
  padding: 12px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 820;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 1.55rem;
  font-weight: 880;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-section {
  margin-top: 14px;
}

.centered-section {
  display: grid;
  justify-items: center;
}

.score-section-header {
  width: 100%;
  margin-bottom: 8px;
}

.score-section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 680;
}

.score-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f6f8f9;
}

.score-panel-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.score-stat-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.problem-panel .score-stat-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.score-stat {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid var(--line);
}

.score-stat:last-child,
.problem-panel .score-stat:nth-child(4) {
  border-right: 0;
}

.score-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.score-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 0.86rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.individual-score-panel {
  max-width: 1080px;
  margin: 0 auto;
}

.score-chart-pad { padding: 12px; }

.individual-histogram-scroll {
  overflow-x: auto;
  padding-bottom: 2px;
}

.individual-histogram {
  display: grid;
  position: relative;
  grid-template-columns: repeat(var(--bucket-count), minmax(18px, 1fr));
  --bucket-gap: 4px;
  gap: var(--bucket-gap);
  min-width: 920px;
}

.individual-histogram-column {
  display: grid;
  position: relative;
  grid-template-rows: 380px 22px;
  align-items: end;
  min-width: 0;
}

.individual-sections {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 36px;
  pointer-events: none;
}

.individual-section {
  position: absolute;
  top: 0;
  left: calc(var(--section-left) * 1%);
  width: calc(var(--section-width) * 1%);
  min-width: 42px;
  padding: 4px 3px;
  color: var(--muted);
  text-align: center;
  overflow: hidden;
}

.individual-section span,
.individual-section strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.individual-section span {
  font-size: 0.62rem;
  font-weight: 840;
}

.individual-section strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 880;
}

.individual-frequency,
.individual-score-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 820;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.individual-frequency {
  position: absolute;
  right: 0;
  bottom: calc(max(2px, calc(var(--height) * (100% - 40px) / 100)) + 4px);
  left: 0;
}

.individual-score-label {
  align-self: end;
}

.individual-bar-slot {
  display: flex;
  position: relative;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  padding-top: 40px;
  border-bottom: 1px solid var(--line);
}

.score-histogram-bar {
  width: 100%;
  min-width: 0;
  height: max(2px, calc(var(--height) * 1%));
  border-radius: 4px 4px 0 0;
}

.score-histogram-bar.is-empty {
  height: 2px;
  background: #e5e9ed;
}

.individual-histogram-column.honorable .score-histogram-bar { background: linear-gradient(180deg, #5f7f70, #86a895); }
.individual-histogram-column.bronze .score-histogram-bar { background: linear-gradient(180deg, #94612f, #c18a4d); }
.individual-histogram-column.silver .score-histogram-bar { background: linear-gradient(180deg, #79848e, #b6bec6); }
.individual-histogram-column.gold .score-histogram-bar { background: linear-gradient(180deg, #9a6c18, #d6a438); }

.individual-cutoff-marker {
  position: absolute;
  top: 36px;
  bottom: 22px;
  left: calc(var(--bucket-gap) / -2);
  z-index: 3;
  width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
}

.individual-cutoff-marker::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
  opacity: 0.62;
}

.individual-cutoff-marker span {
  position: absolute;
  top: -23px;
  left: 50%;
  min-width: 32px;
  padding: 3px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 880;
  transform: translateX(-50%);
  font-variant-numeric: tabular-nums;
}

.problem-row span,
.problem-row strong {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.problem-row strong {
  color: var(--ink);
  text-align: right;
}

.problem-track {
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf1;
}

.problem-fill {
  width: calc(var(--width) * 1%);
  height: 100%;
  border-radius: inherit;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.problem-bars {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.problem-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.problem-track {
  height: 10px;
}

.problem-fill {
  background: linear-gradient(90deg, var(--green), #7fa866);
}

.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .metric-grid,
  .problem-grid {
    grid-template-columns: 1fr;
  }

  .score-stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  main { padding: 0 10px 14px; }
  .summary-strip { padding: 8px 0; }
  .semina-note { padding: 13px 15px; }
  .results-heading {
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
  }
  .site-links { max-width: 100%; overflow-x: auto; }
  .individual-histogram {
    grid-template-columns: repeat(var(--bucket-count), 18px);
    min-width: max-content;
  }
  .individual-histogram-column {
    grid-template-rows: 318px 20px;
  }
}
