:root {
  --paper: #f7f7f1;
  --card: #fcfcf8;
  --ink: #202333;
  --muted: #62656e;
  --line: #cdd0ca;
  --empty: #dcdfd8;
  --blue: #3054d7;
  --blue-early: #9aabe9;
  --pale: #e9edff;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "DM Sans", Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
}
button,
input {
  font: inherit;
  color: inherit;
}
button,
a,
label {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.wrap {
  width: min(1192px, calc(100% - 32px));
  margin: auto;
}

/* Page chrome */
body > header {
  background: #fbfbf7;
  border-bottom: 1px solid var(--line);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 800 1.7rem/1 var(--display);
  letter-spacing: -0.5px;
  text-decoration: none;
}
.brand img {
  image-rendering: pixelated;
}
.plain {
  background: transparent;
  border: 0;
  padding: 8px 4px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
.plain:hover {
  color: var(--ink);
}
.primary {
  background: var(--blue);
  border: 1px solid #2546c5;
  color: white;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 16px;
  border-radius: 4px;
}
.primary:hover {
  background: #2446bd;
}
.primary:disabled {
  background: var(--empty);
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
}
.outline {
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 16px;
}
.outline:hover {
  background: var(--ink);
  color: var(--paper);
}

/* Introduction */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 36px 0 26px;
}
.hero h1 {
  font: 800 clamp(2.5rem, 7vw, 4.6rem) / 0.94 var(--display);
  letter-spacing: -0.02em;
  max-width: 13em;
}
.hero p {
  margin-top: 14px;
  max-width: 34em;
  font-size: 1.06rem;
  color: var(--muted);
}
.hero img {
  image-rendering: pixelated;
  border: 1px solid var(--line);
  border-radius: 4px;
  flex: none;
}

/* Sorting and search */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.sort {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
#sort-label {
  font: 700 1.25rem/1 var(--display);
  white-space: nowrap;
}
#sort {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#sort button {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
#sort button:hover {
  border-color: var(--ink);
}
#sort button[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}
#search {
  width: min(260px, 100%);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  font-size: 0.92rem;
}
.guide {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding: 14px 0 18px;
  font-size: 0.88rem;
  color: var(--muted);
}
.legend {
  display: flex;
  gap: 18px;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.key {
  width: 22px;
  height: 12px;
  background: var(--blue);
}
.key.yours {
  background: var(--card);
  box-shadow: inset 0 0 0 3px var(--ink);
}

/* Stat sheets */
.sheets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 18px;
  align-items: start;
}
.notice {
  grid-column: 1 / -1;
  padding: 40px 0;
  color: var(--muted);
}
.sheet {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  border-radius: 3px;
  padding: 16px 18px 14px;
}
.sheet.pinned {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--pale);
}
.sheet > header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-bottom: 10px;
}
.sheet h2 {
  font: 800 1.75rem/1 var(--display);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.maker {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--muted);
}
.title {
  flex: 1;
  min-width: 0;
}
.rank {
  flex: none;
  font: 800 1.75rem/1 var(--display);
  color: var(--blue);
}
.overall {
  flex: none;
  text-align: right;
  line-height: 1;
}
.overall b {
  display: block;
  font: 800 1.75rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.overall span {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.sheet.by-overall .overall b,
.sheet.by-overall .overall span {
  color: var(--blue);
}
.stat {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 5px 10px;
  margin: 0 -18px;
  padding: 7px 18px 9px;
  border-top: 1px solid #e3e5df;
}
.stat.sorted {
  background: var(--pale);
}
.stat h3 {
  font: 800 1.12rem/1 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.score {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.score b {
  font: 700 1.2rem/1 var(--display);
  min-width: 1.6em;
  text-align: right;
}
.score small {
  order: -1;
  font-size: 0.78rem;
  color: var(--muted);
}
.stat.picked .score small {
  color: var(--ink);
}
.desc {
  grid-column: 1 / -1;
  display: none;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}
.sheet.rating .desc {
  display: block;
}
.bar {
  grid-column: 1 / -1;
  display: flex;
  gap: 3px;
}
.cell {
  position: relative;
  flex: 1;
  height: 24px;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--blue) var(--fill, 0%),
    var(--empty) var(--fill, 0%)
  );
}
.sheet.early .cell {
  background: linear-gradient(
    to right,
    var(--blue-early) var(--fill, 0%),
    var(--empty) var(--fill, 0%)
  );
}
.cell input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
/* Segment numbers appear when you are about to rate: on hover, while a
   sheet is being rated, on keyboard focus, and always on touch screens. */
.cell span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 0.72rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}
.cell span.on {
  color: white;
}
.sheet.rating .cell span,
.sheet:not(.rated) .bar:focus-within span {
  opacity: 1;
}
/* While you rate a stat, its bar shows your pick instead of the average. */
.bar:has(input:checked) .cell {
  background: var(--empty);
}
.bar:has(input:checked) .cell span {
  color: var(--muted);
}
.bar .cell:has(input:checked),
.bar .cell:has(~ .cell input:checked) {
  background: var(--ink);
}
.bar .cell:has(input:checked) span,
.bar .cell:has(~ .cell input:checked) span {
  color: white;
}
.cell.mine {
  box-shadow: inset 0 0 0 3px var(--ink);
}
.cell:has(input:focus-visible) {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  z-index: 1;
}
.sheet.rated .cell,
.sheet.rated .cell input {
  cursor: default;
}
@media (hover: hover) {
  .sheet:not(.rated) .bar:hover span {
    opacity: 1;
  }
  .sheet:not(.rated) .bar:hover .cell:hover,
  .sheet:not(.rated) .bar:hover .cell:has(~ .cell:hover) {
    background: #5a5f78;
  }
  .sheet:not(.rated) .bar:hover .cell:hover span,
  .sheet:not(.rated) .bar:hover .cell:has(~ .cell:hover) span {
    color: white;
  }
}
@media (hover: none) {
  .sheet:not(.rated) .cell span {
    opacity: 1;
  }
}
.sheet > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  min-height: 44px;
  margin: 0 -18px;
  padding: 10px 18px 0;
  border-top: 1px solid #e3e5df;
}
.status {
  flex: 1 1 12em;
  font-size: 0.86rem;
  color: var(--muted);
}
.sheet.rating .status {
  color: var(--ink);
  font-weight: 600;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Footer and dialogs */
footer.wrap {
  margin-top: 28px;
  padding: 16px 0 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--muted);
}
footer.wrap b {
  font: 700 1.1rem var(--display);
  color: var(--ink);
}
footer.wrap a {
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}
footer.wrap a:hover {
  color: var(--ink);
}
.foot-links {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.foot-links .plain {
  font-size: inherit;
}
dialog {
  border: 1px solid #8f9693;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  max-width: min(450px, 90vw);
  padding: 24px;
  box-shadow: 0 10px 60px #1e223430;
}
dialog::backdrop {
  background: #20263b66;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-head h2 {
  font: 800 2rem/1 var(--display);
}
.dialog-head button {
  font-size: 1.6rem;
  background: transparent;
  border: 0;
}
dialog p {
  margin: 13px 0;
  color: var(--muted);
}
dialog .primary {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .top {
    height: 52px;
  }
  .hero {
    padding: 22px 0 18px;
  }
  .hero img {
    display: none;
  }
  .hero p {
    font-size: 1rem;
  }
  .controls {
    padding-top: 14px;
  }
  .sort {
    width: 100%;
  }
  /* One swipeable row keeps the first sheet on the opening screen. */
  #sort {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 3px;
    margin: -3px;
  }
  #search {
    width: 100%;
  }
  .cell {
    height: 30px;
  }
}
