/* The Wrong Key: a locksmith's board on a pixel grid. Square corners, one-pixel lines, no blur,
   motion in whole steps. Orange appears only where the eye should land. */

:root {
  --status: var(--ac-status-h, 72px);
  --pad: 6px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --line: 1px;
  --head-h: 52px;
  /* A drawn key is 46 grid cells wide and 40 tall. */
  --key-ar: calc(46 / 40);
  --lens-h: 96px;
  /* Portrait: the board runs edge to edge above the panel, so a 6×6 key stays at least 52px wide on
     a small phone. The panel takes the height left over and scrolls; it only squeezes the board when
     less than --side-min would be left. Cells are a little wider than tall, like the keys. */
  --board-ar: 1.1;
  --side-min: 180px;
  --board-w: min(
    calc(100vw - 2 * var(--pad) - var(--safe-l) - var(--safe-r)),
    calc((100dvh - var(--status) - var(--head-h) - var(--side-min) - var(--safe-b)) * var(--board-ar)),
    560px
  );
  --board-h: calc(var(--board-w) / var(--board-ar));
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background-color: var(--ak-bg);
  background-image: var(--ak-backdrop-layer, var(--ak-bg-art));
  background-size: cover;
  background-position: center;
  color: var(--ak-ink);
  font-family: var(--ak-font-body);
}

/* The painted key board stays underneath, but only as a whisper: the black board is the pattern. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--ak-bg);
  opacity: 0.82;
  pointer-events: none;
}

/* The opening screen (drawn by start.js) gets the same quiet backdrop, the title on a solid ink
   plate, and a lens that reads as a button: orange centre, ink ring. */
html #activity-start.has-backdrop::before { opacity: 0.25; }

html #activity-start .ak-logo {
  padding: 14px 18px;
  background: var(--ak-ink);
}

html #activity-start.site-expercepth .ak-go {
  border: 4px solid var(--ak-ink);
  background: var(--ak-accent);
  color: var(--ak-ink);
  font-weight: 800;
}

html #activity-start.site-expercepth .ak-go:active { background: var(--ak-btn-active); }

.play[hidden] { display: none; }

.play {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--board-w);
  /* The panel is as tall as what it holds, so nothing below the feedback is blank paper. */
  grid-template-rows: var(--head-h) var(--board-h) auto;
  align-content: start;
  grid-template-areas: "head" "board" "side";
  justify-content: center;
  padding:
    calc(var(--status) + 4px)
    calc(var(--pad) + var(--safe-r))
    var(--safe-b)
    calc(var(--pad) + var(--safe-l));
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Head: the logo ----------------------------------------------------------------------- */

.head {
  grid-area: head;
  display: flex;
  align-items: center;
  min-height: 0;
}

.logo {
  display: block;
  height: 44px;
  width: auto;
}

.teach-arrow {
  position: fixed;
  z-index: 5;
  width: 26px;
  height: 40px;
  pointer-events: none;
}

.teach-arrow[hidden] { display: none; }

/* ---- The board: black slots, white keys, a ruled gauge behind every row ------------------- */

.frame {
  grid-area: board;
  position: relative;
  width: var(--board-w);
  height: var(--board-h);
  border: var(--line) solid var(--ak-ink);
  background: var(--ak-ink);
}

.board {
  --n: 3;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: repeat(var(--n), minmax(0, 1fr));
  gap: var(--line);
  width: 100%;
  height: 100%;
  background: var(--ak-ink-muted);
}

.board[hidden] { display: none; }

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--ak-ink);
  overflow: hidden;
  container-type: size;
  cursor: pointer;
  touch-action: manipulation;
}

.cell:focus { outline: none; }
.cell:focus-visible { box-shadow: inset 0 0 0 3px var(--ak-focus); }

/* The key fills its slot from whichever side runs out first. */
.slot {
  display: grid;
  width: min(96cqw, calc(92cqh * 46 / 40));
}

.slot > * { grid-area: 1 / 1; }

.key,
.gauge {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.gauge-line {
  fill: none;
  /* Brighter than the cell lines, so a tooth that stops on a different line stands out. */
  stroke: color-mix(in srgb, var(--ak-bg) 45%, var(--ak-ink));
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.key-body { fill: var(--ak-bg); }
.key-body.is-dim { opacity: 0.4; }

.key-diff {
  fill: none;
  stroke: var(--ak-accent);
  stroke-width: 0.7;
}

.key-ghost {
  fill: none;
  stroke: var(--ak-ink-muted);
  stroke-width: 0.5;
  stroke-dasharray: 1 1;
}

/* The hint's marks: the one spot to compare, on every key in the ringed row. Grey, never orange:
   orange would read as "this is the one" on keys that match the rest. */
.key-look {
  fill: none;
  stroke: color-mix(in srgb, var(--ak-bg) 60%, var(--ak-ink));
  stroke-width: 0.6;
  stroke-dasharray: 1.2 0.8;
}

/* The ringed row's keys numbered like their close-ups, in the empty corner under the bow. */
.col-tag {
  position: absolute;
  left: 3px;
  bottom: 3px;
  min-width: 1.6em;
  padding: 0 4px;
  background: var(--ak-bg);
  color: var(--ak-ink);
  font-size: clamp(10px, 13cqw, 15px);
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
}

/* A wrong tap: the key keeps its contrast and wears a stamp in the empty corner above the shaft,
   so the answer is on the key the moment it is tapped and the teeth stay easy to read. */
.cell.is-checked { box-shadow: inset 0 0 0 2px var(--ak-bg); }

.same {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 2px 6px;
  border: var(--line) solid var(--ak-ink);
  background: var(--ak-bg);
  color: var(--ak-ink);
  /* Sized to the slot, so the stamp fits a 6×6 cell on a small phone too. */
  font-size: clamp(9px, 11cqw, 13px);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The find says so on the key at once, in the one colour that means "look here". */
.same.is-found { background: var(--ak-accent); }

.slot { position: relative; }

/* The find: the key turns in its slot, everything else falls back, then it settles back with the
   difference outlined in orange right where it hangs. */
.cell.is-found {
  z-index: 2;
  box-shadow: inset 0 0 0 3px var(--ak-accent);
}

.cell.is-found .key { transform: rotate(90deg); transform-origin: 18.5% 21.25%; }
.cell.is-found.is-settled .key { transform: none; }
.key-diff.is-board { stroke-width: 1.4; }
.board.is-final .cell:not(.is-found) .key { opacity: 0.18; }
.board.is-final .cell.is-found { box-shadow: inset 0 0 0 4px var(--ak-accent); }
.board.is-focus .cell:not(.is-found) .key { opacity: 0.35; }
.board.is-focus .cell:not(.is-found) { cursor: default; }

.ring {
  position: absolute;
  top: calc(var(--row) * 100% / var(--n) - 4px);
  height: calc(100% / var(--n) + 8px);
  border: 3px solid var(--ak-accent);
  pointer-events: none;
}

.ring.is-row { left: -4px; right: -4px; }
.ring.is-key { left: calc(var(--col) * 100% / var(--n) - 4px); width: calc(100% / var(--n) + 8px); }

/* ---- The panel: one solid column for teaching, the hint and the found pair ---------------- */

.side {
  grid-area: side;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 0;
  margin-top: 6px;
  padding: 10px 12px;
  overflow-y: auto;
  border: var(--line) solid var(--ak-ink);
  background: var(--ak-bg);
}

/* Upright, the panel never runs off the bottom of the phone: it scrolls inside what is left. */
@media (orientation: portrait) {
  .side {
    max-height: calc(100dvh - var(--status) - 4px - var(--head-h) - var(--board-h) - 6px - var(--safe-b));
  }
}

.play.is-ended .side { display: none; }

/* While looking: tools on top, so the toast at the foot of the column never covers them.
   After a find: the pair first, the next button under it. */
.play.is-found .tools { order: 5; }

.caption {
  position: relative;
  margin: 0;
  padding-left: 18px;
  color: var(--ak-ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.caption::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  width: 10px;
  height: 10px;
  background: var(--ak-accent);
}

.hint-says {
  margin: 0;
  padding: 8px 10px;
  border: 2px solid var(--ak-accent);
  color: var(--ak-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.readout-why {
  margin: 0 0 2px;
  color: var(--ak-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.readout-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.readout-name {
  flex: 0 0 76px;
  color: var(--ak-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.digit {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: var(--line) solid var(--ak-ink);
  color: var(--ak-ink);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The tooth to compare after a wrong tap, outlined in both rows of numbers. */
.digit.is-look { box-shadow: 0 0 0 3px var(--ak-accent); }

.readout-next {
  margin: 4px 0 0;
  color: var(--ak-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.best {
  display: flex;
  flex: 1 1 120px;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  margin: 0;
  color: var(--ak-ink);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.best span + span { color: var(--ak-ink-muted); }

/* The par clock: this board's time, a bar that fills toward par, and the par itself. */
.clock {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 8px;
  color: var(--ak-ink);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.clock[hidden] { display: none; }
.clock-time { flex: none; min-width: 4.2em; }

.clock-bar {
  position: relative;
  flex: 1 1 auto;
  height: 10px;
  border: var(--line) solid var(--ak-ink);
}

.clock-fill {
  position: absolute;
  inset: 0;
  background: var(--ak-ink);
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}

.clock-par { flex: none; color: var(--ak-ink-muted); }
.clock.is-over .clock-par { color: var(--ak-ink); }

/* The lens: the ringed row up close, in board order, each close-up a button for its key. */
.lens {
  display: flex;
  gap: 6px;
}

.lens-key {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 4px 2px 3px;
  border: 2px solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-ink);
  cursor: pointer;
  touch-action: manipulation;
}

.lens-art {
  display: block;
  width: 100%;
  height: var(--lens-h);
}

.lens-number {
  min-width: 22px;
  padding: 0 5px;
  background: var(--ak-bg);
  color: var(--ak-ink);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* Where the rest's tooth stops: dashed white, a ruler mark rather than a pick. */
.lens-mark {
  fill: none;
  stroke: var(--ak-bg);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}

.lens-key.is-checked { border-color: var(--ak-ink-muted); }
.lens-key.is-checked .lens-number::after { content: ' same'; }
.lens-key.is-shown { box-shadow: 0 0 0 3px var(--ak-accent); }
.lens-key:focus-visible { outline: 3px solid var(--ak-focus); outline-offset: 2px; }

.caption[hidden],
.lens[hidden],
.hint-says[hidden],
.readout[hidden],
.best[hidden],
.found[hidden] { display: none; }

.found {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.found-says {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

/* The success line: big block letters, then what the outline means. */
.found-title { display: block; width: auto; height: 28px; fill: var(--ak-ink); }

.found-rest {
  color: var(--ak-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.reveal {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pair {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.pair-key {
  flex: 0 1 40%;
  min-width: 0;
  margin: 0;
}

.pair-key figcaption {
  margin: 0 0 4px;
  color: var(--ak-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.pair-art {
  padding: 8px 8px 4px;
  border: var(--line) solid var(--ak-ink);
  background: var(--ak-ink);
}

.pair-key.is-odd .pair-art { box-shadow: 0 0 0 2px var(--ak-accent); }
.pair-art .key { width: 100%; }

.aim {
  display: block;
  width: 18px;
  height: 28px;
  margin: 2px 0 0 calc(var(--aim) - 9px);
  rotate: 180deg;
}

.pair-key.is-majority .pair-art::after {
  content: '';
  display: block;
  height: 30px;
}

.sentence {
  margin: 0;
  color: var(--ak-ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

/* This board's time against its best, beside the success line: the number to beat next run. */
.found-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.split {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--ak-ink);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: right;
  white-space: nowrap;
}

/* "FOUND IT." is 53 cells by 7, kept to its own width so the time beside it has room. */
.found-top .found-title { flex: none; aspect-ratio: 53 / 7; }
.split span + span { color: var(--ak-ink-muted); }
.split.is-best { padding-right: 8px; border-right: 4px solid var(--ak-accent); }
.split.is-best span + span { color: var(--ak-ink); }

/* ---- The ending: the board pulls into focus on the found key, and the result lands in a band
   on the half of the board away from it ---------------------------------------------------- */

.final {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-top: 2px solid var(--ak-ink);
  background: var(--ak-bg);
}

.final.is-top {
  top: 0;
  bottom: auto;
  border-top: 0;
  border-bottom: 2px solid var(--ak-ink);
}

.final[hidden] { display: none; }

.final-type {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
}

.block-type { display: block; width: auto; fill: var(--ak-ink); }
/* "10 of 10" is 47 cells wide; the second line, with its cursor, at most 83. */
.final-type .block-type:first-child { height: min(calc(var(--board-w) * 0.7 * 7 / 47), calc(var(--board-h) * 0.13)); }
.final-type .block-type + .block-type { height: min(calc(var(--board-w) * 0.9 * 7 / 83), calc(var(--board-h) * 0.07)); }
.type-cursor { fill: var(--ak-accent); }
.final-type .block-type.is-best { height: min(calc(var(--board-w) * 0.55 * 7 / 53), calc(var(--board-h) * 0.07)); fill: var(--ak-accent); }

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

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint,
.next {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  margin: 0;
  padding: 4px 16px 4px 4px;
  border: var(--line) solid var(--ak-ink);
  border-radius: 0;
  background: var(--ak-bg);
  color: var(--ak-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.hint[hidden],
.next[hidden] { display: none; }

.hint img { display: block; width: 46px; height: 46px; }

/* The way on: a solid bar the full width of the panel, the one filled control on the screen. */
.next {
  width: 100%;
  justify-content: center;
  gap: 12px;
  padding: 4px 16px;
  border: 2px solid var(--ak-btn-fill);
  background: var(--ak-btn-fill);
  color: var(--ak-btn-ink);
  box-shadow: 0 0 0 2px var(--ak-accent);
  font-size: 16px;
}

.next:active { background: var(--ak-btn-active); }
.hint:disabled { opacity: 0.5; cursor: default; }

.cursor {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 16px;
  background: var(--ak-accent);
}

.hint:focus-visible,
.next:focus-visible { outline: 3px solid var(--ak-focus); outline-offset: 2px; }

.hint:active { background: var(--ak-surface); }

/* ---- Sideways: board on the right, the panel and status on the left ----------------------- */

@media (orientation: landscape) {
  :root {
    --board-ar: 1.45;
    /* The board takes all the height it can; the panel gets every pixel of width left over. */
    --board-h: min(
      calc(100dvh - var(--status) - 20px - var(--safe-b)),
      calc((100vw - 260px - 3 * var(--pad) - 12px - var(--safe-l) - var(--safe-r)) / var(--board-ar)),
      620px
    );
    --board-w: calc(var(--board-h) * var(--board-ar));
    --side-w: min(400px, calc(100vw - var(--board-w) - 3 * var(--pad) - 12px - var(--safe-l) - var(--safe-r)));
  }

  .play {
    grid-template-columns: var(--side-w) var(--board-w);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "side board";
    column-gap: 14px;
    padding-bottom: calc(14px + var(--safe-b));
  }

  /* The logo rides in the top band above the board, between the status chips and the help button,
     so the left column gets the full height. */
  .head {
    grid-area: board;
    align-self: start;
    justify-self: center;
    height: 44px;
    margin-top: calc(14px - var(--status) - 4px);
    pointer-events: none;
  }

  .logo { height: 44px; }
  .side { margin-top: 0; align-self: start; max-height: 100%; }
  .frame { align-self: start; }
  .side { border-bottom: var(--line) solid var(--ak-ink); }

  .final-type { gap: 6px; padding: 10px 12px 8px; }

  /* The chrome's toast and ending chips land in the left column, never on the board. */
  html #activity-chrome-toast[data-at="bottom-center"] {
    left: calc(var(--pad) + var(--safe-l) + max(0px, (100vw - var(--side-w) - var(--board-w) - 12px - 2 * var(--pad)) / 2));
    max-width: var(--side-w);
    translate: none;
  }

  html #activity-chrome-ending.site-expercepth .ac-card {
    max-width: min(100%, var(--side-w));
    margin-left: max(0px, (100vw - var(--side-w) - var(--board-w) - 12px - 2 * var(--pad) - 24px) / 2);
  }
}

/* A short phone held upright: the found panel packs tighter so the next bar stays in view. */
@media (orientation: portrait) and (max-height: 780px) {
  /* The logo row gives up some height so the panel keeps room under an edge-to-edge board. */
  :root { --lens-h: 60px; --head-h: 36px; }
  .logo { height: 32px; }
  .side { gap: 6px; padding: 8px 10px calc(4px + var(--safe-b)); }
  .found, .reveal, .found-says { gap: 5px; }
  .readout { gap: 3px; }
  .digit { height: 28px; }
  .found-title { height: 24px; }
  .found-rest { font-size: 15px; }
  .pair { justify-content: center; gap: 14px; }
  .pair-key { flex-basis: 33%; }
  .pair-art { padding: 6px 6px 2px; }
  .aim { width: 14px; height: 22px; margin-left: calc(var(--aim) - 7px); }
  .pair-key.is-majority .pair-art::after { height: 24px; }
  /* The orange frame already says which is which; the captions go so the words stay big. */
  .pair-key figcaption { display: none; }
  .sentence { font-size: 17px; }
  .next { min-height: 52px; }
}

/* Sideways the words keep their size; the lifted pair shrinks instead, since the board beside it
   still shows where the key was. */
@media (orientation: landscape) and (max-height: 430px) {
  :root { --lens-h: 70px; }
  .side { gap: 6px; padding: 8px 10px; }
  .found, .reveal, .found-says { gap: 4px; }
  .found-title { height: 24px; }
  .found-rest { font-size: 15px; }
  .pair { justify-content: center; gap: 12px; }
  .pair-key { flex: 0 1 auto; width: min(43%, 120px); }
  .pair-key figcaption { margin-bottom: 2px; font-size: 11px; letter-spacing: 0.06em; }
  .pair-art { padding: 4px 4px 2px; }
  .sentence { font-size: 17px; }
  .hint { min-height: 48px; }
  .next { min-height: 52px; }
  .hint img { width: 40px; height: 40px; }
  .aim { width: 13px; height: 20px; margin-left: calc(var(--aim) - 6px); }
  .pair-key.is-majority .pair-art::after { height: 22px; }
}

@media (orientation: landscape) and (max-height: 380px) {
  :root { --lens-h: 58px; }
  .side { gap: 5px; padding: 6px 10px; }
  .found-title { height: 21px; }
  .logo, .head { height: 38px; }
  .caption { line-height: 1.25; }
  .digit { width: 28px; height: 26px; font-size: 18px; }
  /* The orange frame already says which is which; the captions go so the words stay big. */
  .pair-key figcaption { display: none; }
  .pair-key { width: min(36%, 88px); }
  .sentence { font-size: 16px; }
  .next { min-height: 50px; }
  .hint { gap: 6px; padding-right: 10px; font-size: 13px; letter-spacing: 0.06em; }
  .best { font-size: 13px; }
  .hint-says { padding: 5px 8px; }
  .readout-why { font-size: 15px; }
}

/* ---- Motion: whole steps, and only when motion is welcome --------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .cell.is-found .key {
    animation: wk-turn 200ms steps(2, end) both;
  }

  /* Once it has turned, the key settles back square so its outlined difference reads in place. */
  :root:not(.ac-still) .cell.is-found.is-settled .key {
    animation: none;
  }

  :root:not(.ac-still) .board.is-focus .cell:not(.is-found) .key {
    animation: wk-fall-back 360ms steps(3, end) both;
  }

  :root:not(.ac-still) .cell.is-nudge .key {
    animation: wk-nudge 240ms steps(4, end) both;
  }

  /* The tapped slot blinks white once, so the tap visibly landed before the eye finds the stamp. */
  :root:not(.ac-still) .cell.is-flash {
    animation: wk-flash 240ms steps(2, end) both;
  }

  :root:not(.ac-still) .ring {
    animation: wk-ring 900ms steps(1, end) infinite;
  }

  :root:not(.ac-still) .teach-arrow {
    animation: wk-bob 900ms steps(1, end) infinite;
  }

  :root:not(.ac-still) .found:not([hidden]) .pair-key {
    animation: wk-lift 240ms steps(3, end) both;
  }

  :root:not(.ac-still) .found:not([hidden]) .pair-key.is-odd {
    animation-delay: 120ms;
  }

  :root:not(.ac-still) .key-diff,
  :root:not(.ac-still) .aim {
    animation: wk-snap 1ms 420ms both;
  }

  :root:not(.ac-still) .glyph,
  :root:not(.ac-still) .type-cursor {
    animation: wk-snap 1ms calc(var(--i) * 70ms) both;
  }

  :root:not(.ac-still) .final:not([hidden]) {
    animation: wk-wipe 320ms steps(4, end) both;
  }

  :root:not(.ac-still) .board.is-final .cell:not(.is-found) .key {
    animation: wk-fall-further 360ms steps(3, end) both;
  }

  :root:not(.ac-still) .type-cursor,
  :root:not(.ac-still) .cursor {
    animation: wk-blink 1000ms steps(1, end) infinite;
  }

  @keyframes wk-turn {
    from { transform: rotate(0deg); }
    to { transform: rotate(90deg); }
  }

  @keyframes wk-fall-back {
    from { opacity: 1; }
    to { opacity: 0.35; }
  }

  @keyframes wk-fall-further {
    from { opacity: 0.35; }
    to { opacity: 0.18; }
  }

  @keyframes wk-nudge {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
  }

  @keyframes wk-flash {
    0% { background: var(--ak-ink-muted); }
    100% { background: var(--ak-ink); }
  }

  @keyframes wk-ring {
    0% { outline: 0 solid transparent; }
    50% { outline: 3px solid var(--ak-accent); outline-offset: 3px; }
  }

  @keyframes wk-bob {
    0% { translate: 0 0; }
    50% { translate: 0 4px; }
  }

  @keyframes wk-lift {
    from { translate: 0 12px; visibility: hidden; }
    to { translate: 0 0; visibility: visible; }
  }

  @keyframes wk-wipe {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0); }
  }

  @keyframes wk-snap {
    from { visibility: hidden; }
    to { visibility: visible; }
  }

  @keyframes wk-blink {
    0% { visibility: visible; }
    50% { visibility: hidden; }
  }
}
