/* Shared styles for every page of the game. */

:root {
  color-scheme: dark;
  --bg: #111318;
  --surface: #1b1e25;
  --border: #2e323c;
  --text: #ebe7df;
  --muted: #a19c92;
  --accent: #f0b429;
  --accent-hover: #f7c654;
  --on-accent: #16130b;
  --error: #ff8f80;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.65 var(--font-body);
}

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 1rem 4rem;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: normal;
  line-height: 1.2;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.75rem);
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.button,
button {
  display: inline-block;
  padding: 0.7rem 2rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
button:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

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

/* Start page */

.start-header {
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.logo {
  display: block;
  margin: 0 auto 1.25rem;
}

.tagline {
  margin: 0.5rem 0 1.75rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.intro h2 {
  margin: 2.5rem 0 1rem;
  font-size: 1.4rem;
}

.intro ul {
  padding-left: 1.25rem;
}

.intro li + li {
  margin-top: 0.5rem;
}

.start footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  color: var(--muted);
  font: italic 0.875rem/1.5 var(--font-display);
  text-align: center;
}

.start footer p {
  margin: 0;
}

.start footer p + p {
  margin-top: 0.75rem;
}

.start footer .icon {
  width: 1.25em;
  height: 1.25em;
  margin-right: 0.3em;
  vertical-align: -0.3em;
}

/* Leaderboard */

.leaderboard main {
  text-align: center;
}

.leaderboard-intro {
  margin: 0.5rem 0 2rem;
  color: var(--muted);
  font-size: 1.15rem;
}

/* Scrolls sideways instead of breaking the page if a row is ever too wide. */
.table-wrap {
  margin-bottom: 2.5rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.leaderboard table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard th,
.leaderboard td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow-wrap: anywhere; /* long names and handles wrap on phones */
}

.leaderboard th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.leaderboard tbody tr:last-child td {
  border-bottom: 0;
}

/* The position column: only as wide as its numbers. */
.leaderboard th:first-child,
.leaderboard td:first-child {
  width: 1%;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.leaderboard .none {
  color: var(--muted);
  font-style: italic;
}

/* Level pages */

.level main {
  text-align: center;
}

.puzzle {
  margin: 2rem 0;
}

.puzzle img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Several images side by side, read left to right. They shrink to stay on
   one line on narrow screens, so the order is never lost to wrapping. */
.puzzle-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.puzzle-row img {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}

.puzzle-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clue {
  margin: 0 0 3rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
}

/* A level with no image: keep the clue clear of the heading. */
h1 + .clue {
  margin-top: 2rem;
}

.answer-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.answer-form input {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 20rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 1rem var(--font-mono);
}

.message {
  min-height: 1.65em;
  margin: 1rem 0 0;
  color: var(--error);
  overflow-wrap: anywhere; /* long links wrap on phones */
}

.message.is-close {
  color: var(--accent);
}
