:root {
  color-scheme: light dark;
  --bg: #fdf8f1;
  --text: #1d1d1b;
  --muted: #6b6760;
  --line: rgba(0, 0, 0, 0.1);
  --panel: rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --text: #ece9e3;
    --muted: #9a958c;
    --line: rgba(255, 255, 255, 0.12);
    --panel: rgba(255, 255, 255, 0.04);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

main {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.lede {
  margin: 4px 0 20px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* --- map --- */

.map {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(3px, 0.8vw, 10px);
  container-type: inline-size;
}

.tile {
  --tile-bg: #ccc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--tile-bg) 70%, black);
  border-radius: clamp(4px, 1cqi, 10px);
  background: var(--tile-bg);
  color: #111;
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.tile:focus-visible {
  outline: 3px solid #2f6fde;
  outline-offset: 2px;
}

.tile[aria-pressed='true'] {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--text);
}

.tile.est {
  border-style: dashed;
  background: color-mix(in srgb, var(--tile-bg) 60%, var(--bg));
}

.tile .abbr {
  font-weight: 700;
  font-size: clamp(9px, 2.1cqi, 22px);
}

.tile .ms {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: clamp(8px, 1.9cqi, 20px);
}

.tile .sub {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: clamp(7px, 1.2cqi, 13px);
  opacity: 0.7;
}

/* --- legend --- */

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 24px;
  font-size: 13px;
  color: var(--muted);
}

.legend-bar {
  width: 160px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(130 55% 52%), hsl(65 55% 52%), hsl(0 55% 52%));
}

.legend-est {
  margin-left: auto;
}

/* --- detail --- */

.detail {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.detail h2 {
  margin: 0;
  font-size: 1.2rem;
}

.detail p {
  margin: 4px 0 12px;
  font-size: 14px;
}

.ranked {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ranked th,
.ranked td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ranked .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ranked tr.est td {
  font-style: italic;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted;
  cursor: pointer;
}

footer {
  margin-top: 20px;
  font-size: 13px;
}
