:root {
  color-scheme: light;
  --paper: #f7f2df;
  --paper-strong: #fffaf0;
  --ink: #17140f;
  --muted: #6b6255;
  --line: #ded2b8;
  --blue: #2364aa;
  --green: #4f9f39;
  --coral: #ef5d3f;
  --gold: #f0b83a;
  --violet: #6857c8;
  --shadow: 0 14px 32px rgb(23 20 15 / 13%);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(35 100 170 / 9%) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(180deg, var(--paper), #eee4c9);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
table {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(100% - 20px, 680px);
  margin: 0 auto;
  padding: 14px 0 32px;
}

.topbar {
  display: grid;
  gap: 14px;
  padding: 10px 0 16px;
  border-bottom: 4px solid var(--ink);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  max-width: 11ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 0.94;
}

.month-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  background: var(--ink);
  border-radius: 8px;
}

.month-tab {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  color: var(--paper-strong);
  background: transparent;
  font-weight: 950;
  cursor: pointer;
}

.month-tab:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.month-tab.is-selected {
  color: var(--ink);
  background: var(--gold);
}

.leaderboard-app {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.month-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.summary-tile {
  position: relative;
  min-height: 92px;
  padding: 12px;
  overflow: hidden;
  background: var(--paper-strong);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-tile::before {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  content: "";
  background: repeating-linear-gradient(90deg, var(--blue) 0 16px, var(--green) 16px 32px, var(--coral) 32px 48px, var(--gold) 48px 64px);
}

.summary-tile span,
.summary-tile small {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

.summary-tile strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(1.05rem, 7vw, 1.48rem);
  line-height: 1.05;
}

.summary-tile small {
  margin-top: 5px;
  text-transform: none;
}

.rule-strip {
  display: grid;
  gap: 7px;
}

.rule-strip span {
  display: flex;
  min-height: 34px;
  align-items: center;
  padding: 7px 10px;
  color: var(--paper-strong);
  background: var(--ink);
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.2;
}

.boards {
  display: grid;
  gap: 18px;
  align-items: start;
}

.board-panel {
  min-width: 0;
}

.panel-heading {
  display: grid;
  gap: 6px;
  padding: 0 2px 10px;
}

.panel-heading h2 {
  font-size: 1.08rem;
  line-height: 1;
}

.panel-heading p,
.panel-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.panel-heading span {
  font-weight: 900;
}

.table-wrap {
  min-width: 0;
}

table,
thead,
tbody,
tr,
td {
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

tbody {
  display: grid;
  gap: 9px;
}

tbody tr {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 12px;
  background: var(--paper-strong);
  border: 2px solid var(--ink);
  border-left-width: 7px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

tbody tr:nth-child(1) {
  border-left-color: var(--gold);
}

tbody tr:nth-child(2) {
  border-left-color: var(--violet);
}

tbody tr:nth-child(3) {
  border-left-color: var(--coral);
}

td {
  min-width: 0;
  padding: 0;
  border: 0;
  font-weight: 800;
}

td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

td[data-column="rank"] {
  grid-row: 1 / span 2;
  align-self: start;
}

td[data-column="rank"]::before,
td[data-column="player"]::before {
  content: "";
  display: none;
}

td[data-column="player"] {
  align-self: center;
  overflow: hidden;
  font-size: 1.06rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td[data-primary="true"] {
  grid-column: 2;
  display: grid;
  gap: 1px;
  align-self: start;
  color: var(--ink);
  font-size: 1.62rem;
  font-weight: 950;
  line-height: 1;
}

td:not([data-column="rank"]):not([data-column="player"]):not([data-primary="true"]) {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 7px 9px;
  background: #f4ecd4;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.92rem;
}

.rank {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--paper-strong);
  background: var(--blue);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 950;
}

.rank-1 {
  color: var(--ink);
  background: var(--gold);
}

.rank-2 {
  background: var(--violet);
}

.rank-3 {
  background: var(--coral);
}

@media (min-width: 701px) {
  .shell {
    width: min(1180px, calc(100% - 32px));
    padding: 28px 0 40px;
  }

  .topbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0 22px;
  }

  .eyebrow {
    font-size: 0.8rem;
  }

  h1 {
    max-width: 720px;
    font-size: clamp(2.8rem, 5vw, 5.1rem);
  }

  .month-tabs {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
    gap: 8px;
  }

  .leaderboard-app {
    gap: 18px;
    padding-top: 18px;
  }

  .month-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .summary-tile {
    min-height: 116px;
    padding: 14px;
  }

  .summary-tile span,
  .summary-tile small {
    font-size: 0.76rem;
  }

  .summary-tile strong {
    font-size: 1.45rem;
  }

  .rule-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .rule-strip span {
    display: inline-flex;
    padding: 0 12px;
    font-size: 0.84rem;
  }

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

  .board-panel {
    overflow: hidden;
    background: var(--paper-strong);
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .board-panel:first-child {
    grid-column: 1 / -1;
  }

  .panel-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    color: var(--paper-strong);
    background: var(--ink);
  }

  .panel-heading p,
  .panel-heading span {
    margin-top: 5px;
    color: #d8cfbd;
    font-size: 0.82rem;
  }

  .panel-heading span {
    flex: 0 0 auto;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    display: table;
    min-width: 560px;
  }

  thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  tbody {
    display: table-row-group;
  }

  tr {
    display: table-row;
  }

  tbody tr {
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  th,
  td {
    display: table-cell;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    white-space: nowrap;
  }

  th {
    color: var(--muted);
    background: #fbf4df;
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  th:nth-child(2),
  td:nth-child(2) {
    text-align: left;
  }

  td {
    font-weight: 750;
  }

  td::before {
    content: none;
  }

  td[data-column="rank"],
  td[data-column="player"],
  td[data-primary="true"],
  td:not([data-column="rank"]):not([data-column="player"]):not([data-primary="true"]) {
    display: table-cell;
    min-height: 0;
    padding: 11px 14px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    color: inherit;
    font-size: inherit;
    font-weight: 750;
    line-height: inherit;
    text-align: right;
    white-space: nowrap;
  }

  td[data-column="player"] {
    text-align: left;
  }

  tbody tr:nth-child(even) {
    background: #f5edd6;
  }

  tbody tr:nth-child(odd) {
    background: transparent;
  }

  tbody tr:hover {
    background: #e8f0d8;
  }

}
