/* The whole of the site's styling.
 *
 * It is one file on purpose: it is served once, cached forever under a hashed
 * name, and there is not enough of it to be worth splitting. The palette is the
 * four temperatures, a green for the guess that got it, and a paper - and
 * everything else is spacing.
 */

:root {
  color-scheme: light dark;

  --paper: #f6f4f0;
  --card: #ffffff;
  --ink: #16181d;
  --quiet: #5f6672;
  --line: #e2ded7;

  --hot: #c0392b;
  --hot-ink: #ffffff;
  --hot-wash: #fbeae7;
  --warm: #d3720f;
  --warm-ink: #ffffff;
  --warm-wash: #fdf0e2;
  --cold: #2a63b8;
  --cold-ink: #ffffff;
  --cold-wash: #e7eefa;
  --frigid: #4a6577;
  --frigid-ink: #ffffff;
  --frigid-wash: #eceff2;
  --win: #1f8a4c;
  --win-ink: #ffffff;
  --win-wash: #e4f3ea;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 18, 21, 0.06), 0 8px 24px rgba(16, 18, 21, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1216;
    --card: #171b21;
    --ink: #eef1f5;
    --quiet: #9aa3b0;
    --line: #262c35;

    --hot: #e05a48;
    --hot-wash: #2a1a18;
    --warm: #e59444;
    --warm-wash: #2a2016;
    --cold: #5b91e8;
    --cold-wash: #16202f;
    --frigid: #8fa6b6;
    --frigid-wash: #1b2026;
    --win: #4cc47f;
    --win-wash: #14251c;
    --hot-ink: #14100f;
    --warm-ink: #1a1208;
    --cold-ink: #0d1219;
    --frigid-ink: #10161b;
    --win-ink: #0c1a12;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

/* ------------------------------------------------------------------ bar -- */

.bar {
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: 10px;
}

.brand .pips { letter-spacing: 1px; font-size: 13px; }

.tab {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--quiet);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.tab:hover { background: var(--paper); color: var(--ink); }
.tab.on { background: var(--paper); color: var(--ink); font-weight: 600; }

.spacer { flex: 1 1 auto; }

.who {
  font-size: 13px;
  color: var(--quiet);
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.link {
  background: none;
  border: 0;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--quiet);
  cursor: pointer;
  border-radius: 999px;
}

button.link:hover { background: var(--paper); color: var(--ink); }

/* ---------------------------------------------------------------- shell -- */

main {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

main.wide { max-width: 900px; }

body.centred main {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card + .card { margin-top: 16px; }

h1 {
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h2 {
  font-size: 17px;
  margin: 0 0 12px;
}

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

.quiet { color: var(--quiet); font-size: 14px; }
.centre { text-align: center; }

/* --------------------------------------------------------------- puzzle -- */

.puzzle-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.puzzle-number {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.prompt {
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0 0 4px;
}

/* ---------------------------------------------------------------- form --- */

.guess-form {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="date"],
input[type="url"],
textarea {
  flex: 1 1 auto;
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  min-width: 0;
}

input:focus, textarea:focus {
  outline: 2px solid var(--cold);
  outline-offset: 1px;
}

.guess-form input {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The spinners on a number input are a fiddly target next to a large button,
 * and the keyboard is the only way anybody actually enters a guess. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

button.go, .button {
  font: inherit;
  font-weight: 600;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

button.go:hover, .button:hover { opacity: 0.9; }
button.go:disabled { opacity: 0.4; cursor: default; }

.button.quiet-button, button.go.quiet-button {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* The admin's replay, which is a debugging tool sitting on the page everybody
 * else plays on: small, quiet, and never the thing the eye lands on. */
.clear-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.clear-row button.go.quiet-button { padding: 8px 14px; font-size: 14px; }

/* --------------------------------------------------------------- board --- */

.board { margin-top: 18px; }

.play {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--card);
}

.play .try {
  font-size: 12px;
  color: var(--quiet);
  width: 2.5ch;
  font-variant-numeric: tabular-nums;
}

.play .number {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 1 1 auto;
}

.verdict {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.play.hot { background: var(--hot-wash); border-color: var(--hot); }
.play.hot .verdict { background: var(--hot); color: var(--hot-ink); }
.play.warm { background: var(--warm-wash); border-color: var(--warm); }
.play.warm .verdict { background: var(--warm); color: var(--warm-ink); }
.play.cold { background: var(--cold-wash); border-color: var(--cold); }
.play.cold .verdict { background: var(--cold); color: var(--cold-ink); }
.play.frigid { background: var(--frigid-wash); border-color: var(--frigid); }
.play.frigid .verdict { background: var(--frigid); color: var(--frigid-ink); }
.play.win { background: var(--win-wash); border-color: var(--win); }
.play.win .verdict { background: var(--win); color: var(--win-ink); }

.play.latest { transform: none; animation: land 0.28s ease-out; }

@keyframes land {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .play.latest { animation: none; }
}

/* -------------------------------------------------------------- reveal --- */

.reveal { border-color: var(--win); }

.answer {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 4px 0 2px;
}

.answer-unit { color: var(--quiet); font-size: 15px; margin-bottom: 12px; }

.squares {
  font-size: 22px;
  letter-spacing: 2px;
  line-height: 1.35;
  word-break: break-all;
  margin: 12px 0;
}

.share-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.share-text {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: pre;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-top: 12px;
}

.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }

/* --------------------------------------------------------------- stats --- */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.figure { text-align: center; }

.figure .value {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.figure .name {
  font-size: 12px;
  color: var(--quiet);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* -------------------------------------------------------------- tables --- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--quiet);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

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

td.number, th.number { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* A date is one thing and should be on one line. The table it is in scrolls
 * sideways rather than wrapping, so this costs a narrow phone a scroll rather
 * than three lines of "Aug 27, 2026" stacked in a column. */
td.day { white-space: nowrap; }

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

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--quiet);
  white-space: nowrap;
}

.pill.live { background: var(--win-wash); border-color: var(--win); color: var(--win); }
.pill.draft { background: var(--hot-wash); border-color: var(--hot); color: var(--hot); }

/* --------------------------------------------------------------- forms --- */

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}

.field .hint { font-size: 12px; color: var(--quiet); margin-top: 4px; }

.field textarea { min-height: 90px; resize: vertical; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.checkbox input { width: auto; flex: 0 0 auto; }

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.actions .spacer { flex: 1 1 auto; }

.danger {
  background: none;
  border: 1px solid var(--hot);
  color: var(--hot);
}

/* -------------------------------------------------------------- notices -- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--card);
}

.notice.bad { background: var(--hot-wash); border-color: var(--hot); color: var(--hot); }
.notice.good { background: var(--win-wash); border-color: var(--win); color: var(--win); }

#error { display: none; }

/* --------------------------------------------------------------- rules --- */

.rules { margin-top: 16px; }

.rules summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--quiet);
}

.rules ul { margin: 12px 0 0; padding-left: 20px; }
.rules li { margin-bottom: 8px; font-size: 14px; }

footer {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px 40px;
  font-size: 13px;
  color: var(--quiet);
  text-align: center;
}

footer a { color: var(--quiet); }

@media (max-width: 480px) {
  h1 { font-size: 22px; }
  .prompt { font-size: 19px; }
  .answer { font-size: 34px; }
  .guess-form { flex-wrap: wrap; }
  .guess-form button { width: 100%; }
}

/* A report on the edit page: somebody's complaint, and the two buttons that
   answer it. The open ones are marked, because the whole point of the block is
   the queue and a wall of closed ones would bury it. */
.report-row {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.report-row:first-of-type { border-top: 0; }
.report-row.open { border-left: 3px solid var(--hot); padding-left: 12px; }
.report-row p { margin: 0 0 8px; }
.report-row a { word-break: break-all; }

/* The report form on the board, which is a details block like the rules above
   it rather than a card of its own: it is the least important thing on the page
   until it is the only thing somebody wants. */
.report { margin-top: 16px; }
.report .field { margin-top: 12px; }
.report textarea { min-height: 70px; }
