/* Klouzačka's whole look: clean, with a friendly face, as on the site's main page. The system's own typeface,
   warm neutral greys and thin lines; the game's own colour is the teal of ice: a soft wash at the top of the
   page, the arrows beside the penguin, the shortest way when it is shown, the main button, the dot of the
   way to play that is in use. The board is a rink of pale ice with snow on it; the stars are amber, and a
   run told has an amber light at its top. The site's penguin sits by the title, in a scarf. A day with stars
   is green, a day without is grey. What a finger presses or reads at a glance is set bold. No web font,
   nothing from another origin (server.mjs). */

:root {
  color-scheme: light dark;

  --bg: #faf9f7;
  --surface: #ffffff;
  --ink: #1b1a18;
  --muted: #6b6862;
  --line: #e9e6e0;
  --line-strong: #d3cfc7;
  /* what lies flat on the page: the track under the two ways to play, a small button */
  --fill: #efede8;
  --thumb: #ffffff;
  --focus: #0a7f9c;
  /* the game's own colour: what reads on it, the wash at the top of the page (index.html's theme colour is
     the same), the light at the top of a run told */
  --accent: #0a7f9c;
  --on-accent: #ffffff;
  --wash: #d5edf3;
  --glow: rgb(242 182 50 / 0.2);
  --star: #f2b632;
  --green: #2fb574;
  --on-mark: #1b1a18;
  /* a day without stars */
  --absent: #dddad3;
  --on-absent: #5b5852;
  --shadow: 0 1px 2px rgb(27 26 24 / 0.06), 0 16px 40px -16px rgb(27 26 24 / 0.28);

  /* the rink: its ice, the lines between its cells, its rim; snow and its shaded side; the pieces */
  --ice: #d9eff7;
  --ice-deep: #c1e2ef;
  --ice-line: rgb(10 127 156 / 0.14);
  --ice-rim: #a8d2e1;
  --snow: #ffffff;
  --snow-dim: #cbdde8;
  --snow-rim: #97b9ca;
  --penguin: #1b1a18;
  --penguin-rim: transparent;
  --belly: #ffffff;
  --beak: #f59e0b;
  --scarf: #e5484d;
  --scarf-dim: #c9363c;
  --fish: #ff7a59;
  --fish-dim: #e35f40;
  --tree: #2f9e6e;
  --trunk: #8b5e3c;
  --coal: #1b1a18;
  /* where the penguin has been, and the shortest way */
  --track: rgb(27 60 78 / 0.3);

  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* The room between the page and the screen's edges: a little more on a larger phone, never none. */
  --pad-x: clamp(16px, 5vw, 22px);
  --pad-y: clamp(10px, 2.3dvh, 20px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1b1b19;
    --ink: #f2f0ec;
    --muted: #a5a29b;
    --line: #2a2927;
    --line-strong: #403e3a;
    --fill: #232321;
    --thumb: #3b3a36;
    --focus: #6fd3e8;
    --accent: #56c7e0;
    --on-accent: #06222b;
    --wash: #172a31;
    --glow: rgb(242 201 76 / 0.13);
    --star: #f2c94c;
    --green: #3fbf7f;
    --on-mark: #121211;
    --absent: #2b2a28;
    --on-absent: #96938c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -16px rgb(0 0 0 / 0.8);

    /* the rink at night: the ice is dark, the snow still catches the light */
    --ice: #23475a;
    --ice-deep: #1c3a4b;
    --ice-line: rgb(255 255 255 / 0.07);
    --ice-rim: #2f5a70;
    --snow: #e4eef3;
    --snow-dim: #a9bfcc;
    --snow-rim: #7f9aaa;
    --penguin: #101112;
    --penguin-rim: rgb(255 255 255 / 0.55);
    --belly: #f4f7f9;
    --tree: #37a877;
    --trunk: #94694a;
    --coal: #101112;
    --track: rgb(228 238 243 / 0.34);
  }
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(to bottom, var(--wash), var(--bg) 15rem) no-repeat var(--bg);
  color: var(--ink);
  font: 1rem/1.5 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* A field the page copies from when the clipboard will not be written to directly. */
.offscreen {
  position: fixed;
  top: 0;
  left: -100vw;
  opacity: 0;
}

a {
  color: inherit;
}

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

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

.sheet {
  max-width: 34rem;
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--pad-y) max(var(--pad-x), env(safe-area-inset-right)) calc(var(--pad-y) + env(safe-area-inset-bottom))
    max(var(--pad-x), env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

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

.center {
  text-align: center;
}

/* --- the header ------------------------------------------------------------------------------------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 4px;
}

/* The site's penguin, beside the game's name. The penguin is the way to the site's main page, the name the
   way to this game's own day. */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand__home {
  flex: none;
  display: block;
  border-radius: 50%;
}

.title__mark {
  flex: none;
  display: block;
  width: 34px;
  height: 34px;
  transition: transform 160ms ease;
}

.brand__home:hover .title__mark,
.brand__home:focus-visible .title__mark {
  transform: rotate(-8deg) scale(1.06);
}
/* The name is a long one: on a narrow phone it is set a little smaller, so that the three buttons beside it
   keep the page's gutter. */
.title {
  margin: 0;
  min-width: 0;
  font-size: clamp(1.1875rem, 5.4vw, 1.625rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.title a {
  display: flex;
  align-items: center;
  gap: clamp(6px, 2vw, 9px);
  text-decoration: none;
}

.tools {
  display: flex;
  gap: 6px;
}

.tool {
  flex: none;
  min-height: 36px;
  padding: 0 clamp(8px, 2.8vw, 12px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.tool--round {
  width: 36px;
  padding: 0;
  font-weight: 600;
}

/* Statistics: the word where there is room for it, three bars where there is not (a phone, now that the
   language stands beside it). The button's label says the word either way. */
.tool--stats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool--stats svg {
  display: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

@media (max-width: 27.99rem) {
  .tool--stats {
    width: 36px;
    padding: 0;
  }

  .tool--stats svg {
    display: block;
  }

  .tool--stats span {
    display: none;
  }
}

/* The other language, by its two letters (its whole name is its label): a link, which asks the server for
   this same page in it. */
.tool--lang {
  display: inline-grid;
  place-items: center;
  color: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}

/* The account: a figure while nobody is signed in, the player's initial on the game's colour once someone is. */
.tool--account {
  display: inline-grid;
  place-items: center;
}

.tool--account svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.tool--account.is-in {
  border-color: var(--accent);
  background: var(--wash);
}

.tool--account.is-in svg,
.tool--account:not(.is-in) [data-initial] {
  display: none;
}

#account-body .actions {
  margin: 14px 0 12px;
}

.account__unsaved {
  color: var(--ink);
}

.tool:active,
.button:active {
  background: var(--fill);
}

/* The two ways to play: one track, and the one in use lifted from it. */
.modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  margin-top: 6px;
  padding: 3px;
  border-radius: 11px;
  background: var(--fill);
}

.modes a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.modes a[aria-current='page'] {
  background: var(--thumb);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

.modes a[aria-current='page']::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.caption {
  margin: 0;
  padding: 10px 2px 8px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* --- the rink --------------------------------------------------------------------------------------- */

/* The rink is as wide as the page, or as tall as the screen leaves room for: all of it is in sight without
   scrolling. Its cells are squares; app.js gives --w and --h, and every piece its --x and --y. */
.play {
  --w: 7;
  --h: 9;
  --rink: min(100%, max(15rem, calc((100dvh - 14rem) * var(--w) / var(--h))));
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
}

/* A run that is over: the rink makes room for what is told about it. */
.play.is-over {
  --rink: min(100%, max(13rem, calc((100dvh - 27rem) * var(--w) / var(--h))));
}

.rink {
  position: relative;
  width: var(--rink);
  aspect-ratio: var(--w) / var(--h);
  margin: 0 auto;
  border-radius: 16px;
  background:
    linear-gradient(to right, var(--ice-line) 1px, transparent 1px) 0 0 / calc(100% / var(--w)) 100%,
    linear-gradient(to bottom, var(--ice-line) 1px, transparent 1px) 0 0 / 100% calc(100% / var(--h)),
    linear-gradient(165deg, var(--ice), var(--ice-deep));
  box-shadow: 0 0 0 1px var(--ice-rim), 0 0 0 5px color-mix(in oklab, var(--snow) 70%, transparent), 0 0 0 6px var(--line);
  /* a finger on the rink moves the penguin, not the page */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: width 320ms ease;
}

/* Once a run is over the page scrolls under a finger again. */
.play.is-over .rink {
  touch-action: auto;
}

.cell {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / var(--w));
  height: calc(100% / var(--h));
  display: grid;
  place-items: center;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%));
  pointer-events: none;
}

.cell > svg {
  display: block;
  width: 88%;
  height: 88%;
  overflow: visible;
}

/* the pieces' colours: each shape names what it is made of */
.p-shade { fill: var(--snow-rim); opacity: 0.35; }
.p-snow { fill: var(--snow); }
/* a drift's outline: white snow on pale ice needs an edge */
.cell--drift .p-snow { stroke: var(--snow-rim); stroke-width: 0.9; stroke-linejoin: round; }
.p-snow-dim { fill: var(--snow-dim); }
.p-snow-ball { fill: var(--snow); stroke: var(--snow-rim); stroke-width: 1; }
.p-tree { fill: var(--tree); stroke: var(--tree); stroke-width: 2; stroke-linejoin: round; }
.p-trunk { fill: var(--trunk); }
.p-star { fill: var(--star); }
.p-coal { fill: var(--coal); }
.p-beak { fill: var(--beak); stroke: var(--beak); stroke-width: 2; stroke-linejoin: round; }
.p-feet { fill: var(--beak); }
.p-body { fill: var(--penguin); stroke: var(--penguin-rim); stroke-width: 2.5; }
.p-belly { fill: var(--belly); }
.p-eye { fill: #fff; }
.p-cheek { fill: #ff9db0; opacity: 0.85; }
.p-scarf { fill: var(--scarf); }
.p-scarf-dim { fill: var(--scarf-dim); }
.p-fish { fill: var(--fish); }
.p-fish-dim { fill: none; stroke: var(--fish-dim); stroke-width: 1.8; stroke-linecap: round; }

/* where the run began */
.cell--start::before {
  content: '';
  width: 46%;
  height: 46%;
  border: 2px dashed var(--track);
  border-radius: 50%;
}

.cell--fish > svg {
  width: 86%;
  height: 86%;
  animation: bob 2.6s ease-in-out infinite;
  transition: transform 220ms ease-in, opacity 220ms ease-in;
}

.cell--fish.is-gone > svg {
  animation: none;
  transform: scale(0.2);
  opacity: 0;
}

@keyframes bob {
  50% { transform: translateY(-5%) rotate(-5deg); }
}

/* The penguin glides: app.js sets how long by how far. */
.cell--penguin {
  z-index: 2;
  transition: transform var(--glide, 0ms) cubic-bezier(0.35, 0, 0.8, 0.85);
}

.cell--penguin.is-placed {
  transition: none;
}

.cell--penguin > svg {
  width: 84%;
  height: 84%;
  transition: transform 120ms ease-out;
  filter: drop-shadow(0 2px 2px rgb(10 40 55 / 0.22));
}

/* leaning into the way it goes */
.cell--penguin[data-going='L'] > svg { transform: rotate(-10deg); }
.cell--penguin[data-going='R'] > svg { transform: rotate(10deg); }
.cell--penguin[data-going='U'] > svg { transform: scale(0.94, 1.04); }
.cell--penguin[data-going='D'] > svg { transform: scale(1.04, 0.94); }

/* a push against something that does not give */
.cell--penguin[data-bump='L'] > svg { animation: bump-x 180ms ease-out; --by: -9%; }
.cell--penguin[data-bump='R'] > svg { animation: bump-x 180ms ease-out; --by: 9%; }
.cell--penguin[data-bump='U'] > svg { animation: bump-y 180ms ease-out; --by: -9%; }
.cell--penguin[data-bump='D'] > svg { animation: bump-y 180ms ease-out; --by: 9%; }

@keyframes bump-x {
  40% { transform: translateX(var(--by)); }
}

@keyframes bump-y {
  40% { transform: translateY(var(--by)); }
}

.cell--penguin.is-happy > svg {
  animation: hop 560ms ease-out;
}

@keyframes hop {
  30% { transform: translateY(-22%) rotate(-8deg); }
  55% { transform: translateY(0) rotate(6deg); }
  75% { transform: translateY(-9%); }
}

/* The four ways the penguin can go, each a button on the cell beside it. */
.arrow {
  z-index: 3;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--accent);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.arrow > svg {
  width: 42%;
  height: 42%;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.arrow[data-dir='L'] > svg { transform: translateX(22%) rotate(180deg); }
.arrow[data-dir='R'] > svg { transform: translateX(-22%); }
.arrow[data-dir='U'] > svg { transform: translateY(22%) rotate(-90deg); }
.arrow[data-dir='D'] > svg { transform: translateY(-22%) rotate(90deg); }

@media (hover: hover) {
  .arrow:hover > svg {
    opacity: 1;
  }
}

/* On the fish's own cell the fish is the sign: the cell is still pressed like any arrow. */
.arrow.is-fish > svg {
  visibility: hidden;
}

.arrow:focus-visible {
  outline-offset: -4px;
}

/* Where the penguin has been: a line from stop to stop. The shortest way is drawn in the game's colour. */
.tracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tracks polyline {
  fill: none;
  stroke: var(--track);
  stroke-width: 0.09;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tracks .is-best {
  stroke: var(--accent);
  stroke-width: 0.12;
}

/* under the rink while a run is on: how many moves so far, and how to move */
.status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: var(--rink);
  min-height: 1.5em;
  margin: 0 auto;
  padding: 0 2px;
}

.status p {
  margin: 0;
}

.status__count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status__hint {
  font-size: 0.9375rem;
  color: var(--muted);
  text-align: right;
  text-wrap: balance;
}

/* --- stars ------------------------------------------------------------------------------------------ */

.stars {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}

.star {
  --i: 0;
  width: 22px;
  height: 22px;
  flex: none;
  overflow: visible;
}

.star path {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.star.is-on path {
  fill: var(--star);
  stroke: var(--star);
}
.star:nth-child(2) { --i: 1; }
.star:nth-child(3) { --i: 2; }

.stars--big {
  gap: 4px;
}

.stars--big .star {
  width: clamp(36px, 11vw, 44px);
  height: clamp(36px, 11vw, 44px);
}

/* A run's stars come one after another: each keeps its bare look until its turn. app.js lets them
   finish within a second and a half. */
.stars.is-new .star.is-on {
  animation: pop 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2) calc(var(--i) * 150ms + 120ms) backwards;
}

.stars.is-new .star.is-on path {
  animation: bare 150ms step-end calc(var(--i) * 150ms + 120ms) backwards;
}

@keyframes pop {
  0% { transform: none; }
  45% { transform: scale(1.25); }
  100% { transform: none; }
}

@keyframes bare {
  from {
    fill: none;
    stroke: var(--line-strong);
  }
}

/* --- buttons ---------------------------------------------------------------------------------------- */

.button {
  min-height: 44px;
  padding: 0 16px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button--main,
.button--main:active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.button--main:active {
  opacity: 0.85;
}

.button--wide {
  width: 100%;
  min-height: 52px;
  margin-top: 2px;
  border-radius: 12px;
  font-size: 1.0625rem;
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* --- an answer told ---------------------------------------------------------------------------------- */

.result {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 20px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: radial-gradient(120% 130px at 50% 0, var(--glow), transparent) var(--surface);
  text-align: center;
}

.result h2 {
  margin: 0;
  font-size: clamp(1.5rem, 7vw, 1.875rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.result h2:focus {
  outline: none;
}

.result p {
  margin: 0;
}

/* under a finished game: the way to the site's other games */
.more a {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}

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

.verdict {
  font-weight: 600;
}

.next {
  font-size: 0.9375rem;
  color: var(--muted);
}

.next .clock {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
}

/* Which way is drawn on the rink: one track, and the one in use lifted from it. */
.ways {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  width: 100%;
  max-width: 22rem;
  padding: 3px;
  border-radius: 11px;
  background: var(--fill);
}

.ways button {
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

.ways button[aria-pressed='true'] {
  background: var(--thumb);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}

/* What the game says: a label over the bottom of the page. */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 4;
  width: max-content;
  max-width: calc(100vw - 2 * var(--pad-x));
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast:empty {
  display: none;
}

/* --- the archive ------------------------------------------------------------------------------------ */

.archive {
  padding: 4px 2px 16px;
}

.archive__sum {
  margin: 0 0 12px;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--muted);
}

.month {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin-bottom: 10px;
}

.month h2 {
  margin: 0;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.month a,
.month span {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1.1rem;
  text-decoration: none;
}

.month span {
  border-color: var(--line);
  background: none;
  color: var(--line-strong);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar .dow {
  padding-bottom: 2px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.day {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: clamp(1rem, 4.4vw, 1.25rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

/* a day with its stars: the date, and under it what the answer earned */
.day[data-state='some'] {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  border-color: var(--green);
  background: var(--green);
  color: var(--on-mark);
  font-size: clamp(0.9375rem, 4.2vw, 1.125rem);
}

.day small {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.day.is-off {
  border-color: transparent;
  background: none;
  color: var(--line-strong);
  font-weight: 400;
}

.day[data-state='none'] {
  border-color: var(--absent);
  background: var(--absent);
  color: var(--on-absent);
}

.day.is-today {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.day.is-today:focus-visible {
  outline-color: var(--focus);
}

.key-to {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--muted);
}

.key-to li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.key-to .day {
  width: 18px;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 5px;
}

/* --- trouble, dialogs ------------------------------------------------------------------------------- */

.trouble {
  margin: 24px auto;
  max-width: 24rem;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: center;
}

.trouble p {
  margin: 0 0 12px;
}

.dialog {
  width: min(30rem, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgb(18 18 17 / 0.5);
}

.dialog h2 {
  margin: 0 0 12px;
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.dialog p {
  margin: 0 0 10px;
  font-size: 0.9375rem;
}

/* In the rules, which a first visit opens: the way to the other language, for whoever cannot read them. */
.dialog__lang {
  margin: -6px 0 12px;
  font-size: 0.875rem;
}

.dialog__lang a {
  color: var(--muted);
  font-weight: 500;
}

.dialog__close {
  float: right;
  margin: -6px -4px 0 8px;
}

.dialog__close button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

/* the rule: stars, and the guesses that earn them */
.rules {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
}

.rules li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  line-height: 1.3;
}

.how {
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.9375rem;
}

.how dt {
  font-weight: 600;
}

.how dd {
  margin: 0;
}

.numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 12px;
}

.numbers div {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  padding: 10px 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.numbers b {
  font-size: clamp(1.3rem, 6vw, 1.75rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.numbers span {
  font-size: 0.875rem;
  line-height: 1.2;
  color: var(--muted);
}

.bars {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  margin: 0 0 10px;
  font-size: 0.9375rem;
}

.bars dt {
  text-align: right;
  color: var(--muted);
}

.bars dd {
  margin: 0;
}

.bar {
  min-width: 1.8em;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--fill);
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar.is-some {
  background: var(--green);
  color: var(--on-mark);
}

.bar.is-lost {
  background: var(--ink);
  color: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* A screen with room to spare: let the page breathe. */
@media (min-width: 40rem) and (min-height: 46rem) {
  .top {
    padding-top: 6px;
  }
  .modes a {
    min-height: 34px;
  }
  .play {
    gap: 20px;
  }
}
