/* arrangeit styles. Roman, from the owner's moodboard: aged parchment, sand, sage, dark olive and terracotta,
   with red, black and gold as the highlights. Light is a parchment collage with black plaques; dark is the
   black-olive of an amphora. Ornament is drawn in code (key-pattern bands, inset tablet frames).
   Layers (z-index): -1 parchment mottling, 10 header, 20 card being dragged, 30 paper grain overlay. */

@font-face {
  font-family: "Cinzel";
  src: url("/fonts/cinzel.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

/* ----- Tokens ----- */

:root {
  --bg: #ece4d6;
  --surface: #e3d6c2;
  --card: #f6f1e7;
  --ink: #1b1a17;
  --muted: #5b5a4b;
  --line: #3e4632;
  --line-soft: #c2ae8c;
  --hair: rgb(62 70 50 / 0.18);
  --terracotta: #8f4a2b;
  --gold: #b48a2c;
  --gold-text: #7a5a12;
  --stamp-bg: #1b1a17;
  --stamp-ink: #d9b65e;
  --red: #9e1b17;
  --on-red: #f6f1e7;
  --mark: #9e1b17;
  --edge-red: #5e0f0c;
  --edge-stone: #b4a283;
  --ok: #3d7535;
  --ok-ink: #f6f1e7;
  --bad: #a3221b;
  --bad-ink: #f6f1e7;
  --lift: 0 18px 32px -16px rgb(27 26 23 / 0.5);
  --mottle: rgb(201 173 138 / 0.22);
  --edge: rgb(120 95 60 / 0.14);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
  --pad: 16px;
  --max: 1240px;
  --band: 16px;
  --bar-h: 81px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --key: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M0 2H28M0 26H28M4 26V7H22V21H11V12H17' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='square'/%3E%3C/svg%3E");
  color-scheme: light;
}

:root[data-mode="dark"] {
  --bg: #1a1a15;
  --surface: #24241d;
  --card: #201f1a;
  --ink: #ede3d1;
  --muted: #b9b09a;
  --line: #8c7a4e;
  --line-soft: #4a4636;
  --hair: rgb(207 166 74 / 0.2);
  --terracotta: #c9794a;
  --gold: #cfa64a;
  --gold-text: #d9b65e;
  --stamp-bg: #cfa64a;
  --stamp-ink: #1a1a15;
  --red: #b22a22;
  --mark: #d9503f;
  --edge-red: #5a1410;
  --edge-stone: #0c0c09;
  --ok: #86b05a;
  --ok-ink: #141410;
  --bad: #d9503f;
  --bad-ink: #141410;
  --lift: 0 18px 34px -14px rgb(0 0 0 / 0.75);
  --mottle: rgb(207 166 74 / 0.05);
  --edge: rgb(0 0 0 / 0.45);
  color-scheme: dark;
}

/* Black plaques in the light collage, like the dark tiles on the moodboard: the Daily tile, results and round scores. */
:root:not([data-mode="dark"]) :is(.result, .verdict) {
  --bg: #1b1a17;
  --surface: #1b1a17;
  --card: #26251f;
  --ink: #ede3d1;
  --muted: #b9b09a;
  --line: #8c7a4e;
  --line-soft: #4a4636;
  --hair: rgb(207 166 74 / 0.22);
  --gold: #cfa64a;
  --gold-text: #d9b65e;
  --terracotta: #c9794a;
  --edge-stone: #0c0c09;
  color: var(--ink);
}

:root[data-cb="on"] {
  --ok: #e2b634;
  --ok-ink: #24211e;
  --bad: #6a3fa0;
  --bad-ink: #f8f6f1;
}

:root[data-mode="dark"][data-cb="on"] {
  --ok: #f0c85a;
  --ok-ink: #141210;
  --bad: #a98be0;
  --bad-ink: #141210;
}

/* ----- Base ----- */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 18px;
  line-height: 1.45;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

/* Aged parchment: soft mottling with darker edges. Fixed and click-through, so it never repaints on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 12%, var(--mottle), transparent 42%),
    radial-gradient(ellipse at 82% 34%, var(--mottle), transparent 38%),
    radial-gradient(ellipse at 40% 88%, var(--mottle), transparent 45%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, var(--edge) 100%);
}

/* Paper grain over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-mode="dark"] body::after {
  opacity: 0.08;
  mix-blend-mode: soft-light;
}

main {
  flex: 1;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--pad);
  top: -100px;
  z-index: 11;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.skip:focus {
  top: 8px;
}

.label {
  margin: 0;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* A gold key-pattern band, used under the header and above the footer. */
.bar::after,
.foot::before,
.arena::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--band);
  background-color: var(--gold);
  -webkit-mask: var(--key) repeat-x left center / var(--band) var(--band);
  mask: var(--key) repeat-x left center / var(--band) var(--band);
}

/* ----- Header -----
   One slim row, like the reference games: the menu on the left, the name in the middle,
   and How to play, Stats and Settings as raised-stone icon buttons on the right. */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: calc(var(--band) + 1px);
  background: var(--bg);
  border-top: 4px solid var(--red);
}

.bar::after {
  bottom: 0;
}

.bar-in {
  max-width: var(--max);
  height: 60px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.bar-in > .icon-btn {
  justify-self: start;
}

.bar .logo {
  justify-self: center;
}

.bar-tools {
  justify-self: end;
  display: flex;
  gap: 8px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
}

/* A diamond stop, like the word dividers carved in Roman inscriptions. */
.logo-mark {
  width: 9px;
  height: 9px;
  background: var(--mark);
  transform: rotate(45deg);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-bottom: 3px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: 0 3px 0 var(--edge-stone), 0 6px 10px -6px rgb(27 26 23 / 0.35);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s;
}

.icon-btn:hover {
  background: var(--surface);
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 var(--edge-stone), inset 0 2px 4px rgb(27 26 23 / 0.18);
}

/* ----- Buttons ----- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  margin-bottom: 4px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.12), rgb(0 0 0 / 0.08)), var(--red);
  color: var(--on-red);
  border: 1px solid var(--edge-red);
  border-radius: 0;
  box-shadow: 0 4px 0 var(--edge-red), 0 10px 18px -8px rgb(27 26 23 / 0.55);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.btn::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold);
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--edge-red), 0 14px 22px -10px rgb(27 26 23 / 0.6);
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--edge-red), 0 2px 4px -2px rgb(27 26 23 / 0.4);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: translateY(4px);
  box-shadow: none;
}

.btn-ghost {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.35), rgb(0 0 0 / 0.04)), var(--card);
  color: var(--ink);
  border-color: var(--line-soft);
  box-shadow: 0 4px 0 var(--edge-stone), 0 10px 18px -8px rgb(27 26 23 / 0.4);
}

.btn-ghost:hover {
  box-shadow: 0 5px 0 var(--edge-stone), 0 14px 22px -10px rgb(27 26 23 / 0.45);
}

.btn-ghost:active {
  box-shadow: 0 0 0 var(--edge-stone), 0 2px 4px -2px rgb(27 26 23 / 0.3);
}

.btn-small {
  min-height: 42px;
  padding: 0 18px;
  font-size: 0.7rem;
}

/* ----- Cards: polished stone tablets with a carved inner frame ----- */

.card {
  --rule: var(--hair);
  appearance: none;
  position: relative;
  width: 100%;
  height: 180px;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 12px;
  margin: 0;
  padding: 16px 16px 16px;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s, color 0.25s, box-shadow 0.25s var(--ease), border-color 0.25s;
}

.card::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

button.card {
  cursor: grab;
  touch-action: none;
}

/* Board cards let a quick vertical swipe scroll the page; the script picks a card up on press-and-hold. */
.board button.card {
  touch-action: pan-y;
}

button.card:hover {
  border-color: var(--gold);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.card-tag {
  font-family: var(--display);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 7px 2px;
  color: var(--terracotta);
  border: 1px solid currentColor;
  white-space: nowrap;
}

.card.is-ok .card-tag,
.card.is-bad .card-tag,
.card.is-selected .card-tag {
  color: inherit;
}

.card-tag:empty {
  visibility: hidden;
}

.card-year {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

.card.is-revealed .card-year {
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--gold-text);
  animation: flip-in 0.5s var(--ease) both;
}

.card-title {
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.22;
  overflow-wrap: break-word;
}

.card-mark {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  font-family: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  border: 1px solid currentColor;
}

.card.is-ok,
.card.is-bad {
  --rule: rgb(255 255 255 / 0.35);
  border-color: transparent;
}

.card.is-ok {
  background: var(--ok);
  color: var(--ok-ink);
}

.card.is-bad {
  background: var(--bad);
  color: var(--bad-ink);
}

.card.is-ok .card-year,
.card.is-bad .card-year {
  color: inherit;
}

.card.is-ok .card-mark,
.card.is-bad .card-mark {
  display: grid;
}

.card.is-ok .card-mark::before {
  content: "\2713";
}

.card.is-bad .card-mark::before {
  content: "\2715";
}

.card.is-selected {
  --rule: var(--gold);
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--lift);
}

.card.is-selected .card-year {
  color: inherit;
}

.card.is-settling {
  z-index: 20;
}

.card.is-locked {
  cursor: default;
}

.card.is-dragging {
  --rule: var(--gold);
  position: relative;
  z-index: 20;
  cursor: grabbing;
  border-color: var(--gold);
  box-shadow: var(--lift);
  transition: none;
}

.card.is-shaking {
  animation: shake 0.42s var(--ease);
}

.card.is-stamped {
  animation: stamp 0.42s var(--ease);
}

.card.is-skeleton {
  background: var(--surface);
  border-color: var(--hair);
}

/* ----- Home ----- */

/* The top of the home page is a scene inside the Colosseum, drawn in code by tools/build-arena.mjs:
   a sunlit arena in light mode and the same arena at dusk in dark mode. The title sits in the sky
   and the buttons stand on the arena floor. */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: min(calc(100svh - var(--bar-h)), 900px);
  padding: 56px var(--pad) calc(44px + var(--band));
  text-align: center;
}

.arena {
  background: var(--bg) url("/img/arena-day.svg") center bottom / cover no-repeat;
}

:root[data-mode="dark"] .arena {
  background-image: url("/img/arena-dusk.svg");
}

/* A soft wash over the sky, so the title reads clearly. */
.arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgb(236 228 214 / 0.9) 0%, rgb(236 228 214 / 0.74) 32%, rgb(236 228 214 / 0) 56%);
  pointer-events: none;
}

:root[data-mode="dark"] .arena::before {
  background: linear-gradient(180deg, rgb(26 26 21 / 0.88) 0%, rgb(26 26 21 / 0.64) 32%, rgb(26 26 21 / 0) 56%);
}

.arena::after {
  bottom: 0;
}

/* Over the scene, the line under the headline is full ink so it stays readable against the sky. */
.arena .lede {
  color: var(--ink);
}

:root[data-mode="dark"] .arena .hero-today strong {
  color: #e8705d;
}

.mega {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lede {
  margin: 18px auto 28px;
  max-width: 36ch;
  font-size: clamp(1.2rem, 1.7vw, 1.45rem);
  font-weight: 500;
  color: var(--muted);
}

/* The three History Fact Area cards: one width and one height, so they line up as equals. */
.preview {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-auto-rows: 1fr;
  gap: 14px;
}

.preview li {
  display: flex;
}

.preview .card {
  width: 100%;
  height: auto;
  min-height: 0;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 8px 18px;
  padding: 16px 18px;
  animation: rise 0.7s var(--ease) both;
  animation-delay: calc(var(--i) * 140ms + 120ms);
}

.preview .card-meta {
  grid-column: 1;
}

.preview .card-title {
  grid-column: 1;
}

.preview .card-year {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: clamp(1.7rem, 2.8vw, 2.4rem);
  color: var(--gold-text);
}

/* The title at the top, then one row of buttons on the sand: Time Gap, today's Daily in the middle, Endless. */
.hero-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 780px;
  min-width: 0;
}

.btn-wide {
  width: 100%;
  max-width: 460px;
  margin-top: 12px;
}

.btn-big {
  width: 100%;
  max-width: 460px;
  min-height: 72px;
  flex-direction: column;
  gap: 3px;
  padding: 12px 28px 13px;
  font-size: 0.95rem;
}

.btn-big small {
  font-family: var(--text);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
}

.mode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  margin-top: auto;
}

.mode-row .btn-big {
  max-width: none;
  min-height: 84px;
}

.mode-row .mode-btn {
  align-content: center;
  justify-items: center;
}

/* Phones show a shorter label on the Daily button, so it fits between the other two. */
.cta-short {
  display: none;
}

.arena .streak-line {
  padding: 6px 12px 5px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
}

.mode-btn {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin-bottom: 4px;
  padding: 12px 16px 11px;
  text-decoration: none;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.35), rgb(0 0 0 / 0.04)), var(--card);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  box-shadow: 0 4px 0 var(--edge-stone), 0 10px 18px -8px rgb(27 26 23 / 0.4);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.mode-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--edge-stone), 0 14px 22px -10px rgb(27 26 23 / 0.45);
}

.mode-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--edge-stone), 0 2px 4px -2px rgb(27 26 23 / 0.3);
}

.mode-btn-name {
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mode-btn-status {
  font-size: 0.98rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mode-btn-status.is-done {
  color: var(--gold-text);
  font-weight: 600;
}

.streak-line {
  margin: 16px 0 0;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.streak-line:empty {
  display: none;
}

.hero-today {
  margin-bottom: 16px;
}

.hero-today strong {
  color: var(--red);
  font-weight: 700;
}

/* A lighter red in dark mode, so the small theme name keeps a 5:1 contrast. */
:root[data-mode="dark"] .hero-today strong {
  color: #e26350;
}

.coming {
  margin-bottom: 72px;
}

.coming-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.coming-line {
  margin: 6px 0 18px;
  color: var(--muted);
}

/* The next seven days and their themes; today sits on a black plaque. */
.week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.week-day {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 12px 14px;
  background: var(--bg);
}

.week-name {
  font-family: var(--display);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.week-theme {
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.2;
}

.week-day.is-today {
  background: var(--ink);
  color: var(--bg);
  box-shadow: inset 0 -3px 0 var(--gold);
}

.week-day.is-today .week-name {
  color: var(--gold);
}

/* ----- Start screens -----
   Daily, Time Gap and Endless each open on a stone tablet: number, date and theme, one rule line,
   one big button and a How to play link, as the reference games do. */

.start {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 20px auto 0;
  padding: 44px 32px 32px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: var(--lift);
  animation: rise 0.5s var(--ease) both;
}

.start::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--gold);
  opacity: 0.6;
  pointer-events: none;
}

.start-eyebrow {
  color: var(--gold-text);
}

.start-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.start-line {
  max-width: 34ch;
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: var(--muted);
}

.start .btn-big {
  min-height: 64px;
}

.start-status {
  margin: 0;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.start-status:empty {
  display: none;
}

/* A quiet text button, used for How to play under the big button. */
.link-btn {
  position: relative;
  padding: 8px 6px;
  font-family: var(--display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: none;
  border: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--gold-text);
}

/* ----- Play pages ----- */

.play {
  padding-top: 28px;
  padding-bottom: 72px;
}

.game {
  animation: rise 0.4s var(--ease) both;
}

/* A calm head over the board: the title and number on the left, tries or score on the right. */
.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gold);
}

[data-game-head] {
  margin-bottom: 24px;
}

.game-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.game-no {
  margin-left: 4px;
  font-size: 0.66em;
  color: var(--gold-text);
}

.game-total {
  margin: 0;
  font-size: 1.25rem;
  white-space: nowrap;
}

.meta {
  margin-top: 10px;
}

.meta > span + span::before {
  content: "\00B7";
  margin: 0 10px;
  color: var(--gold-text);
}

.game-hint {
  margin-top: 6px;
  font-size: 1rem;
}

.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.tries {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 4px;
}

.try {
  width: 11px;
  height: 11px;
  border: 1px solid var(--gold-text);
  transform: rotate(45deg);
}

.try.is-used {
  background: var(--gold);
  border-color: var(--gold);
}

.board-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "start end" "board board";
  gap: 10px 16px;
  margin-top: 22px;
}

.axis-start {
  grid-area: start;
}

.axis-end {
  grid-area: end;
}

.axis-start::after {
  content: " \2192" / "";
}

.board {
  grid-area: board;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.board > li {
  display: flex;
  min-width: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 26px;
}

.hint {
  margin: 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.note {
  margin: 0;
  font-family: var(--display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--mark);
}

.note:empty {
  display: none;
}

.load-error {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--red);
  list-style: none;
}

.load-error p {
  margin: 0;
  font-weight: 600;
}

/* ----- Results ----- */

.result {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 30px;
  padding: 32px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  animation: rise 0.5s var(--ease) both;
}

.result::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--gold);
  pointer-events: none;
  opacity: 0.6;
}

.result-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.8rem, 3.8vw, 3rem);
  line-height: 1.02;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-sub {
  margin: 16px 0 0;
  color: var(--muted);
}

/* The try grid is laid like mosaic tesserae. */
.rows {
  display: grid;
  width: max-content;
  gap: 3px;
  justify-content: start;
  padding: 6px;
  background: var(--line-soft);
}

.row {
  display: flex;
  gap: 3px;
}

.sq {
  width: 26px;
  height: 26px;
  background: var(--card);
}

.sq.is-ok {
  background: var(--ok);
}

.sq.is-bad {
  background: var(--bad);
}

.stats {
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.stats div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg);
}

.stats dt {
  font-family: var(--display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats dd {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.next {
  margin: 18px 0 0;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.next strong {
  color: var(--ink);
}

/* ----- Time Gap ----- */

.rounds {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.round-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  font-family: var(--display);
}

.round-n {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-text);
}

.round-score {
  font-size: 1.05rem;
  font-weight: 700;
}

.round-cell.is-current {
  background: var(--ink);
  color: var(--bg);
  box-shadow: inset 0 -3px 0 var(--gold);
}

.round-cell.is-current .round-n {
  color: var(--gold);
}

.gap-stage {
  margin-top: 28px;
}

.q {
  display: block;
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.pair-or {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.pair .card {
  height: auto;
  min-height: 150px;
}

.pair button.card {
  cursor: pointer;
  touch-action: manipulation;
}

.pair button.card:hover {
  box-shadow: var(--lift);
}

.stamp {
  position: absolute;
  top: -11px;
  right: 14px;
  z-index: 1;
  display: none;
  padding: 4px 10px 3px;
  font-family: var(--display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--stamp-bg);
  color: var(--stamp-ink);
  animation: stamp 0.35s var(--ease);
}

.pair .card[aria-pressed="true"],
.card.is-first {
  --rule: var(--gold);
  border-color: var(--gold);
  box-shadow: var(--lift);
}

.pair .card[aria-pressed="true"] .stamp,
.card.is-first .stamp {
  display: block;
}

.gap-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px 24px;
  margin-top: 32px;
}

.submit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 22px;
}

.stepper {
  display: grid;
  grid-template-columns: 52px 52px minmax(120px, 180px) 52px 52px;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.stepper button {
  min-height: 56px;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 700;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.35), rgb(0 0 0 / 0.05)), var(--card);
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 -4px 0 var(--edge-stone);
  cursor: pointer;
}

.stepper button:hover {
  background: var(--surface);
}

.stepper button:active {
  box-shadow: inset 0 2px 4px rgb(27 26 23 / 0.25);
  padding-top: 3px;
}

.stepper input {
  width: 100%;
  min-height: 56px;
  padding: 0 10px;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  background: var(--card);
  border: 0;
  border-radius: 0;
}

.stepper input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.stepper input:focus-visible {
  outline-offset: -3px;
}

.verdict {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 36px;
  align-items: center;
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  animation: rise 0.45s var(--ease) both;
}

.verdict::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--gold);
  opacity: 0.6;
  pointer-events: none;
}

.verdict p {
  margin: 0;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.verdict .verdict-score {
  grid-row: 1 / span 4;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--gold-text);
}

.num {
  font-size: 1.12em;
  line-height: 1;
}

.verdict .verdict-score small {
  display: block;
  margin-top: 10px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.verdict .btn {
  grid-column: 2;
  justify-self: start;
  margin-top: 10px;
}

.round-scores {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--line-soft);
}

.round-scores li {
  padding: 8px;
  background: var(--card);
  font-family: var(--display);
  font-weight: 700;
  text-align: center;
}

/* After the fifth round: every pair with its years, the true gap, the guess and the score. */
.review {
  margin-top: 28px;
  animation: rise 0.45s var(--ease) both;
}

.review-list {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.review-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "n pair score" "n gap score";
  align-items: center;
  gap: 6px 16px;
  padding: 14px 16px;
  background: var(--bg);
}

.review-item .round-n {
  grid-area: n;
  font-family: var(--display);
}

.review-pair {
  grid-area: pair;
  display: grid;
  gap: 2px;
}

.review-event {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

.review-event strong {
  flex: none;
  min-width: 5.4em;
  color: var(--gold-text);
}

.review-gap {
  grid-area: gap;
  margin: 0;
  font-size: 0.98rem;
  color: var(--muted);
}

.review-score {
  grid-area: score;
  margin: 0;
  font-size: 1.4rem;
}

/* ----- Endless ----- */

.endless-game {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.dock {
  position: sticky;
  top: calc(var(--bar-h) + 24px);
  display: grid;
  gap: 14px;
}

.dock-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.dock-stats div {
  padding: 10px 12px;
  background: var(--bg);
}

.dock-stats dt {
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dock-stats dd {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}

.dock-stats dd[data-theme-name] {
  font-family: var(--text);
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: nowrap;
}

.lives {
  display: flex;
  gap: 10px;
  padding: 6px 0 0 3px;
}

.life {
  width: 13px;
  height: 13px;
  background: var(--mark);
  border: 1px solid var(--mark);
  transform: rotate(45deg);
}

.life.is-lost {
  background: transparent;
  border-color: var(--line-soft);
}

.dock .card {
  height: auto;
  min-height: 150px;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.tl-card .card {
  height: auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: none;
  align-items: center;
  gap: 6px 18px;
  padding: 14px 16px;
}

.tl-card .card-meta {
  display: contents;
}

.tl-card .card-tag {
  grid-column: 1;
  justify-self: start;
}

.tl-card .card-tag:empty {
  display: none;
}

.tl-card .card-title {
  grid-column: 1;
}

.tl-card .card.is-revealed .card-year {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 1.45rem;
  animation: none;
}

.tl-card .card-tag:empty + .card-year {
  grid-row: 1;
}

.tl-card.is-new .card {
  animation: rise 0.45s var(--ease) both;
}

.tl-card.is-new .card.is-revealed .card-year {
  animation: flip-in 0.5s var(--ease) both;
}

.tl-card .card.was-ok,
.tl-card .card.was-bad {
  border-left-width: 6px;
}

.tl-card .card.was-ok {
  border-left-color: var(--ok);
}

.tl-card .card.was-bad {
  border-left-color: var(--bad);
}

.tl-gap button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  font-family: var(--display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  position: relative;
}

.tl-gap button::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dotted var(--line-soft);
}

.tl-gap button span {
  position: relative;
  padding: 5px 14px 4px;
  background: var(--card);
  border: 1px solid var(--line-soft);
  box-shadow: 0 3px 0 var(--edge-stone);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.tl-gap button:active span {
  transform: translateY(3px);
  box-shadow: none;
}

.tl-gap button:hover,
.tl-gap button.is-target {
  color: var(--ink);
}

.tl-gap button:hover::before,
.tl-gap button.is-target::before {
  border-top: 2px solid var(--gold);
}

.tl-gap button.is-target span {
  background: var(--stamp-bg);
  color: var(--stamp-ink);
}

.endless-game.is-busy .tl-gap button {
  pointer-events: none;
  opacity: 0.4;
}

.endless-game.is-over .tl-gap,
.endless-game.is-over .dock .card,
.endless-game.is-over .dock > .label,
.endless-game.is-over .dock > .hint {
  display: none;
}

/* ----- Numbers -----
   Years, scores and stats use EB Garamond's bold lining figures, because Cinzel's 1 looks like a Roman I. */

.card-year,
.stats dd,
.round-score,
.dock-stats dd,
.verdict .verdict-score,
.stepper input,
.round-scores li,
.num,
.game-no,
.game-total,
.next strong,
.review-event strong,
.review-score,
.bests strong {
  font-family: var(--text);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0;
}

.verdict .verdict-score small {
  font-family: var(--display);
}

/* ----- Panels: How to play, menu, settings and stats -----
   Each is a parchment tablet with a gold inner frame over a dimmed page. */

.help,
.panel {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 32px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: var(--lift), inset 0 0 0 6px var(--card), inset 0 0 0 7px var(--gold);
}

.panel {
  width: min(500px, calc(100vw - 32px));
  padding: 24px 28px 30px;
}

.help::backdrop,
.panel::backdrop {
  background: rgb(22 19 17 / 0.62);
}

.help h2 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.help ol {
  margin: 0 0 26px;
  padding-left: 1.6em;
  display: grid;
  gap: 10px;
  list-style: upper-roman;
}

.help li::marker {
  font-family: var(--display);
  font-size: 0.85em;
  font-weight: 700;
  color: var(--gold-text);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.panel-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 10px;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}

.panel-sub::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--gold);
  opacity: 0.6;
}

.panel-body > :first-child {
  margin-top: 0;
}

.panel-note {
  margin: 0;
  color: var(--muted);
}

.panel .stats {
  margin: 0;
}

.panel .rows {
  margin-bottom: 4px;
}

.panel .result-sub {
  margin-top: 12px;
}

.panel .result-actions {
  margin-top: 22px;
}

.panel .result-actions .btn {
  flex: 1 1 auto;
}

.panel .next {
  margin-top: 16px;
}

/* The menu: a grid of stone tiles, the current page on a dark plaque. */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 4px;
  min-width: 0;
  min-height: 104px;
  margin: 0 0 4px;
  padding: 14px 14px 12px;
  font: inherit;
  text-align: left;
  text-decoration: none;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.3), rgb(0 0 0 / 0.04)), var(--bg);
  color: var(--ink);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: 0 4px 0 var(--edge-stone), 0 10px 18px -10px rgb(27 26 23 / 0.35);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--edge-stone), 0 14px 22px -12px rgb(27 26 23 / 0.4);
}

.tile:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--edge-stone), 0 2px 4px -2px rgb(27 26 23 / 0.3);
}

.tile .icon {
  width: 22px;
  height: 22px;
  margin-bottom: 8px;
  color: var(--gold-text);
}

.tile-name {
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tile-status {
  max-width: 100%;
  font-size: 0.95rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile[aria-current="page"] {
  background: var(--stamp-bg);
  color: var(--stamp-ink);
  border-color: var(--stamp-bg);
}

.tile[aria-current="page"] .icon,
.tile[aria-current="page"] .tile-status {
  color: inherit;
}

.menu-foot {
  margin: 18px 0 0;
  font-size: 0.98rem;
  text-align: center;
  color: var(--muted);
}

.menu-foot a {
  font-weight: 700;
  color: var(--ink);
  text-decoration-color: var(--gold);
  text-underline-offset: 4px;
}

/* Settings: on/off switches with a stone knob that slides onto gold. */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--hair);
}

.switch-row:first-child {
  padding-top: 0;
}

.switch-name {
  margin: 0;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.switch-desc {
  margin: 4px 0 0;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--muted);
}

.switch {
  position: relative;
  flex: none;
  width: 58px;
  height: 32px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: inset 0 2px 4px rgb(27 26 23 / 0.2);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.switch-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--edge-stone);
  transition: transform 0.2s var(--ease);
}

.switch[aria-checked="true"] {
  background: var(--gold);
  border-color: var(--gold);
}

.switch[aria-checked="true"] .switch-knob {
  transform: translateX(26px);
}

.panel-settings .panel-note {
  margin-top: 16px;
  font-size: 0.98rem;
}

/* Endless: the best run for each theme, today's theme on a plaque. */
.bests {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.bests li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  background: var(--bg);
}

.bests li.is-today {
  background: var(--stamp-bg);
  color: var(--stamp-ink);
}

/* ----- Footer ----- */

.foot {
  position: relative;
  padding-top: var(--band);
}

.foot::before {
  top: 0;
}

.foot-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--pad);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 32px;
}

.foot p {
  margin: 0;
  font-family: var(--display);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot .logo {
  font-size: 1rem;
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.foot-nav a {
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.foot-nav a:hover {
  color: var(--gold-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.noscript {
  margin: 24px 0;
  padding: 16px;
  border: 1px solid var(--red);
  font-weight: 600;
}

/* ----- Motion ----- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes flip-in {
  from {
    opacity: 0;
    transform: rotateX(90deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-7px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

@keyframes stamp {
  0% {
    transform: scale(1.06);
  }
  100% {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----- Tablet ----- */

@media (max-width: 1023px) {
  .board {
    gap: 8px;
  }

  .card-title {
    font-size: 1rem;
  }
}

/* ----- Phone ----- */

@media (max-width: 767px) {
  :root {
    --band: 12px;
    --bar-h: 71px;
  }

  body {
    font-size: 17px;
  }

  .bar-in {
    height: 54px;
    gap: 8px;
  }

  .bar-tools {
    gap: 5px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .logo {
    gap: 9px;
    font-size: 1rem;
    letter-spacing: 0.06em;
  }

  .logo-mark {
    width: 8px;
    height: 8px;
  }

  .stats div {
    padding: 10px 10px;
  }

  .hero {
    padding: 32px var(--pad) calc(26px + var(--band));
  }

  .lede {
    margin: 14px auto 24px;
  }

  .play {
    padding-top: 22px;
  }

  .start {
    margin-top: 6px;
    padding: 30px 18px 26px;
  }

  .game-head {
    padding-bottom: 10px;
  }

  .week {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .week::-webkit-scrollbar {
    display: none;
  }

  .week-day {
    flex: 0 0 auto;
    min-width: 118px;
    scroll-snap-align: start;
  }

  .board-wrap {
    grid-template-columns: 1fr;
    grid-template-areas: "start" "board" "end";
    margin-top: 14px;
    gap: 8px;
  }

  .axis-start::after {
    content: " \2193" / "";
  }

  .board {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .board .card {
    height: 80px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: none;
    align-content: center;
    gap: 3px 12px;
    padding: 8px 40px 8px 14px;
  }

  .board .card::after {
    inset: 4px;
  }

  .board .card-meta {
    display: contents;
  }

  .board .card-tag {
    grid-column: 1;
    justify-self: start;
    font-size: 0.52rem;
    padding: 2px 6px 1px;
  }

  .board .card-tag:empty {
    display: none;
  }

  .board .card-year {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .board .card-tag:empty + .card-year {
    grid-row: 1;
  }

  .board .card-title {
    grid-column: 1;
    font-size: 1rem;
    line-height: 1.18;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .board .card.is-revealed .card-year {
    font-size: 1.1rem;
  }

  .board .card-mark {
    right: 9px;
    bottom: 50%;
    transform: translateY(50%);
    width: 22px;
    height: 22px;
  }

  /* Lock in and Submit stay at the bottom of the screen, within thumb reach, while the cards scroll. */
  .actions,
  .submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 14px calc(var(--pad) * -1) 0;
    padding: 12px var(--pad) calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid var(--gold);
  }

  .actions .btn,
  .submit-bar .btn {
    flex: 1 1 100%;
  }

  .done-actions .btn {
    flex: 1 1 100%;
  }

  .result {
    grid-template-columns: 1fr;
    padding: 24px 18px;
  }

  .rounds {
    margin-top: 16px;
  }

  .round-cell {
    flex-direction: column;
    gap: 2px;
    padding: 8px;
  }

  .pair {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pair-or {
    justify-self: center;
  }

  .pair .card {
    min-height: 84px;
  }

  .stepper {
    width: 100%;
    grid-template-columns: 48px 48px minmax(0, 1fr) 48px 48px;
  }

  .gap-entry .btn {
    flex: 1 1 100%;
  }

  .verdict {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .verdict .verdict-score {
    grid-row: auto;
    margin-bottom: 8px;
  }

  .verdict .btn {
    grid-column: 1;
    justify-self: stretch;
  }

  .endless-game {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .dock {
    top: var(--bar-h);
    z-index: 5;
    gap: 8px;
    margin: 0 calc(var(--pad) * -1);
    padding: 10px var(--pad) 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--gold);
  }

  .dock > .label,
  .dock > .hint {
    display: none;
  }

  .dock .card {
    min-height: 0;
    padding: 12px 14px;
    gap: 6px;
  }

  .dock-stats div {
    padding: 6px 10px;
  }

  .dock-stats dd {
    font-size: 1.05rem;
  }

  .help {
    padding: 26px 20px;
  }

  .panel {
    padding: 20px 18px 24px;
  }

  .tiles {
    gap: 10px;
  }

  .tile {
    min-height: 96px;
    padding: 12px 12px 10px;
  }

  .review-item {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 12px;
  }

  .review-event {
    gap: 8px;
    font-size: 1rem;
  }

  .review-event strong {
    min-width: 4em;
  }
}

/* ----- Narrow phones: the name sits beside the menu button so it never crowds the icons ----- */

@media (max-width: 420px) {
  .bar-in {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .bar .logo {
    justify-self: start;
  }
}

@media (max-width: 360px) {
  .bar-in {
    gap: 6px;
  }

  .bar-tools {
    gap: 4px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .bar .logo {
    gap: 7px;
    font-size: 0.92rem;
    letter-spacing: 0.04em;
  }
}

/* ----- Phones: the three home buttons stay in one row, so they get smaller ----- */

@media (max-width: 600px) {
  .cta-long {
    display: none;
  }

  .cta-short {
    display: inline;
  }

  .mode-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 8px;
  }

  .mode-row .btn-big {
    min-height: 78px;
    padding: 10px 8px;
    font-size: 0.86rem;
    white-space: normal;
  }

  .mode-row .btn-big small {
    font-size: 0.92rem;
    line-height: 1.15;
  }

  .mode-row .mode-btn {
    padding: 10px 6px 9px;
  }

  .mode-row .mode-btn-name {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
  }

  .mode-row .mode-btn-status {
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: normal;
  }
}
