body {
  font-family: system-ui, sans-serif;
  margin: 1rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ccc;
}

.site-header nav {
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

.site-header form {
  display: inline;
}

.site-footer {
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 1px solid #ccc;
  font-size: 0.9rem;
}

/* A button that looks like the links around it */
button.link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: LinkText;
  text-decoration: underline;
  cursor: pointer;
}

form.account {
  max-width: 20rem;
}

form.account div {
  margin-bottom: 0.75rem;
}

form.account label {
  display: block;
}

form.account input {
  width: 100%;
  box-sizing: border-box;
}

form.account input[type="checkbox"] {
  width: auto;
}

.helptext {
  display: block;
  font-size: 0.8rem;
  color: #666;
}

.errorlist {
  margin: 0.25rem 0;
  padding-left: 1rem;
  color: #b00;
}

/* The progress of the player on a puzzle, on the list */
.progress {
  margin-left: 0.5rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.8rem;
  background: #eee;
  color: #555;
}

.progress.in-progress {
  background: #fde8c8;
  color: #7a4a00;
}

.progress.solved {
  background: #d8f3dc;
  color: #1b5e20;
}

.extra {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The puzzle list: a table without a grid, the headings sort it, the
   controls under them filter their column */
.puzzles {
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.puzzles th,
.puzzles td {
  padding: 0.25rem 0.75rem 0.25rem 0;
  text-align: left;
  vertical-align: baseline;
}

.puzzles a,
.puzzles .progress {
  white-space: nowrap;
}

.puzzles .time {
  font-size: inherit;
  color: inherit;
}

.puzzles .hinted {
  display: block;
}

/* Keep the sortable headings readable on a narrow screen. */
@media (max-width: 480px) {
  .puzzles {
    font-size: 0.9rem;
  }

  .puzzles th,
  .puzzles td {
    padding-right: 0.4rem;
  }

  .puzzles .sort,
  .puzzles a,
  .puzzles .progress {
    white-space: normal;
  }
}

.puzzles .filter td {
  padding-bottom: 0.75rem;
}

.puzzles select {
  width: 100%;
}

.sort {
  cursor: pointer;
  white-space: nowrap;
}

.sort input {
  position: absolute;
  opacity: 0;
}

.sort span {
  color: LinkText;
  text-decoration: underline;
}

.sort input:checked + span {
  color: inherit;
  text-decoration: none;
}

.sort input:checked + span::after {
  content: " ▲";
  font-size: 0.7em;
}

.sort input:focus-visible + span {
  outline: 2px solid currentColor;
}

/* The time of a solved puzzle and the note about the hints */
.time,
.hinted {
  font-size: 0.8rem;
  color: #555;
}

.pages {
  display: flex;
  gap: 1rem;
}

/* The difficulty beside the title of a board */
.level {
  font-size: 1rem;
  font-weight: normal;
  color: #555;
}

/* The days in a row the player raced the puzzle of the day */
.streak {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: #555;
}

/* The tables of a player's page: the numbers to the right */
.results {
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.results th,
.results td {
  padding: 0.15rem 1rem 0.15rem 0;
  text-align: left;
}

.results .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The rating of the players: the numbers to the right */
.ratings {
  border-collapse: collapse;
}

.ratings th,
.ratings td {
  padding: 0.15rem 1rem 0.15rem 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ratings th:nth-child(2),
.ratings td:nth-child(2) {
  text-align: left;
  /* A long name wraps rather than push the numbers off a phone */
  overflow-wrap: anywhere;
}

.ratings .mine {
  font-weight: bold;
}

/* Earned badges on a player's page. Size badges share a chequered tile. */
.achievements {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  max-width: 42rem;
  gap: 1rem 1.5rem;
  list-style: none;
  padding: 0;
}

.achievements li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.badge-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.4rem;
  color: #25332f;
  font-variant-numeric: tabular-nums;
  font-weight: bold;
}

.badge-first { background: #eed9a7; font-size: 1.55rem; }
.badge-clean { background: #c1dfc6; }
.badge-fast { background: #bcdbea; font-size: 1.6rem; }
.badge-streak { background: #f2c9b9; }
.badge-size {
  background: repeating-conic-gradient(#d7c8e3 0 25%, #e6dcef 0 50%)
    0 0 / 1.3rem 1.3rem;
  font-size: 1.35rem;
}
