:root {
  --cream: #f7f1c8;
  --paper: #fffbe4;
  --ink: #172016;
  --muted: #53624c;
  --line: #172016;
  --mint: #b9f28b;
  --leaf: #49b64d;
  --moss: #226c38;
  --acid: #d8ff4f;
  --pond: #72d7c9;
  --gold: #ffd84a;
  --blush: #ff8f7a;
  --shadow: 7px 8px 0 #172016;
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(transparent 23px, rgba(23, 32, 22, 0.08) 24px),
    linear-gradient(90deg, transparent 23px, rgba(23, 32, 22, 0.08) 24px),
    linear-gradient(135deg, #ecffd9 0%, var(--cream) 48%, #d9f6df 100%);
  background-size: 24px 24px, 24px 24px, auto;
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    repeating-linear-gradient(7deg, rgba(23, 32, 22, 0.035) 0 2px, transparent 2px 16px),
    repeating-linear-gradient(119deg, rgba(73, 182, 77, 0.12) 0 10px, transparent 10px 42px);
  pointer-events: none;
  content: "";
}

button,
input,
select {
  font: inherit;
}

.doodle-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.spark,
.swirl {
  position: absolute;
  display: block;
}

.spark {
  width: 82px;
  height: 82px;
  transform: rotate(12deg);
}

.spark::before,
.spark::after {
  position: absolute;
  inset: 35px 0 auto;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--gold);
  content: "";
}

.spark::after {
  transform: rotate(90deg);
}

.spark-a {
  top: 92px;
  left: 24px;
}

.spark-b {
  right: 34px;
  bottom: 92px;
  transform: rotate(-19deg);
}

.swirl {
  width: 120px;
  height: 74px;
  border: 4px solid var(--ink);
  border-right: 0;
  border-radius: 80px 0 0 80px;
  opacity: 0.22;
}

.swirl-a {
  top: 240px;
  right: -22px;
  transform: rotate(18deg);
}

.swirl-b {
  bottom: 230px;
  left: -28px;
  transform: rotate(-12deg);
}

.app {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy {
  position: relative;
  min-width: 0;
  min-height: 268px;
  padding: 28px;
  border: 4px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-copy::after {
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 110px;
  height: 24px;
  border: 4px solid var(--ink);
  border-right: 0;
  border-left: 0;
  transform: rotate(-5deg);
  content: "";
}

.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--acid);
  color: var(--moss);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.share-x {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  max-width: none;
  padding: 0 16px;
  overflow: visible;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 4px 5px 0 var(--gold);
  color: var(--paper);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transform: rotate(1deg);
  white-space: nowrap;
}

.share-x:hover,
.share-x:focus-visible {
  background: var(--moss);
  color: var(--paper);
  outline: none;
  transform: translate(-1px, -1px) rotate(-1deg);
}

h1 {
  margin: 0 0 12px;
  max-width: 9ch;
  font-size: 4.55rem;
  line-height: 0.9;
}

.subtitle {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.45;
}

.mascot-card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 268px;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(160deg, var(--mint) 0%, var(--acid) 58%, var(--pond) 100%);
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

.mascot-image {
  display: block;
  width: 148%;
  max-width: 475px;
  max-height: 285px;
  object-fit: contain;
  filter: drop-shadow(5px 7px 0 rgba(23, 32, 22, 0.24));
  transform: translate(-13px, -8px) rotate(-1deg);
}

.mascot-label {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 5px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--gold);
  font-weight: 950;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stats div,
.panel,
.leader-section {
  border: 4px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stats div {
  position: relative;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.stats div::after {
  position: absolute;
  top: 12px;
  right: 13px;
  width: 34px;
  height: 34px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--mint);
  content: "";
}

.stats div:nth-child(2)::after {
  background: var(--pond);
}

.stats div:nth-child(3)::after {
  background: var(--gold);
}

.stats span,
.section-title span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 950;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  font-size: 2.08rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(216, 255, 79, 0.62), rgba(255, 251, 228, 0.96)),
    var(--paper);
}

.section-title {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 12px;
  border: 3px dashed var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.section-title strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  line-height: 1;
}

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

.leader-card {
  position: relative;
  min-width: 0;
  min-height: 156px;
  padding: 12px;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background: var(--mint);
  box-shadow: 4px 5px 0 var(--ink);
  transform: rotate(-1deg);
}

.leader-card:nth-child(2) {
  background: var(--pond);
  transform: rotate(1deg);
}

.leader-card:nth-child(3) {
  background: var(--gold);
  transform: rotate(-0.5deg);
}

.card-rank,
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 30px;
  padding: 4px 8px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 950;
}

.card-creature {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 88px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(3px 4px 0 rgba(23, 32, 22, 0.24));
  transform: rotate(2deg);
}

.leader-card strong {
  display: block;
  overflow: hidden;
  max-width: calc(100% - 100px);
  margin-top: 18px;
  font-size: 1.08rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leader-card small,
.leader-card em {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 0.86rem;
  font-style: normal;
  font-weight: 900;
}

.card-meter {
  display: block;
  width: calc(100% - 8px);
  height: 12px;
  margin-top: 10px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}

.card-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--leaf);
}

.panel {
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 10px;
  padding: 14px;
  border-bottom: 4px solid var(--line);
  background: var(--mint);
}

input,
select {
  width: 100%;
  height: 48px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  outline: none;
}

input {
  padding: 0 14px;
}

select {
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(216, 255, 79, 0.66);
}

.table-wrap {
  overflow: auto;
  background: var(--paper);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 3px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #f4e99b;
}

th:nth-child(1),
td:nth-child(1) {
  width: 92px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 33%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4) {
  width: 180px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 120px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 170px;
}

td {
  background: rgba(255, 251, 228, 0.95);
}

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

tbody tr:hover td {
  background: #d8ffbd;
}

.top-row td {
  background: #fff0a8;
}

.top-row .rank-badge {
  background: var(--gold);
}

.rank-cell {
  text-align: center;
}

.wallet-cell a {
  font-size: 1.04rem;
}

.score-cell strong,
.sol-cell strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.meter {
  display: block;
  width: 100%;
  height: 11px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.points-meter i {
  background: var(--leaf);
}

.sol-meter i {
  background: var(--pond);
}

.transfer-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 34px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 950;
}

.date-cell {
  color: var(--muted);
  font-weight: 900;
}

a {
  display: block;
  overflow: hidden;
  max-width: 34ch;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td strong {
  font-size: 1.02rem;
}

.empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.empty[hidden] {
  display: none;
}

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

  .mascot-card {
    min-height: 210px;
  }

  .mascot-image {
    width: min(132%, 420px);
    max-height: 210px;
    transform: translate(-8px, -4px) rotate(-1deg);
  }

  .leader-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 20px;
  }

  .hero-copy {
    padding: 20px;
  }

  .share-x {
    position: static;
    width: fit-content;
    min-height: 40px;
    margin: 0 0 18px;
    padding: 0 14px;
  }

  h1 {
    font-size: 2.85rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .stats,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .spark,
  .swirl {
    display: none;
  }

  .panel {
    overflow: visible;
  }

  .table-wrap {
    overflow: visible;
  }

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

  table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  thead {
    display: none;
  }

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

  tbody tr {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) minmax(76px, 0.75fr);
    grid-template-areas:
      "rank wallet points"
      "rank sol sol"
      "rank transfers date";
    gap: 8px 12px;
    align-items: center;
    padding: 14px 12px;
    border-bottom: 4px solid var(--line);
    background: rgba(255, 251, 228, 0.95);
  }

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

  tbody tr.top-row {
    background: #fff0a8;
  }

  tbody tr td,
  tbody tr:nth-child(even) td,
  tbody tr:hover td,
  tbody tr.top-row td {
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
  }

  tbody tr > td:nth-child(1),
  tbody tr > td:nth-child(2),
  tbody tr > td:nth-child(3),
  tbody tr > td:nth-child(4),
  tbody tr > td:nth-child(5),
  tbody tr > td:nth-child(6) {
    width: auto;
  }

  .rank-cell {
    grid-area: rank;
    align-self: center;
  }

  .rank-badge {
    min-width: 48px;
    min-height: 42px;
    padding: 5px 7px;
    font-size: 1.05rem;
  }

  .wallet-cell {
    grid-area: wallet;
    min-width: 0;
  }

  .wallet-cell a {
    max-width: 100%;
    font-size: 1.18rem;
    line-height: 1.05;
  }

  .wallet-cell small {
    max-width: 100%;
    font-size: 0.78rem;
  }

  .score-cell {
    grid-area: points;
    min-width: 0;
    text-align: left;
  }

  .score-cell strong {
    margin: 0 0 6px;
    font-size: 1.18rem;
    line-height: 1;
  }

  .score-cell .meter {
    width: 100%;
    min-width: 72px;
  }

  .sol-cell {
    grid-area: sol;
  }

  .transfer-cell {
    grid-area: transfers;
  }

  .date-cell {
    grid-area: date;
  }

  .sol-cell,
  .transfer-cell,
  .date-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 900;
  }

  .sol-cell::before,
  .transfer-cell::before,
  .date-cell::before {
    flex: 0 0 auto;
    padding: 3px 7px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--paper);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 950;
    line-height: 1;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .sol-cell strong {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.1;
    white-space: nowrap;
  }

  .sol-cell .meter {
    display: none;
  }

  .transfer-cell span {
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .date-cell {
    justify-content: flex-end;
    text-align: right;
  }
}
