/* quod.app: one stylesheet for every page. Dark first; light when the system asks for it. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/ebgaramond-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
/* Libre Baskerville's digits, subset and renamed as the OFL asks of a Modified Version. */
@font-face {
  font-family: "Quod Book Digits";
  src: url("../fonts/quod-book-digits.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ground: #0b0b0d;
  --surface: #141416;
  --raised: #1b1b1e;
  --board: #101012;
  --hairline: #26262a;
  --ink: #f4f3f0;
  --text: #d8d5ce;
  --ink-soft: #a3a09a;
  --ink-faint: #6b6862;
  --accent: #ff9b48;
  --accent-text: #ff9b48;
  --on-accent: #1a0f05;
  --mistake: #e5534b;
  --pen: #76aeff;
  --wash: #1c1c20;
  --wash-strong: #3a2a1c;
  --rule-cell: #26262a;
  --rule-box: #57544f;
  --obj-top: #2b2b30;
  --obj-right: #1e1e22;

  --sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --italic: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;

  --page: 66rem;
  --main: 37rem;
  --side: 20rem;
  --gap: 4rem;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #faf9f6;
    --surface: #ffffff;
    --raised: #f4f2ee;
    --board: #ffffff;
    --hairline: #e6e2da;
    --ink: #1b1a18;
    --text: #2c2b28;
    --ink-soft: #5f5b54;
    --ink-faint: #9a958c;
    --accent: #f0782a;
    /* The accent, deepened just enough to pass AA as small text on paper. */
    --accent-text: #b4521a;
    --on-accent: #1b1a18;
    --mistake: #e5534b;
    --pen: #2465c9;
    --wash: #f6f4f0;
    --wash-strong: #fde6d4;
    --rule-cell: #e3dfd7;
    --rule-box: #1b1a18;
    --obj-top: #ebe8e1;
    --obj-right: #d9d4ca;
    color-scheme: light;
  }
}

/* Base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  font-kerning: normal;
  font-variant-numeric: lining-nums;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

@media (min-width: 720px) {
  body {
    font-size: 1.125rem;
  }
}

::selection {
  background: var(--wash-strong);
  color: var(--ink);
}

p {
  margin: 0 0 1em;
}

b,
strong {
  color: var(--ink);
  font-weight: 600;
}

a {
  color: var(--accent-text);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color 120ms, color 120ms;
}

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

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

/* Display type: Inter at its largest optical size, set tight. */
.display,
h1,
h2,
h3,
.num {
  font-family: var(--sans);
  font-variation-settings: "opsz" 32;
}

.num {
  font-variant-numeric: tabular-nums;
}

/* Tiny uppercase labels. */
.label {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The occasional italic aside. */
.aside {
  font-family: var(--italic);
  font-style: italic;
  font-size: 1.16em;
  line-height: 1.4;
  letter-spacing: 0.005em;
}

.seed {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 14px;
}

.skip:focus {
  top: 12px;
}

/* Header and footer */

.site-head {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 22px var(--gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-variation-settings: "opsz" 32;
  font-weight: 600;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.qed-sq {
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin-left: 0.1em;
  background: var(--accent);
  border-radius: 0.04em;
  vertical-align: baseline;
}

.site-nav ul {
  display: flex;
  gap: 4px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  font-weight: 500;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
}

.site-foot {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  /* A rule the width of the text, not of the padding. */
  background: linear-gradient(var(--hairline), var(--hairline)) no-repeat center top / calc(100% - 2 * var(--gutter)) 1px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  justify-content: space-between;
}

.site-foot p {
  margin: 0;
}

.site-foot a {
  color: var(--ink-soft);
  text-decoration-color: var(--hairline);
}

.site-foot a:hover {
  color: var(--ink);
}

.site-foot .dot {
  padding: 0 0.45em;
  color: var(--ink-faint);
}

/* Hero */

.hero {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 32px var(--gutter) 64px;
  display: grid;
  gap: 32px;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 56px;
    align-items: center;
    min-height: min(calc(100svh - 70px), 760px);
    padding-block: 24px 56px;
  }
}

h1 {
  margin: 0 0 22px;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(42px, 5.2vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.lede {
  margin: 0 0 14px;
  color: var(--text);
  font-size: clamp(19px, 0.6vw + 15px, 21px);
  line-height: 1.45;
  max-width: 25em;
  text-wrap: pretty;
}

.hint-line {
  margin: 0 0 24px;
  color: var(--ink-soft);
  text-wrap: balance;
}

.wide-only {
  display: none;
}

@media (min-width: 960px) {
  .wide-only {
    display: inline;
  }
  .narrow-only {
    display: none;
  }
}

/* Actions */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 120ms,
    transform 80ms;
}

.button:hover {
  background: color-mix(in srgb, var(--accent) 86%, #ffffff);
}

.button:active {
  transform: translateY(1px);
}

.button[hidden] {
  display: none;
}

.button-small {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
}

.text-link {
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* The mark: the app icon's voxel Q, drawn in SVG and assembled on load. */

.mark {
  margin: 0;
  justify-self: start;
  width: min(60vw, 236px);
}

@media (max-width: 959px) {
  .mark {
    order: -1;
  }
}

@media (min-width: 960px) {
  .mark {
    width: 400px;
  }
}

.mark-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 23%;
  background: linear-gradient(155deg, #26272c 0%, #0b0b0d 64%);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.06),
    0 28px 56px -28px rgb(0 0 0 / 0.55);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.vq {
  display: block;
  width: 60%;
  height: auto;
  overflow: visible;
}

.vq .f { fill: #f7f1e6; }
.vq .t { fill: #ffffff; }
.vq .r { fill: #cfc3ae; }
.vq .tail .f { fill: #f58a35; }
.vq .tail .t { fill: #ffc089; }
.vq .tail .r { fill: #b8520f; }

.mark-caption {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.mark-caption b {
  font-weight: 600;
}

@media (prefers-reduced-motion: no-preference) {
  .mark-tile {
    cursor: pointer;
  }
  .vq.is-building .cube {
    animation: vq-drop 440ms var(--ease) both;
  }
  .vq.is-building .cube.tail {
    animation-name: vq-land;
    animation-duration: 520ms;
  }
  /* Delays come after the shorthand above, at the same specificity, so they win. */
  .vq.is-building .vq-shadow {
    animation: vq-shadow 900ms ease-out both;
  }
  .vq.is-building .o1 { animation-delay: 40ms; }
  .vq.is-building .o2 { animation-delay: 80ms; }
  .vq.is-building .o3 { animation-delay: 120ms; }
  .vq.is-building .o4 { animation-delay: 160ms; }
  .vq.is-building .o5 { animation-delay: 200ms; }
  .vq.is-building .o6 { animation-delay: 240ms; }
  .vq.is-building .o7 { animation-delay: 280ms; }
  .vq.is-building .o8 { animation-delay: 320ms; }
  .vq.is-building .o9 { animation-delay: 360ms; }
  .vq.is-building .o10 { animation-delay: 400ms; }
  .vq.is-building .o11 { animation-delay: 440ms; }
  .vq.is-building .o12 { animation-delay: 600ms; }
  .vq.is-building .o13 { animation-delay: 700ms; }
  .vq.is-building .o14 { animation-delay: 800ms; }
}

/* Ivory cubes settle straight down; the tail slides in along its own diagonal. */
@keyframes vq-drop {
  from {
    opacity: 0;
    transform: translate(0, -60px);
  }
  50% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes vq-land {
  from {
    opacity: 0;
    transform: translate(-64px, -64px);
  }
  50% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes vq-shadow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* The shelf */

.shelf {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 16px var(--gutter) 80px;
}

.shelf-head {
  max-width: 36rem;
  margin-bottom: 28px;
}

.shelf-head h2,
.game h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(40px, 4.2vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.shelf-head p {
  margin: 0;
  color: var(--text);
}

.cards {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .cards .is-live {
    grid-column: 1 / -1;
  }
}

@media (min-width: 960px) {
  .cards {
    grid-template-columns: 1.25fr 1fr 1fr;
  }
  .cards .is-live {
    grid-column: auto;
  }
}

.card,
.card-link {
  display: flex;
  flex-direction: column;
}

.card {
  padding: 16px 20px 22px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: var(--surface);
  transition: border-color 160ms;
}

.card.is-live {
  padding: 0;
}

.card-link {
  height: 100%;
  padding: 16px 20px 22px;
  border-radius: 20px;
  color: inherit;
  text-decoration: none;
}

.card.is-live:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--hairline));
}

.card-art {
  display: grid;
  place-items: end center;
  height: 148px;
  margin: 0 -20px 18px;
  border-bottom: 1px solid var(--hairline);
}

.card-art svg {
  display: block;
  width: 132px;
  height: 120px;
  margin-bottom: 6px;
  overflow: visible;
}

.card .obj,
.card .tcube {
  transition: transform 220ms var(--ease);
}

.card.is-live:hover .obj {
  transform: translateY(-4px);
}

.card-num {
  color: var(--ink-soft);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
}

.card.is-live .card-num {
  color: var(--accent-text);
}

.card-title {
  margin-top: 8px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.status-dot.is-on {
  background: var(--accent);
}

.card-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.card-cta {
  margin-top: auto;
  padding-top: 18px;
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 500;
}

.card-art text {
  font-family: var(--sans);
  font-variation-settings: "opsz" 32;
  text-anchor: middle;
  dominant-baseline: central;
}

.obj-top { fill: var(--obj-top); }
.obj-right { fill: var(--obj-right); }
.obj-face { fill: var(--board); }
.obj-sel { fill: var(--accent); }
.obj-rule { stroke: var(--rule-cell); stroke-width: 1; }
.obj-frame { fill: none; stroke: var(--rule-box); stroke-width: 1.5; }
.obj-g, .obj-p, .obj-s { font-size: 16px; font-weight: 600; }
.obj-g { fill: var(--ink); }
.obj-p { fill: var(--pen); font-weight: 400; }
.obj-s { fill: var(--on-accent); }
.tc-face { fill: #f58a35; }
.tc-top { fill: #ffc089; }
.tc-right { fill: #b8520f; }

.ghost path,
.ghost rect {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  stroke-linejoin: round;
}

.ghost-q {
  fill: var(--ink-soft);
  font-size: 26px;
  font-weight: 600;
}

/* No. 01: Sudoku, with today's daily. */

.game {
  max-width: calc(var(--page) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 24px var(--gutter) 88px;
  display: grid;
  gap: 32px;
}

@media (min-width: 960px) {
  .game {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 56px;
    align-items: center;
  }
}

.game h2 {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
}

.game-num {
  color: var(--accent-text);
  font-weight: 700;
}

.game .rows {
  margin: 4px 0 24px;
}

.game .rows > div {
  grid-template-columns: 6.5rem minmax(0, 1fr);
}

/* A small tangerine cube, the Q's tail, for the end of a proof. */
.cube-mark {
  position: relative;
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin-left: 0.12em;
  background: #f58a35;
  vertical-align: baseline;
}

.cube-mark::before,
.cube-mark::after {
  content: "";
  position: absolute;
}

.cube-mark::before {
  left: 0;
  bottom: 100%;
  width: 100%;
  height: 31.5%;
  background: #ffc089;
  transform: skewX(-45deg);
  transform-origin: 0 100%;
}

.cube-mark::after {
  left: 100%;
  top: 0;
  width: 31.5%;
  height: 100%;
  background: #b8520f;
  transform: skewY(-45deg);
  transform-origin: 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .solved.is-arriving .cube-mark {
    animation: vq-land-small 520ms 260ms var(--ease) both;
  }
}

@keyframes vq-land-small {
  from {
    opacity: 0;
    transform: translate(-0.4em, -0.4em);
  }
  50% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.solved-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 0 0;
  font-size: 15px;
}

/* The play module: a card on wide screens, bare on phones so the board can be as large as it may. */

.play {
  --cell: min(52px, calc((100vw - 2 * var(--gutter) - 2px) / 9));
  width: calc(var(--cell) * 9 + 2px);
  justify-self: start;
}

/* When the board fills the width, centre it so rounding leaves equal gutters. */
@media (max-width: 559px) {
  .play {
    justify-self: center;
  }
}

@supports (width: round(down, 10.5px, 1px)) {
  .play {
    --cell: min(52px, round(down, calc((100vw - 2 * var(--gutter) - 2px) / 9), 1px));
  }
}

@media (min-width: 960px) {
  .play {
    width: calc(var(--cell) * 9 + 2px + 48px);
    padding: 20px 24px 24px;
    border: 1px solid var(--hairline);
    border-radius: 22px;
    background: var(--surface);
  }
}

/* Three stats in one grid, so labels share a line and the numbers share a baseline. */
.stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 28px;
  row-gap: 2px;
  align-items: baseline;
  margin: 0 1px 14px;
}

.stat {
  display: contents;
}

.stat .label {
  grid-row: 1;
}

.stat .value {
  grid-row: 2;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.stat-time .value {
  min-width: 3.1ch;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: right;
}

.stat:nth-child(2) > * {
  grid-column: 2;
}

.stat:nth-child(3) > * {
  grid-column: 3;
}

.stat-time > *,
.stat-mistakes > * {
  justify-self: end;
  text-align: right;
}

.play[data-state="ready"] .stat-time .value,
.play[data-state="paused"] .stat-time .value {
  color: var(--ink-soft);
}

.stat-mistakes .value.has-mistakes {
  color: var(--mistake);
}

.board {
  position: relative;
  isolation: isolate;
  width: calc(var(--cell) * 9);
  height: calc(var(--cell) * 9);
  margin: 1px;
  background: var(--board);
  box-shadow: 0 0 0 1px var(--rule-box);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.board-row {
  display: flex;
}

.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  display: grid;
  place-items: center;
  font-variation-settings: "opsz" 32;
  font-size: calc(var(--cell) * 0.54);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--pen);
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 140ms;
}

.cell.is-given {
  color: var(--ink);
  font-weight: 600;
}

.cell.is-house {
  background: var(--wash);
}

.cell.is-same {
  background: var(--wash-strong);
}

.cell .d {
  position: relative;
  z-index: 2;
  display: block;
}

.cell.is-wrong .d {
  color: var(--mistake);
}

/* A mistake is marked by a short rule under the digit as well as by colour. */
.cell.is-wrong .d::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -0.2em;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.cell.is-sel .d {
  color: var(--on-accent);
}

.cell:focus-visible::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 2;
  border: 1.5px solid var(--on-accent);
  border-radius: 3px;
  opacity: 0.7;
}

/* A wash layer per cell, for closing lines and the solved sweep. */
.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.sel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: var(--cell);
  height: var(--cell);
  background: var(--accent);
  opacity: 0;
  transform: translate(calc(var(--c, 0) * var(--cell)), calc(var(--r, 0) * var(--cell)));
  transition: transform 150ms var(--ease), background-color 150ms, opacity 150ms;
  pointer-events: none;
}

.board.has-sel .sel {
  opacity: 1;
}

.sel.is-wrong {
  background: var(--mistake);
}

.sel.no-glide {
  transition: none;
}

/* Rules sit above everything, like print over a highlighter. */
.rules {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--rule-box) 2px, transparent 2px),
    linear-gradient(to bottom, var(--rule-box) 2px, transparent 2px),
    linear-gradient(to right, var(--rule-cell) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule-cell) 1px, transparent 1px);
  background-size:
    calc(var(--cell) * 3) 100%,
    100% calc(var(--cell) * 3),
    var(--cell) 100%,
    100% var(--cell);
  background-position:
    -1px 0,
    0 -1px,
    0 0,
    0 0;
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(-0.1em) scale(1.06);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: none;
  }
  30% {
    transform: translateX(-2px);
  }
  70% {
    transform: translateX(2px);
  }
}

@keyframes close-line {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.18;
  }
  100% {
    opacity: 0;
  }
}

@keyframes wash {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.4;
  }
  100% {
    opacity: 0;
  }
}

.d.is-new {
  animation: settle 180ms var(--ease);
}

.d.is-new.is-off {
  animation:
    settle 180ms var(--ease),
    nudge 200ms 140ms ease-in-out;
}

.cell.is-closing::after {
  animation: close-line 620ms ease-out var(--delay, 0ms) both;
}

.board.is-washing .cell::after {
  animation: wash 900ms cubic-bezier(0.3, 0.6, 0.3, 1) var(--delay, 0ms) both;
}

.caption {
  margin: 12px 1px 0;
}

@media (max-width: 420px) {
  .caption {
    font-size: 11px;
    letter-spacing: 0.06em;
  }
}

.pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.pad[hidden] {
  display: none;
}

.key {
  height: 54px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink);
  font-family: var(--sans);
  font-variation-settings: "opsz" 32;
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 120ms,
    border-color 120ms,
    color 120ms,
    transform 80ms;
}

@media (min-width: 960px) {
  .key {
    height: 50px;
  }
}

@media (hover: hover) {
  .key:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--hairline));
  }
}

.key:active {
  background: var(--wash-strong);
  transform: translateY(1px);
}

.key.is-done {
  color: var(--ink-soft);
  border-color: transparent;
}

.key svg {
  display: block;
  width: 24px;
  height: 24px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.solved {
  margin-top: 18px;
  min-height: 112px;
}

.solved[hidden] {
  display: none;
}

.solved.is-arriving {
  animation: arrive 420ms var(--ease) both;
}

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

.solved-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 6px;
}

.qed {
  margin: 0;
  color: var(--ink);
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.solved-time {
  margin: 0;
  text-align: right;
}

.solved-time .value {
  display: block;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.solved-note {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.noscript {
  margin-top: 16px;
  font-size: 15px;
  color: var(--ink-soft);
}

/* The essay */

.essay {
  max-width: calc(var(--main) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter) 24px;
}

@media (min-width: 1100px) {
  /* Leave room on the left for the hanging section numbers. */
  .essay {
    max-width: min(var(--page), calc(100vw - 128px));
    padding-inline: 0;
  }
  .cols {
    display: grid;
    grid-template-columns: minmax(0, var(--main)) var(--side);
    column-gap: var(--gap);
    align-items: start;
  }
  .cols > * {
    grid-column: 1;
  }
  .cols > .np,
  .cols > .span {
    grid-column: 1 / -1;
  }
}

.essay-head {
  padding-top: 60px;
  border-top: 1px solid var(--hairline);
}

.essay-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(40px, 3.6vw, 48px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.byline {
  margin: 0 0 28px;
}

.abstract {
  margin: 0 0 8px;
  padding: 18px 0 20px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-wrap: pretty;
}

.abstract .label {
  display: block;
  margin-bottom: 6px;
}

.sec h2 {
  position: relative;
  margin: 72px 0 12px;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(27px, 2.4vw, 32px);
  line-height: 1.4;
  letter-spacing: -0.03em;
}

.sec-num {
  margin-right: 0.35em;
  color: var(--accent-text);
  font-family: var(--italic);
  font-style: italic;
  font-weight: 400;
  font-size: 1.08em;
  letter-spacing: 0;
}

@media (min-width: 1100px) {
  .sec-num {
    position: absolute;
    right: 100%;
    margin-right: 0.6em;
    white-space: nowrap;
  }
}

.sec p,
.coda p {
  text-wrap: pretty;
}

/* Sidenotes: in the margin on wide screens, numbered notes under their paragraph otherwise. */

.ref {
  font-size: 0.66em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 0;
  vertical-align: 0.6em;
  margin-left: 0.12em;
  padding: 0 0.1em;
  text-decoration: none;
  color: var(--accent-text);
}

.sn {
  position: relative;
  margin: -0.2em 0 1.4em;
  padding: 0 0 0 1.5em;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.sn-n {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1100px) {
  .np {
    display: grid;
    grid-template-columns: minmax(0, var(--main)) var(--side);
    column-gap: var(--gap);
    align-items: start;
  }
  .np > :not(.sn) {
    grid-column: 1;
  }
  .np > .sn {
    grid-column: 2;
    grid-row: 1;
    margin: 0.25em 0 0;
    padding: 0 0 0 1.4em;
    font-size: 14px;
  }
}

/* Definition rows: the difficulty ladder and the availability facts. */

.rows {
  margin: 8px 0 28px;
  border-top: 1px solid var(--hairline);
}

.rows > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  align-items: baseline;
}

.rows dt {
  margin: 0;
}

.rows dd {
  margin: 0;
  color: var(--ink);
}

.rows .meter {
  display: inline-flex;
  gap: 3px;
  margin-left: 8px;
  vertical-align: 0.1em;
}

.rows .meter i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--hairline);
}

.rows .meter i.on {
  background: var(--accent);
}

/* Figures */

.figs {
  display: grid;
  gap: 28px;
  margin: 12px 0 36px;
}

@media (min-width: 700px) {
  .figs {
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
    align-items: start;
  }
  .figs .fig-x {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

figure {
  margin: 0;
}

.np > figure {
  margin-bottom: 28px;
}

figcaption {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

figcaption b {
  color: var(--ink);
  font-weight: 600;
}

svg.tech {
  display: block;
  width: 100%;
  height: auto;
}

.tech .bg {
  fill: var(--board);
}
.tech .lc {
  stroke: var(--rule-cell);
  stroke-width: 1;
}
.tech .lb,
.tech .fr {
  stroke: var(--rule-box);
  stroke-width: 2;
  fill: none;
}
.tech .wash {
  fill: var(--wash-strong);
}
.tech .hl {
  fill: var(--accent);
}
/* Digits carry a halo in the cell colour, so the pattern lines pass behind them. */
.tech text {
  font-family: var(--sans);
  font-variation-settings: "opsz" 32;
  text-anchor: middle;
  dominant-baseline: central;
  paint-order: stroke;
  stroke: var(--board);
  stroke-width: 6px;
  stroke-linejoin: round;
}
.tech .g,
.tech .hl-t {
  font-size: 18px;
  font-weight: 600;
  fill: var(--ink);
}
.tech .hl-t {
  fill: var(--on-accent);
  stroke: none;
}
.tech .cand {
  font-size: 16px;
  font-weight: 700;
  fill: var(--accent-text);
  stroke: var(--wash-strong);
}
.tech .cand-x {
  font-size: 14px;
  fill: var(--ink-soft);
}
.tech .strike {
  stroke: var(--mistake);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.tech .beam {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 0.1 5;
}
.tech .wing {
  stroke: var(--accent);
  stroke-width: 2;
}

/* Haptics */

.feel {
  width: 100%;
  margin: 8px 0 10px;
  border-collapse: collapse;
}

.feel th,
.feel td {
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.feel thead th {
  padding: 0 0 8px;
}

.feel tbody th {
  width: 42%;
  padding-right: 20px;
  color: var(--text);
}

.feel .what {
  display: block;
  color: var(--ink);
  font-weight: 500;
}

svg.pulse {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin-top: 8px;
  overflow: visible;
}

@media (min-width: 720px) {
  .feel td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
  }
  .feel .what {
    white-space: nowrap;
  }
  svg.pulse {
    margin-top: 0;
    flex: 0 0 160px;
  }
}

.pulse .axis {
  stroke: var(--hairline);
  stroke-width: 1;
}
.pulse .tickmark {
  stroke: var(--ink-faint);
  stroke-width: 1;
}
.pulse .tap {
  fill: var(--accent);
}
.pulse .swell {
  fill: var(--accent);
  opacity: 0.3;
}

/* Looks */

.looks {
  display: grid;
  gap: 24px;
  margin: 12px 0 14px;
}

@media (min-width: 700px) {
  .looks {
    grid-template-columns: 1fr 1fr;
    gap: 26px 20px;
  }
}

.look figcaption {
  margin-top: 8px;
}

.plate {
  padding: 14px;
  background: var(--m-bg);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px var(--m-edge, transparent);
}

.mini {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 2px solid var(--m-box);
  border-radius: var(--m-radius, 0);
  overflow: hidden;
  background: var(--m-surface);
  font-variant-numeric: tabular-nums lining-nums;
}

.mini > i {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--m-rule);
  font-style: normal;
  font-family: var(--m-font, var(--sans));
  font-variation-settings: "opsz" 32;
  font-size: var(--m-size, 19px);
  line-height: 1;
  color: var(--m-pen);
}

.mini > i:nth-child(9n) {
  border-right: 0;
}

.mini > i:nth-child(9n + 3),
.mini > i:nth-child(9n + 6) {
  border-right: 2px solid var(--m-box);
}

.mini > i:nth-child(-n + 18) {
  border-bottom: 1px solid var(--m-rule);
}

.mini .g {
  color: var(--m-ink);
  font-weight: var(--m-given-weight, 600);
}

.mini .h {
  background: var(--m-wash);
}

.mini .s {
  background: var(--m-accent);
  color: var(--m-on);
}

.mini svg {
  width: 32%;
  height: auto;
  fill: currentColor;
  shape-rendering: crispEdges;
}

/* The app's own palettes, tangerine accent. */
.look-clean {
  --m-bg: #f2f2f6;
  --m-surface: #ffffff;
  --m-ink: #111114;
  --m-rule: #d6d6dc;
  --m-box: #2a2a2e;
  --m-pen: #2465c9;
  --m-wash: #f3f3f6;
  --m-accent: #f0782a;
  --m-on: #ffffff;
}

.look-book {
  --m-bg: #e4dac8;
  --m-surface: #efe8dc;
  --m-ink: #26221e;
  --m-rule: #d3c7b3;
  --m-box: #26221e;
  --m-pen: #24468a;
  --m-wash: #e6dece;
  --m-accent: #f0782a;
  --m-on: #fffaf2;
  --m-font: "Quod Book Digits", "Libre Baskerville", Baskerville, Georgia, serif;
  --m-size: 17px;
  --m-given-weight: 400;
}

.look-pixel {
  --m-bg: #e9e6f1;
  --m-surface: #f6f4fa;
  --m-ink: #1f1b2e;
  --m-rule: #c9c3da;
  --m-box: #1f1b2e;
  --m-pen: #2465c9;
  --m-wash: #ece8f3;
  --m-accent: #f0782a;
  --m-on: #f6f4fa;
}

.look-pixel .mini > i:not(.s):not(.h) {
  background-image:
    linear-gradient(#ebe7f3 1px, transparent 1px),
    linear-gradient(90deg, #ebe7f3 1px, transparent 1px);
  background-size: 25% 25%;
}

.look-night {
  --m-bg: #000000;
  --m-surface: #0c0c0b;
  --m-ink: #9e978d;
  --m-rule: #1e1d1b;
  --m-box: #56524d;
  --m-pen: #4a6c9e;
  --m-wash: #121211;
  --m-accent: #a3521d;
  --m-on: #e6dfd4;
  --m-edge: #26262a;
}

/* Leaderboard sample */

.lb-fig {
  margin: 8px 0 26px;
  padding: 16px 20px 6px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  background: var(--surface);
}

.lb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
}

.sample {
  padding: 3px 8px 2px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink);
}

.lb {
  width: 100%;
  border-collapse: collapse;
}

.lb td {
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
  vertical-align: baseline;
}

.lb .rank {
  width: 2.4em;
  color: var(--ink-soft);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lb .name {
  color: var(--ink);
  font-weight: 500;
}

.lb .t {
  text-align: right;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lb .me .rank {
  color: var(--accent-text);
}

.lb .me .name::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.15em;
}

/* Coda */

.coda {
  padding: 28px 0 76px;
}

.coda .qed-line {
  margin: 30px 0 34px;
  color: var(--ink);
  font-size: clamp(40px, 4vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  text-align: right;
}

.back {
  font-size: 15px;
  font-weight: 500;
}

.back a {
  text-decoration: none;
}

.back a:hover {
  text-decoration: underline;
}

/* Plain pages: privacy, support, 404 */

.doc {
  max-width: calc(var(--main) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 52px var(--gutter) 76px;
}

.doc h1 {
  font-size: clamp(40px, 5vw, 60px);
  margin-bottom: 14px;
}

.doc .meta {
  margin: -2px 0 30px;
}

.doc h2 {
  position: relative;
  margin: 54px 0 14px;
  color: var(--ink);
  font-weight: 600;
  font-size: clamp(23px, 2vw, 27px);
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.doc h3 {
  margin: 34px 0 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.08em;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.doc ul {
  margin: 0 0 1em;
  padding-left: 1.15em;
}

.doc li {
  margin-bottom: 0.45em;
  padding-left: 0.2em;
}

.doc li::marker {
  color: var(--ink-faint);
}

.doc .lead {
  text-wrap: pretty;
  color: var(--ink);
  font-size: 1.12em;
  line-height: 1.5;
}

.doc .sec-num {
  position: static;
  margin-right: 0.35em;
}

@media (min-width: 1100px) {
  .doc .sec-num {
    position: absolute;
    right: 100%;
    margin-right: 0.6em;
  }
}

.not-found {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

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