:root {
  color-scheme: light;
  --paper: #f5f5ee;
  --surface: #fffefa;
  --ink: #202b22;
  --muted: #515e52;
  --line: #d6dbd0;
  --forest: #203c2c;
  --green: #428255;
  --yellow: #d4a841;
  --mono: "IBM Plex Mono", Consolas, monospace;
  font-family: Inter, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

p, h1, h2, dl, dd { margin: 0; }

button, input { font: inherit; }

:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 4px;
}

.container {
  width: min(100% - 3rem, 70rem);
  margin-inline: auto;
}

.masthead { border-bottom: 1px solid var(--line); }

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  min-height: 4.25rem;
  padding-block: 0.7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--forest);
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
}

.brand-domain { color: var(--muted); font-weight: 400; }

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 0.58rem);
  gap: 2px;
}

.brand-mark i {
  aspect-ratio: 1;
  background: #b8c0b4;
  border-radius: 2px;
}

.brand-mark i:nth-child(2) { background: var(--yellow); }
.brand-mark i:nth-child(n + 3) { background: var(--green); }

.snapshot, .period, .players-heading p, .table-notes {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.snapshot time { font: 0.875rem var(--mono); margin-inline-start: 0.25rem; }

.intro {
  min-height: 13.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-block: 2.5rem;
}

h1 {
  color: var(--forest);
  font-size: clamp(2.35rem, 7vw, 5rem);
  font-weight: 760;
  line-height: 0.99;
  letter-spacing: -0.065em;
  overflow-wrap: anywhere;
}

h1 span { color: var(--green); }

.wordle-grid {
  display: grid;
  flex: 0 1 12.7rem;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.3rem;
  transform: rotate(-6deg);
  margin-inline: 0.5rem 0.85rem;
}

.wordle-grid i {
  aspect-ratio: 1;
  border: 1px solid #c7cfc4;
  background: #e7ebe2;
  border-radius: 0.23rem;
}

.wordle-grid .green, .legend-tile.green { background: var(--green); border-color: var(--green); }
.wordle-grid .yellow, .legend-tile.yellow { background: var(--yellow); border-color: var(--yellow); }

.group { border-top: 1px solid var(--line); padding-top: 1.15rem; }

.section-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

h2 {
  color: var(--forest);
  font-size: clamp(1.4rem, 3vw, 1.75rem);
  letter-spacing: -0.045em;
}

.range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin: 0;
  min-inline-size: 0;
  padding: 0.2rem;
  border: 1px solid var(--line);
  background: #eaece3;
  border-radius: 0.6rem;
}

.range label { position: relative; }

.range input, .screen-reader-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.range span {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 0.4rem;
  color: var(--forest);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.range input:checked + span { color: white; background: var(--forest); }
.range input:not(:checked) + span:hover { background: var(--surface); }
.range input:focus-visible + span { outline: 2px solid var(--forest); outline-offset: 2px; }

.custom-range {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem 0.9rem;
  margin-top: 0.85rem;
}

.custom-range label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.custom-range input {
  padding: 0.43rem 0.55rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
}

.range-error { color: #8b3327; font-size: 0.875rem; flex-basis: 100%; text-align: end; }
.range-error:empty { display: none; }

.period { margin-block: 0.7rem 1rem; }

.group-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
}

.metric {
  display: grid;
  align-content: start;
  gap: 0.32rem;
  padding: 1.25rem 1.4rem 1.35rem;
}

.metric + .metric { border-inline-start: 1px solid var(--line); }
.metric:first-child { background: #e6ede1; }
.metric dt { color: var(--forest); font-size: 0.9rem; font-weight: 650; }

.metric strong {
  color: var(--forest);
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  font-weight: 730;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.metric-note { color: var(--muted); font-size: 0.81rem; line-height: 1.35; overflow-wrap: anywhere; }

.players { margin-top: 2.65rem; }
.players-heading { margin-bottom: 0.9rem; }

.table-scroll {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 43rem;
  border-spacing: 0;
  font-size: 0.91rem;
}

thead th {
  padding: 0.3rem 0.55rem;
  background: var(--forest);
  color: white;
  text-align: end;
  white-space: nowrap;
}

thead th:first-child { text-align: start; }

thead button {
  padding: 0.56rem 0.4rem;
  border: 0;
  border-radius: 0.3rem;
  background: transparent;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

thead button:hover, thead button:focus-visible { background: #3a5946; }
thead button:focus-visible { outline-color: white; outline-offset: 1px; }

thead button::after {
  display: inline-block;
  width: 0.9em;
  margin-left: 0.3rem;
  color: #d3e5d4;
  content: "↕";
}

thead th[aria-sort="ascending"] button::after { content: "↑"; }
thead th[aria-sort="descending"] button::after { content: "↓"; }

tr > :first-child {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  padding-inline-start: 1rem;
}

tbody th, tbody td {
  padding: 0.78rem 1rem;
  border-bottom: 1px solid #e5e8df;
  background: var(--surface);
  text-align: end;
  font-variant-numeric: tabular-nums;
}

tbody th { text-align: start; overflow-wrap: anywhere; min-width: 7.7rem; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: #f4f6ee; }
tbody .active-streak { color: #28643c; font-weight: 700; }
tbody .empty { text-align: start; color: var(--muted); position: static; }

.table-notes {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 0.9rem;
  margin-top: 0.75rem;
}

.score-legend, .score-legend span { display: flex; align-items: center; gap: 0.35rem; }
.score-legend { flex-wrap: wrap; column-gap: 0.7rem; }
.legend-tile { display: inline-block; width: 0.64rem; height: 0.64rem; border-radius: 2px; }

.methods {
  margin-block: 1.75rem 2.7rem;
  padding-block: 0.95rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.methods summary { width: fit-content; color: var(--forest); cursor: pointer; font-weight: 650; }
.methods p { max-width: 70ch; margin-top: 0.65rem; line-height: 1.55; }

@media (max-width: 42rem) {
  .container { width: calc(100% - 2rem); }
  .intro { min-height: 9.5rem; padding-block: 1.8rem; }
  .wordle-grid { display: none; }
  .group-metrics { grid-template-columns: 1fr; }
  .metric + .metric { border-inline-start: 0; border-top: 1px solid var(--line); }
  .metric { padding: 0.9rem 1rem; }
  .custom-range { justify-content: flex-start; }
  .range-error { text-align: start; }
  .players { margin-top: 1.8rem; }
  tbody th, tbody td { padding-inline: 0.8rem; }
}
