/* ============================================================
   CONSTRAINBOW — easter eggs
   What a row looks like when it spells one of the egg words (see Word.setRowState, which adds a class
   named after the word to the .word-row). Loaded after style.css, so where an egg rule and a game rule
   are equally specific, the egg wins; the one exception is kept by hand below (CUBIC's given tiles).
   A new egg goes here, keeps its word === '...' line in word.js (the puzzle generator reads the egg
   words from those), and gets a line in docs/gameplay.md and private/easter-eggs.txt.
   ============================================================ */

/* easter egg: a row that spells SLANT is sheared like italic type (the tiles become parallelograms,
   the links stay level); see Word.setRowState */
.word-row.slant {
    transform: skewX(-10deg);
}
/* easter egg: a row that spells ASKEW knocks each tile a little crooked, each its own way. It uses the
   separate rotate property, which adds to the tiles' own transforms (selected, given, the win hop) */
.word-row.askew .letter:nth-child(1) { rotate: -7deg; }
.word-row.askew .letter:nth-child(2) { rotate: 4deg; }
.word-row.askew .letter:nth-child(3) { rotate: -3deg; }
.word-row.askew .letter:nth-child(4) { rotate: 8deg; }
.word-row.askew .letter:nth-child(5) { rotate: -5deg; }
/* easter egg: a row that spells ROUND turns its tiles into circles (the shadows follow). The color shape
   and score mode's points sit in the corners, which a circle cuts off, so they move inward */
.word-row.round .letter {
    border-radius: 50%;
}
.word-row.round .letter::before {
    top: 15%;
    left: 15%;
}
.word-row.round .letter-points {
    bottom: 12%;
    right: 17%;
}
/* easter egg: a row that spells CUBIC turns its tiles into cubes, seen from above: each block's top and
   right side show, going up and to the right (the opposite of the usual shadow, so it can't read as one).
   The sides are the tile's shadow stacked a pixel at a time (a darker shade of its color, gray for black
   tiles), with the same stack again behind it, spread by 2px in ink, outlining the whole block like the
   rest of the paper-pop drawings. The face moves down and left by half the depth so the row stays where
   it was (translate is the separate property, so it adds to the tiles' own transforms) */
.word-row.cubic .letter {
    --side: #9b958c;
    border-radius: 0; /* sharp corners, like a real cube */
    translate: -3px 3px;
    box-shadow:
        1px -1px 0 var(--side),
        2px -2px 0 var(--side),
        3px -3px 0 var(--side),
        4px -4px 0 var(--side),
        5px -5px 0 var(--side),
        6px -6px 0 var(--side),
        7px -7px 0 var(--side),
        1px -1px 0 2px var(--ink),
        2px -2px 0 2px var(--ink),
        3px -3px 0 2px var(--ink),
        4px -4px 0 2px var(--ink),
        5px -5px 0 2px var(--ink),
        6px -6px 0 2px var(--ink),
        7px -7px 0 2px var(--ink);
}
/* easter egg: a row that spells WACKY turns into a ransom note: each letter is cut from a different
   "magazine" (its own typeface, size and angle, some on a scrap of paper or ink) while the tiles stay put.
   The typefaces are the game's own or built into every device, with fallbacks where a device lacks one.
   scale and rotate are the separate properties, so they add to the letter's pop-in animation */
.word-row.wacky .letter-text {
    padding: 2px 4px;
    border-radius: 2px;
    /* the letters swing into their new sizes and angles (only here: other eggs set a letter's rotate and
       scale too, and easing back from those when the word changes looks glitchy) */
    transition: scale 350ms cubic-bezier(.3, 1.6, .5, 1), rotate 350ms cubic-bezier(.3, 1.6, .5, 1);
}
.word-row.wacky .letter:nth-child(1) .letter-text {
    scale: 1.2; rotate: -12deg;
}
.word-row.wacky .letter:nth-child(2) .letter-text {
    font-family: Georgia, 'Times New Roman', serif; font-weight: 700; font-style: italic;
    background: var(--paper); box-shadow: 1px 1px 0 rgba(29, 27, 32, 0.35);
    scale: 0.8; rotate: 9deg;
}
.word-row.wacky .letter:nth-child(3) .letter-text {
    font-family: 'Courier New', Courier, monospace; font-weight: 700;
    scale: 1.2; rotate: 16deg;
}
.word-row.wacky .letter:nth-child(4) .letter-text {
    font-family: var(--ui-font); font-weight: 700;
    background: var(--ink); color: var(--card);
    scale: 0.75; rotate: -8deg;
}
.word-row.wacky .letter:nth-child(5) .letter-text {
    font-family: Impact, 'Arial Narrow', 'Helvetica Neue', sans-serif; font-weight: 400; font-stretch: condensed;
    scale: 1.3; rotate: 6deg;
}

/* easter egg: a row that spells SHAKE rattles like a maraca, once: its tiles twist quickly back and
   forth, one after another, then go still. It twists (rotate) rather than sliding sideways, so it can't be
   mistaken for the shake that means a conflict or an invalid word */
/* (not while a tile plays its own pop, win hop or error shake, which would otherwise be overridden) */
.word-row.shake .letter:not(.pop, .celebrate, .shake) {
    animation: rattle 2.4s ease-in-out;
}
.word-row.shake .letter:nth-child(2):not(.pop, .celebrate, .shake) { animation-delay: 50ms; }
.word-row.shake .letter:nth-child(3):not(.pop, .celebrate, .shake) { animation-delay: 100ms; }
.word-row.shake .letter:nth-child(4):not(.pop, .celebrate, .shake) { animation-delay: 150ms; }
.word-row.shake .letter:nth-child(5):not(.pop, .celebrate, .shake) { animation-delay: 200ms; }
@keyframes rattle {
    0%, 22%, 100% { rotate: 0deg; }
    3% { rotate: 7deg; }
    7% { rotate: -7deg; }
    11% { rotate: 5deg; }
    15% { rotate: -4deg; }
    19% { rotate: 2deg; }
}

/* easter egg: a row that spells QUAKE sets off an earthquake: the whole board rumbles (a jolt, then smaller
   tremors) and the QUAKE row's tiles bounce unevenly, as if the ground moved under them, then everything
   settles (once). translate is the separate property, so it adds to the
   tiles' own transforms */
#board:has(.word-row.quake) {
    animation: quake-board 3.5s ease-out;
}
.word-row.quake .letter:not(.pop, .celebrate, .shake) {
    animation: quake-tile 3.5s ease-out;
}
.word-row.quake .letter:nth-child(2):not(.pop, .celebrate, .shake) { animation-delay: 60ms; }
.word-row.quake .letter:nth-child(3):not(.pop, .celebrate, .shake) { animation-delay: 20ms; }
.word-row.quake .letter:nth-child(4):not(.pop, .celebrate, .shake) { animation-delay: 90ms; }
.word-row.quake .letter:nth-child(5):not(.pop, .celebrate, .shake) { animation-delay: 40ms; }
@keyframes quake-board {
    0%, 30%, 100% { translate: 0 0; }
    2% { translate: -3px 4px; }
    5% { translate: 4px -3px; }
    8% { translate: -3px 2px; }
    12% { translate: 2px -2px; }
    17% { translate: -1px 1px; }
    23% { translate: 1px 0; }
}
@keyframes quake-tile {
    0%, 30%, 100% { translate: 0 0; rotate: 0deg; }
    4% { translate: 0 -9px; rotate: -4deg; }
    9% { translate: 0 0; rotate: 2deg; }
    14% { translate: 0 -4px; rotate: 3deg; }
    19% { translate: 0 0; rotate: -1deg; }
    24% { translate: 0 -1px; rotate: 0deg; }
}

/* easter egg: a row that spells FLOAT goes weightless, once: each letter drifts loose inside its tile in its
   own direction, bumps softly off the walls, tumbling slowly, then drifts back to the middle (the tiles stay
   still). Distances are a share of the tile's size, so the letters stay inside it on any screen. translate
   and rotate are the separate properties; the letter's pop-in plays first */
.word-row.float .letter:nth-child(1):not(.pop) .letter-text { animation: float-1 5s ease-in-out; }
.word-row.float .letter:nth-child(2):not(.pop) .letter-text { animation: float-2 5s ease-in-out; }
.word-row.float .letter:nth-child(3):not(.pop) .letter-text { animation: float-3 5s ease-in-out; }
.word-row.float .letter:nth-child(4):not(.pop) .letter-text { animation: float-4 5s ease-in-out; }
.word-row.float .letter:nth-child(5):not(.pop) .letter-text { animation: float-5 5s ease-in-out; }
@keyframes float-1 {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: calc(var(--tile) * -0.18) calc(var(--tile) * -0.16); rotate: -25deg; }
    50% { translate: calc(var(--tile) * 0.06) calc(var(--tile) * -0.20); rotate: -10deg; }
    75% { translate: calc(var(--tile) * 0.18) calc(var(--tile) * 0.06); rotate: 15deg; }
}
@keyframes float-2 {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: calc(var(--tile) * 0.20) calc(var(--tile) * 0.10); rotate: 20deg; }
    50% { translate: calc(var(--tile) * -0.04) calc(var(--tile) * 0.20); rotate: 35deg; }
    75% { translate: calc(var(--tile) * -0.18) calc(var(--tile) * -0.06); rotate: 10deg; }
}
@keyframes float-3 {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: calc(var(--tile) * 0.06) calc(var(--tile) * -0.20); rotate: -15deg; }
    50% { translate: calc(var(--tile) * 0.20) calc(var(--tile) * 0.04); rotate: -30deg; }
    75% { translate: calc(var(--tile) * -0.10) calc(var(--tile) * 0.18); rotate: -5deg; }
}
@keyframes float-4 {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: calc(var(--tile) * -0.20) calc(var(--tile) * 0.08); rotate: 25deg; }
    50% { translate: calc(var(--tile) * -0.06) calc(var(--tile) * -0.20); rotate: 10deg; }
    75% { translate: calc(var(--tile) * 0.16) calc(var(--tile) * -0.10); rotate: -20deg; }
}
@keyframes float-5 {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: calc(var(--tile) * 0.14) calc(var(--tile) * 0.18); rotate: -20deg; }
    50% { translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.06); rotate: 5deg; }
    75% { translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.16); rotate: 25deg; }
}

/* easter egg: a row that spells DIZZY has a cartoon dizzy spell, once: each letter spins around twice, fast
   then slowing, and wobbles unsteadily as it stops, while the tiles sway in little circles, out of step,
   as if the row can't stand up straight. The tiles' own pop, win hop and error shake come first */
.word-row.dizzy .letter:not(.pop, .celebrate, .shake) {
    animation: woozy 2.8s ease-in-out;
}
.word-row.dizzy .letter:not(.pop) .letter-text {
    animation: dizzy-spin 2.8s ease-out;
}
.word-row.dizzy .letter:nth-child(2):not(.pop, .celebrate, .shake),
.word-row.dizzy .letter:nth-child(2):not(.pop) .letter-text { animation-delay: 80ms; }
.word-row.dizzy .letter:nth-child(3):not(.pop, .celebrate, .shake),
.word-row.dizzy .letter:nth-child(3):not(.pop) .letter-text { animation-delay: 160ms; }
.word-row.dizzy .letter:nth-child(4):not(.pop, .celebrate, .shake),
.word-row.dizzy .letter:nth-child(4):not(.pop) .letter-text { animation-delay: 240ms; }
.word-row.dizzy .letter:nth-child(5):not(.pop, .celebrate, .shake),
.word-row.dizzy .letter:nth-child(5):not(.pop) .letter-text { animation-delay: 320ms; }
@keyframes dizzy-spin {
    0% { rotate: 0deg; }
    45% { rotate: 720deg; }
    55% { rotate: 738deg; }
    65% { rotate: 706deg; }
    75% { rotate: 730deg; }
    85% { rotate: 713deg; }
    100% { rotate: 720deg; }
}
@keyframes woozy {
    0%, 100% { translate: 0 0; rotate: 0deg; }
    12% { translate: 0 -4px; rotate: -3deg; }
    25% { translate: 4px 0; rotate: 3deg; }
    37% { translate: 0 4px; rotate: -3deg; }
    50% { translate: -4px 0; rotate: 3deg; }
    62% { translate: 0 -3px; rotate: -2deg; }
    75% { translate: 2px 0; rotate: 2deg; }
    87% { translate: 0 1px; rotate: -1deg; }
}

/* easter egg: a row that spells DROOP sags like a clothesline under too much weight: the end tiles stay up,
   the middle hangs lowest, and each tile tips to follow the line's slope. It eases into the sag and stays.
   translate and rotate are the separate properties, so they add to the tiles' own transforms */
.word-row.droop .letter {
    transition: transform 120ms ease-out, box-shadow 120ms ease-out,
                translate 900ms cubic-bezier(.3, 1.3, .5, 1), rotate 900ms cubic-bezier(.3, 1.3, .5, 1);
}
.word-row.droop .letter:nth-child(1) { rotate: 7deg; }
.word-row.droop .letter:nth-child(2) { translate: 0 calc(var(--tile) * 0.1); rotate: 4deg; }
.word-row.droop .letter:nth-child(3) { translate: 0 calc(var(--tile) * 0.15); }
.word-row.droop .letter:nth-child(4) { translate: 0 calc(var(--tile) * 0.1); rotate: -4deg; }
.word-row.droop .letter:nth-child(5) { rotate: -7deg; }

/* easter egg: a row that spells JUMPY hops like jumping beans, once: each letter jumps three times at its own
   uneven rhythm, crouching before each jump, stretching as it leaves, clearing the top of its tile, and
   squashing when it lands. Heights are a share of the tile's size; the squash pivots on the letter's feet.
   translate and scale are the separate properties; the letter's pop-in plays first */
.word-row.jumpy .letter-text {
    transform-origin: 50% 100%;
}
.word-row.jumpy .letter:nth-child(1):not(.pop) .letter-text { animation: jumpy-1 2.8s ease-in-out; }
.word-row.jumpy .letter:nth-child(2):not(.pop) .letter-text { animation: jumpy-2 2.8s ease-in-out; }
.word-row.jumpy .letter:nth-child(3):not(.pop) .letter-text { animation: jumpy-3 2.8s ease-in-out; }
.word-row.jumpy .letter:nth-child(4):not(.pop) .letter-text { animation: jumpy-4 2.8s ease-in-out; }
.word-row.jumpy .letter:nth-child(5):not(.pop) .letter-text { animation: jumpy-5 2.8s ease-in-out; }
@keyframes jumpy-1 {
    0%, 100% { translate: 0 0; scale: 1; }
    2.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    6.6% { translate: 0 calc(var(--tile) * -0.270); scale: 0.88 1.18; }
    11% { translate: 0 calc(var(--tile) * -0.450); scale: 1 1; }
    16.5% { translate: 0 calc(var(--tile) * -0.158); scale: 0.92 1.1; }
    19.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    22% { translate: 0 0; scale: 1; }
    32.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    36.6% { translate: 0 calc(var(--tile) * -0.180); scale: 0.88 1.18; }
    41% { translate: 0 calc(var(--tile) * -0.300); scale: 1 1; }
    46.5% { translate: 0 calc(var(--tile) * -0.105); scale: 0.92 1.1; }
    49.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    52% { translate: 0 0; scale: 1; }
    64.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    68.6% { translate: 0 calc(var(--tile) * -0.120); scale: 0.88 1.18; }
    73% { translate: 0 calc(var(--tile) * -0.200); scale: 1 1; }
    78.5% { translate: 0 calc(var(--tile) * -0.070); scale: 0.92 1.1; }
    81.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    84% { translate: 0 0; scale: 1; }
}
@keyframes jumpy-2 {
    0%, 100% { translate: 0 0; scale: 1; }
    12.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    16.6% { translate: 0 calc(var(--tile) * -0.210); scale: 0.88 1.18; }
    21% { translate: 0 calc(var(--tile) * -0.350); scale: 1 1; }
    26.5% { translate: 0 calc(var(--tile) * -0.122); scale: 0.92 1.1; }
    29.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    32% { translate: 0 0; scale: 1; }
    38.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    42.6% { translate: 0 calc(var(--tile) * -0.252); scale: 0.88 1.18; }
    47% { translate: 0 calc(var(--tile) * -0.420); scale: 1 1; }
    52.5% { translate: 0 calc(var(--tile) * -0.147); scale: 0.92 1.1; }
    55.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    58% { translate: 0 0; scale: 1; }
    64.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    68.6% { translate: 0 calc(var(--tile) * -0.090); scale: 0.88 1.18; }
    73% { translate: 0 calc(var(--tile) * -0.150); scale: 1 1; }
    78.5% { translate: 0 calc(var(--tile) * -0.052); scale: 0.92 1.1; }
    81.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    84% { translate: 0 0; scale: 1; }
}
@keyframes jumpy-3 {
    0%, 100% { translate: 0 0; scale: 1; }
    7.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    11.6% { translate: 0 calc(var(--tile) * -0.300); scale: 0.88 1.18; }
    16% { translate: 0 calc(var(--tile) * -0.500); scale: 1 1; }
    21.5% { translate: 0 calc(var(--tile) * -0.175); scale: 0.92 1.1; }
    24.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    27% { translate: 0 0; scale: 1; }
    44.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    48.6% { translate: 0 calc(var(--tile) * -0.150); scale: 0.88 1.18; }
    53% { translate: 0 calc(var(--tile) * -0.250); scale: 1 1; }
    58.5% { translate: 0 calc(var(--tile) * -0.087); scale: 0.92 1.1; }
    61.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    64% { translate: 0 0; scale: 1; }
    72.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    76.6% { translate: 0 calc(var(--tile) * -0.120); scale: 0.88 1.18; }
    81% { translate: 0 calc(var(--tile) * -0.200); scale: 1 1; }
    86.5% { translate: 0 calc(var(--tile) * -0.070); scale: 0.92 1.1; }
    89.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    92% { translate: 0 0; scale: 1; }
}
@keyframes jumpy-4 {
    0%, 100% { translate: 0 0; scale: 1; }
    20.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    24.6% { translate: 0 calc(var(--tile) * -0.180); scale: 0.88 1.18; }
    29% { translate: 0 calc(var(--tile) * -0.300); scale: 1 1; }
    34.5% { translate: 0 calc(var(--tile) * -0.105); scale: 0.92 1.1; }
    37.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    40% { translate: 0 0; scale: 1; }
    44.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    48.6% { translate: 0 calc(var(--tile) * -0.270); scale: 0.88 1.18; }
    53% { translate: 0 calc(var(--tile) * -0.450); scale: 1 1; }
    58.5% { translate: 0 calc(var(--tile) * -0.158); scale: 0.92 1.1; }
    61.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    64% { translate: 0 0; scale: 1; }
    70.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    74.6% { translate: 0 calc(var(--tile) * -0.108); scale: 0.88 1.18; }
    79% { translate: 0 calc(var(--tile) * -0.180); scale: 1 1; }
    84.5% { translate: 0 calc(var(--tile) * -0.063); scale: 0.92 1.1; }
    87.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    90% { translate: 0 0; scale: 1; }
}
@keyframes jumpy-5 {
    0%, 100% { translate: 0 0; scale: 1; }
    4.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    8.6% { translate: 0 calc(var(--tile) * -0.240); scale: 0.88 1.18; }
    13% { translate: 0 calc(var(--tile) * -0.400); scale: 1 1; }
    18.5% { translate: 0 calc(var(--tile) * -0.140); scale: 0.92 1.1; }
    21.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    24% { translate: 0 0; scale: 1; }
    28.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    32.6% { translate: 0 calc(var(--tile) * -0.180); scale: 0.88 1.18; }
    37% { translate: 0 calc(var(--tile) * -0.300); scale: 1 1; }
    42.5% { translate: 0 calc(var(--tile) * -0.105); scale: 0.92 1.1; }
    45.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    48% { translate: 0 0; scale: 1; }
    54.6% { translate: 0 calc(var(--tile) * -0.000); scale: 1.15 0.82; }
    58.6% { translate: 0 calc(var(--tile) * -0.210); scale: 0.88 1.18; }
    63% { translate: 0 calc(var(--tile) * -0.350); scale: 1 1; }
    68.5% { translate: 0 calc(var(--tile) * -0.122); scale: 0.92 1.1; }
    71.4% { translate: 0 calc(var(--tile) * -0.000); scale: 1.18 0.8; }
    74% { translate: 0 0; scale: 1; }
}

/* easter egg: a row that spells AVOID has letters that dodge the pointer (Word.startAvoiding sets each letter's
   translate); this makes them slide away quickly rather than jump */
.word-row.avoid .letter-text {
    transition: translate 120ms ease-out;
}

/* easter egg: a row that spells CRAZY goes totally wild, once: for 3 s every tile flings itself around in its own
   direction, spinning and growing and shrinking, while its letter flips and spins on its own, then everything
   snaps back into place. Distances are a share of the tile's size. translate, rotate and scale are the
   separate properties; the tiles' own pop, win hop and error shake come first */
.word-row.crazy .letter:nth-child(1):not(.pop, .celebrate, .shake) { animation: crazy-tile-1 3s ease-in-out; }
.word-row.crazy .letter:nth-child(1):not(.pop) .letter-text { animation: crazy-letter-1 3s ease-in-out; }
.word-row.crazy .letter:nth-child(2):not(.pop, .celebrate, .shake) { animation: crazy-tile-2 3s ease-in-out; }
.word-row.crazy .letter:nth-child(2):not(.pop) .letter-text { animation: crazy-letter-2 3s ease-in-out; }
.word-row.crazy .letter:nth-child(3):not(.pop, .celebrate, .shake) { animation: crazy-tile-3 3s ease-in-out; }
.word-row.crazy .letter:nth-child(3):not(.pop) .letter-text { animation: crazy-letter-3 3s ease-in-out; }
.word-row.crazy .letter:nth-child(4):not(.pop, .celebrate, .shake) { animation: crazy-tile-4 3s ease-in-out; }
.word-row.crazy .letter:nth-child(4):not(.pop) .letter-text { animation: crazy-letter-4 3s ease-in-out; }
.word-row.crazy .letter:nth-child(5):not(.pop, .celebrate, .shake) { animation: crazy-tile-5 3s ease-in-out; }
.word-row.crazy .letter:nth-child(5):not(.pop) .letter-text { animation: crazy-letter-5 3s ease-in-out; }
@keyframes crazy-tile-1 {
    0% { translate: 0 0; rotate: 0deg; scale: 1; }
    17% { translate: calc(var(--tile) * -0.3) calc(var(--tile) * -0.4); rotate: -200deg; scale: 1.3; }
    33% { translate: calc(var(--tile) * 0.35) calc(var(--tile) * 0.1); rotate: -380deg; scale: 0.7; }
    50% { translate: calc(var(--tile) * -0.1) calc(var(--tile) * 0.45); rotate: -560deg; scale: 1.25; }
    67% { translate: calc(var(--tile) * 0.25) calc(var(--tile) * -0.3); rotate: -700deg; scale: 0.8; }
    83% { translate: calc(var(--tile) * -0.2) calc(var(--tile) * 0.15); rotate: -720deg; scale: 1.15; }
    100% { translate: 0 0; rotate: -720deg; scale: 1; }
}
@keyframes crazy-tile-2 {
    0% { translate: 0 0; rotate: 0deg; scale: 1; }
    17% { translate: calc(var(--tile) * 0.4) calc(var(--tile) * 0.3); rotate: 180deg; scale: 0.75; }
    33% { translate: calc(var(--tile) * -0.35) calc(var(--tile) * -0.45); rotate: 330deg; scale: 1.3; }
    50% { translate: calc(var(--tile) * 0.2) calc(var(--tile) * 0.35); rotate: 520deg; scale: 0.85; }
    67% { translate: calc(var(--tile) * -0.3) calc(var(--tile) * -0.1); rotate: 650deg; scale: 1.2; }
    83% { translate: calc(var(--tile) * 0.1) calc(var(--tile) * -0.25); rotate: 720deg; scale: 0.9; }
    100% { translate: 0 0; rotate: 720deg; scale: 1; }
}
@keyframes crazy-tile-3 {
    0% { translate: 0 0; rotate: 0deg; scale: 1; }
    17% { translate: calc(var(--tile) * 0) calc(var(--tile) * -0.6); rotate: 90deg; scale: 1.35; }
    33% { translate: calc(var(--tile) * 0.3) calc(var(--tile) * 0.3); rotate: -120deg; scale: 0.7; }
    50% { translate: calc(var(--tile) * -0.4) calc(var(--tile) * -0.2); rotate: 200deg; scale: 1.2; }
    67% { translate: calc(var(--tile) * 0.15) calc(var(--tile) * 0.4); rotate: -60deg; scale: 0.8; }
    83% { translate: calc(var(--tile) * -0.1) calc(var(--tile) * -0.3); rotate: 0deg; scale: 1.1; }
    100% { translate: 0 0; rotate: 0deg; scale: 1; }
}
@keyframes crazy-tile-4 {
    0% { translate: 0 0; rotate: 0deg; scale: 1; }
    17% { translate: calc(var(--tile) * -0.45) calc(var(--tile) * 0.2); rotate: -150deg; scale: 0.8; }
    33% { translate: calc(var(--tile) * 0.3) calc(var(--tile) * -0.5); rotate: 90deg; scale: 1.25; }
    50% { translate: calc(var(--tile) * -0.15) calc(var(--tile) * 0.4); rotate: -300deg; scale: 0.75; }
    67% { translate: calc(var(--tile) * 0.4) calc(var(--tile) * -0.15); rotate: -180deg; scale: 1.3; }
    83% { translate: calc(var(--tile) * -0.2) calc(var(--tile) * 0.1); rotate: -360deg; scale: 0.9; }
    100% { translate: 0 0; rotate: -360deg; scale: 1; }
}
@keyframes crazy-tile-5 {
    0% { translate: 0 0; rotate: 0deg; scale: 1; }
    17% { translate: calc(var(--tile) * 0.3) calc(var(--tile) * -0.35); rotate: 240deg; scale: 1.25; }
    33% { translate: calc(var(--tile) * -0.45) calc(var(--tile) * 0.25); rotate: 420deg; scale: 0.75; }
    50% { translate: calc(var(--tile) * 0.2) calc(var(--tile) * -0.45); rotate: 600deg; scale: 1.3; }
    67% { translate: calc(var(--tile) * -0.3) calc(var(--tile) * 0.3); rotate: 690deg; scale: 0.8; }
    83% { translate: calc(var(--tile) * 0.15) calc(var(--tile) * -0.1); rotate: 720deg; scale: 1.1; }
    100% { translate: 0 0; rotate: 720deg; scale: 1; }
}
@keyframes crazy-letter-1 {
    0% { rotate: 0deg; scale: 1; }
    17% { rotate: 180deg; scale: 1.4; }
    33% { rotate: -90deg; scale: 0.6; }
    50% { rotate: 360deg; scale: 1.3; }
    67% { rotate: 540deg; scale: 0.8; }
    83% { rotate: 720deg; scale: 1; }
    100% { rotate: 720deg; scale: 1; }
}
@keyframes crazy-letter-2 {
    0% { rotate: 0deg; scale: 1; }
    17% { rotate: -270deg; scale: 0.6; }
    33% { rotate: 90deg; scale: 1.5; }
    50% { rotate: -180deg; scale: 0.7; }
    67% { rotate: -360deg; scale: 1.3; }
    83% { rotate: -360deg; scale: 1; }
    100% { rotate: -360deg; scale: 1; }
}
@keyframes crazy-letter-3 {
    0% { rotate: 0deg; scale: 1; }
    17% { rotate: 540deg; scale: 1.5; }
    33% { rotate: 270deg; scale: 0.5; }
    50% { rotate: 720deg; scale: 1.4; }
    67% { rotate: 630deg; scale: 0.7; }
    83% { rotate: 720deg; scale: 1; }
    100% { rotate: 720deg; scale: 1; }
}
@keyframes crazy-letter-4 {
    0% { rotate: 0deg; scale: 1; }
    17% { rotate: -180deg; scale: 1.3; }
    33% { rotate: -450deg; scale: 0.6; }
    50% { rotate: -270deg; scale: 1.5; }
    67% { rotate: -540deg; scale: 0.8; }
    83% { rotate: -720deg; scale: 1; }
    100% { rotate: -720deg; scale: 1; }
}
@keyframes crazy-letter-5 {
    0% { rotate: 0deg; scale: 1; }
    17% { rotate: 300deg; scale: 0.6; }
    33% { rotate: 120deg; scale: 1.5; }
    50% { rotate: 450deg; scale: 0.7; }
    67% { rotate: 270deg; scale: 1.3; }
    83% { rotate: 360deg; scale: 1; }
    100% { rotate: 360deg; scale: 1; }
}

/* easter egg: a row that spells DISCO becomes a light-up dance floor, once: for 4 s (8 beats) the tiles flash
   in a moving checkerboard, lit squares in the four game colors (never green, which is kept for winning) and
   dark squares in ink, while the letters dance, bobbing and swaying to the beat. No sound. The tiles' own pop,
   win hop and error shake come first */
.word-row.disco .letter:nth-child(1):not(.pop, .celebrate, .shake) { animation: disco-floor-1 4s step-end; }
.word-row.disco .letter:nth-child(2):not(.pop, .celebrate, .shake) { animation: disco-floor-2 4s step-end; }
.word-row.disco .letter:nth-child(3):not(.pop, .celebrate, .shake) { animation: disco-floor-3 4s step-end; }
.word-row.disco .letter:nth-child(4):not(.pop, .celebrate, .shake) { animation: disco-floor-4 4s step-end; }
.word-row.disco .letter:nth-child(5):not(.pop, .celebrate, .shake) { animation: disco-floor-5 4s step-end; }
.word-row.disco .letter:not(.pop) .letter-text {
    animation: disco-dance 1s ease-in-out 4;
}
@keyframes disco-floor-1 {
    0% { background-color: var(--c1); color: var(--card); }
    12.5% { background-color: var(--ink); color: var(--card); }
    25% { background-color: var(--c2); color: var(--card); }
    37.5% { background-color: var(--ink); color: var(--card); }
    50% { background-color: var(--c3); color: var(--card); }
    62.5% { background-color: var(--ink); color: var(--card); }
    75% { background-color: var(--c4); color: var(--card); }
    87.5% { background-color: var(--ink); color: var(--card); }
    100% { background-color: var(--card); color: var(--ink); }
}
@keyframes disco-floor-2 {
    0% { background-color: var(--ink); color: var(--card); }
    12.5% { background-color: var(--c2); color: var(--card); }
    25% { background-color: var(--ink); color: var(--card); }
    37.5% { background-color: var(--c3); color: var(--card); }
    50% { background-color: var(--ink); color: var(--card); }
    62.5% { background-color: var(--c4); color: var(--card); }
    75% { background-color: var(--ink); color: var(--card); }
    87.5% { background-color: var(--c1); color: var(--card); }
    100% { background-color: var(--card); color: var(--ink); }
}
@keyframes disco-floor-3 {
    0% { background-color: var(--c3); color: var(--card); }
    12.5% { background-color: var(--ink); color: var(--card); }
    25% { background-color: var(--c4); color: var(--card); }
    37.5% { background-color: var(--ink); color: var(--card); }
    50% { background-color: var(--c1); color: var(--card); }
    62.5% { background-color: var(--ink); color: var(--card); }
    75% { background-color: var(--c2); color: var(--card); }
    87.5% { background-color: var(--ink); color: var(--card); }
    100% { background-color: var(--card); color: var(--ink); }
}
@keyframes disco-floor-4 {
    0% { background-color: var(--ink); color: var(--card); }
    12.5% { background-color: var(--c4); color: var(--card); }
    25% { background-color: var(--ink); color: var(--card); }
    37.5% { background-color: var(--c1); color: var(--card); }
    50% { background-color: var(--ink); color: var(--card); }
    62.5% { background-color: var(--c2); color: var(--card); }
    75% { background-color: var(--ink); color: var(--card); }
    87.5% { background-color: var(--c3); color: var(--card); }
    100% { background-color: var(--card); color: var(--ink); }
}
@keyframes disco-floor-5 {
    0% { background-color: var(--c1); color: var(--card); }
    12.5% { background-color: var(--ink); color: var(--card); }
    25% { background-color: var(--c2); color: var(--card); }
    37.5% { background-color: var(--ink); color: var(--card); }
    50% { background-color: var(--c3); color: var(--card); }
    62.5% { background-color: var(--ink); color: var(--card); }
    75% { background-color: var(--c4); color: var(--card); }
    87.5% { background-color: var(--ink); color: var(--card); }
    100% { background-color: var(--card); color: var(--ink); }
}
@keyframes disco-dance {
    0%, 50%, 100% { translate: 0 0; rotate: 0deg; }
    25% { translate: 0 calc(var(--tile) * -0.1); rotate: -9deg; }
    75% { translate: 0 calc(var(--tile) * -0.1); rotate: 9deg; }
}

/* easter egg: a row that spells BEEFY bulks its letters up past the font's heaviest weight: each is stretched
   wider and a little taller and outlined in its own color, so the strokes thicken, and it stays that way while
   the word is there. When the word appears the letters flex: they swell, ease off, pump once more and settle.
   scale is the separate property; the letter's pop-in plays first */
.word-row.beefy .letter-text {
    scale: 1.3 1.12;
    -webkit-text-stroke: 0.07em currentColor;
}
.word-row.beefy .letter:not(.pop) .letter-text {
    animation: beefy-flex 900ms ease-out;
}
@keyframes beefy-flex {
    0% { scale: 1; }
    30% { scale: 1.6 1.35; }
    50% { scale: 1.2 1.05; }
    70% { scale: 1.45 1.22; }
    100% { scale: 1.3 1.12; }
}

/* easter egg: a row that spells BATTY ("bats in the belfry") turns its letters into roosting bats: each turns over
   in place, rises to hang by its feet from the top of its tile, sways a few times, a little out of step, then
   hangs still while the word is there. Everything pivots on the letter's feet (the bottom of its box), so the
   flip moves the letter along as it turns to keep it in place, and the sway swings from the feet. A letter
   still popping in waits for that first. translate and rotate are the separate properties */
.word-row.batty .letter:not(.pop) .letter-text {
    transform-origin: 50% 100%;
    rotate: 180deg;
    translate: 0 calc(var(--tile) * -0.64);
    animation: bat-flip 600ms linear, bat-sway 1.6s ease-in-out 700ms 3;
}
.word-row.batty .letter:nth-child(2):not(.pop) .letter-text { animation-delay: 60ms, 830ms; }
.word-row.batty .letter:nth-child(3):not(.pop) .letter-text { animation-delay: 30ms, 760ms; }
.word-row.batty .letter:nth-child(4):not(.pop) .letter-text { animation-delay: 90ms, 900ms; }
.word-row.batty .letter:nth-child(5):not(.pop) .letter-text { animation-delay: 20ms, 720ms; }
@keyframes bat-flip {
    0% { rotate: 0deg; translate: calc(var(--tile) * -0.000) calc(var(--tile) * 0.000); }
    12% { rotate: 30deg; translate: calc(var(--tile) * -0.125) calc(var(--tile) * -0.033); }
    23% { rotate: 60deg; translate: calc(var(--tile) * -0.217) calc(var(--tile) * -0.125); }
    35% { rotate: 90deg; translate: calc(var(--tile) * -0.250) calc(var(--tile) * -0.250); }
    47% { rotate: 120deg; translate: calc(var(--tile) * -0.217) calc(var(--tile) * -0.375); }
    58% { rotate: 150deg; translate: calc(var(--tile) * -0.125) calc(var(--tile) * -0.467); }
    70% { rotate: 180deg; translate: calc(var(--tile) * -0.000) calc(var(--tile) * -0.500); }
    100% { rotate: 180deg; translate: 0 calc(var(--tile) * -0.64); }
}
@keyframes bat-sway {
    0%, 100% { rotate: 180deg; }
    25% { rotate: 190deg; }
    75% { rotate: 170deg; }
}

/* easter egg: a row that spells PIANO becomes a little keyboard that plays itself, once (4 s, no sound): the
   tiles turn into white keys with their letters low like key labels, black keys drop in across the top of the
   gaps (between keys 1-2, 2-3 and 4-5, never 3-4, like C D E F G on a real piano), and the keys press down to
   an uneven tune, chords and a run, ending on a chord, each press squashing the key's shadow and sending a ♪
   or ♫ floating up. Then everything goes back. The keyframes (when each key is pressed) are generated: see
   docs/architecture.md. --key-up cancels a given or selected tile's own offset, so every key starts level.
   A letter popping in keeps its pop alongside */
.word-row.piano {
    position: relative;
}
.word-row.piano .letter { --key-up: 0px; }
.word-row.piano .letter.given:not(.paused) { --key-up: -3px; }
.word-row.piano .letter.selected { --key-up: 3px; }
.word-row.piano .letter:nth-child(1):not(.celebrate, .shake) { animation: piano-key-1 4s linear; }
.word-row.piano .letter:nth-child(2):not(.celebrate, .shake) { animation: piano-key-2 4s linear; }
.word-row.piano .letter:nth-child(3):not(.celebrate, .shake) { animation: piano-key-3 4s linear; }
.word-row.piano .letter:nth-child(4):not(.celebrate, .shake) { animation: piano-key-4 4s linear; }
.word-row.piano .letter:nth-child(5):not(.celebrate, .shake) { animation: piano-key-5 4s linear; }
.word-row.piano .letter.pop:nth-child(1):not(.celebrate, .shake) { animation: bump 260ms ease-out var(--pop-delay, 0ms), piano-key-1 4s linear; }
.word-row.piano .letter.pop:nth-child(2):not(.celebrate, .shake) { animation: bump 260ms ease-out var(--pop-delay, 0ms), piano-key-2 4s linear; }
.word-row.piano .letter.pop:nth-child(3):not(.celebrate, .shake) { animation: bump 260ms ease-out var(--pop-delay, 0ms), piano-key-3 4s linear; }
.word-row.piano .letter.pop:nth-child(4):not(.celebrate, .shake) { animation: bump 260ms ease-out var(--pop-delay, 0ms), piano-key-4 4s linear; }
.word-row.piano .letter.pop:nth-child(5):not(.celebrate, .shake) { animation: bump 260ms ease-out var(--pop-delay, 0ms), piano-key-5 4s linear; }
/* the color shapes would sit under the black keys: they step aside while it plays */
.word-row.piano .letter::before {
    animation: piano-hide 4s linear;
}
@keyframes piano-hide {
    7.5%, 93.75% { opacity: 0; }
}
.word-row.piano .letter-text {
    animation: piano-label 4s ease-in-out;
}
.word-row.piano .letter.pop .letter-text {
    animation: pop-in 300ms cubic-bezier(.3, 1.6, .5, 1) var(--pop-delay, 0ms) backwards, piano-label 4s ease-in-out;
}
@keyframes piano-label {
    7.5%, 93.75% { translate: 0 calc(var(--tile) * 0.2); scale: 0.7; }
}
/* the black keys: one key, copied to the other two gaps by its shadows */
.word-row.piano::after {
    content: '';
    position: absolute;
    z-index: 2; /* over the white keys */
    top: var(--rail-pad-start);
    left: calc(var(--rail-pad-start) + var(--tile) + var(--row-gap) / 2 - var(--tile) * 0.18);
    width: calc(var(--tile) * 0.36);
    height: calc(var(--tile) * 0.56);
    background: var(--ink);
    border-radius: 0 0 5px 5px;
    box-shadow: calc(var(--tile) + var(--row-gap)) 0 0 var(--ink), calc(3 * (var(--tile) + var(--row-gap))) 0 0 var(--ink);
    opacity: 0;
    pointer-events: none;
    animation: piano-black 4s ease-out;
}
@keyframes piano-black {
    0% { opacity: 0; translate: 0 calc(var(--tile) * -0.3); }
    7.5%, 93.75% { opacity: 1; translate: 0 0; }
    100% { opacity: 0; translate: 0 0; }
}
/* the notes: each tile's two (♪ and ♫, drawn as text, not emoji) take turns floating up from its presses */
.word-row.piano .letter-extra {
    display: block;
    position: absolute;
    left: 50%;
    top: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.word-row.piano .letter-extra::before, .word-row.piano .letter-extra::after {
    position: absolute;
    left: 0;
    bottom: 0;
    transform: translateX(-50%);
    font-family: var(--ui-font);
    font-weight: 700;
    font-size: calc(var(--tile) * 0.4);
    line-height: 1;
    color: var(--ink);
    opacity: 0;
}
.word-row.piano .letter-extra::before { content: '\266A\FE0E'; }
.word-row.piano .letter-extra::after { content: '\266B\FE0E'; }
.word-row.piano .letter:nth-child(1) .letter-extra::before { animation: piano-note-1a 4s ease-out; }
.word-row.piano .letter:nth-child(1) .letter-extra::after { animation: piano-note-1b 4s ease-out; }
.word-row.piano .letter:nth-child(2) .letter-extra::before { animation: piano-note-2a 4s ease-out; }
.word-row.piano .letter:nth-child(2) .letter-extra::after { animation: piano-note-2b 4s ease-out; }
.word-row.piano .letter:nth-child(3) .letter-extra::before { animation: piano-note-3a 4s ease-out; }
.word-row.piano .letter:nth-child(3) .letter-extra::after { animation: piano-note-3b 4s ease-out; }
.word-row.piano .letter:nth-child(4) .letter-extra::before { animation: piano-note-4a 4s ease-out; }
.word-row.piano .letter:nth-child(4) .letter-extra::after { animation: piano-note-4b 4s ease-out; }
.word-row.piano .letter:nth-child(5) .letter-extra::before { animation: piano-note-5a 4s ease-out; }
.word-row.piano .letter:nth-child(5) .letter-extra::after { animation: piano-note-5b 4s ease-out; }
@keyframes piano-key-1 {
    0% { translate: var(--key-up) var(--key-up); }
    5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    7.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    8.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    11.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    14% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    42.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    43.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    46.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    49% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    70% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    71% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    74.25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    76.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    77.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    78.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    84.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    87% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    93.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    100% { translate: var(--key-up) var(--key-up); }
}
@keyframes piano-key-2 {
    0% { translate: var(--key-up) var(--key-up); }
    5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    13% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    14% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    17.25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    19.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    32.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    33.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    36.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    39% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    66.25% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    67.25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    70.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    72.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    93.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    100% { translate: var(--key-up) var(--key-up); }
}
@keyframes piano-key-3 {
    0% { translate: var(--key-up) var(--key-up); }
    5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    18.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    19.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    22.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    25% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    42.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    43.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    46.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    49% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    62.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    63.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    66.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    69% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    77.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    78.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    84.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    87% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    93.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    100% { translate: var(--key-up) var(--key-up); }
}
@keyframes piano-key-4 {
    0% { translate: var(--key-up) var(--key-up); }
    5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    32.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    33.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    36.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    39% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    58.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    59.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    63% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    65.25% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    93.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    100% { translate: var(--key-up) var(--key-up); }
}
@keyframes piano-key-5 {
    0% { translate: var(--key-up) var(--key-up); }
    5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    24% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    28.25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    30.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    42.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    43.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    46.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    49% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    55% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    56% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    59.25% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    61.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    77.5% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    78.5% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    84.75% { translate: calc(var(--key-up) + 3px) calc(var(--key-up) + 3px); box-shadow: 0 0 0 var(--ink); background-color: #ebe6dc; }
    87% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    93.75% { translate: var(--key-up) var(--key-up); box-shadow: 3px 3px 0 var(--ink); background-color: var(--card); }
    100% { translate: var(--key-up) var(--key-up); }
}
@keyframes piano-note-1a {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    8.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    8.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    19.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    27.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    70.97% { opacity: 0; translate: 0 0; rotate: 0deg; }
    71% { opacity: 1; translate: 0 0; rotate: 0deg; }
    82.25% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    89.75% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-1b {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    54.75% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    62.25% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    78.47% { opacity: 0; translate: 0 0; rotate: 0deg; }
    78.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    89.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    97.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-2a {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    13.98% { opacity: 0; translate: 0 0; rotate: 0deg; }
    14% { opacity: 1; translate: 0 0; rotate: 0deg; }
    25.25% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    32.75% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    67.22% { opacity: 0; translate: 0 0; rotate: 0deg; }
    67.25% { opacity: 1; translate: 0 0; rotate: 0deg; }
    78.5% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    86% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-2b {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    33.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    33.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    44.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    52.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-3a {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    19.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    19.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    30.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    38.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    63.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    63.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    74.75% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    82.25% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-3b {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    54.75% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    62.25% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    78.47% { opacity: 0; translate: 0 0; rotate: 0deg; }
    78.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    89.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    97.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-4a {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    33.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    33.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    44.75% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    52.25% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-4b {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    59.72% { opacity: 0; translate: 0 0; rotate: 0deg; }
    59.75% { opacity: 1; translate: 0 0; rotate: 0deg; }
    71% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    78.5% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-5a {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    24.98% { opacity: 0; translate: 0 0; rotate: 0deg; }
    25% { opacity: 1; translate: 0 0; rotate: 0deg; }
    36.25% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    43.75% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    55.97% { opacity: 0; translate: 0 0; rotate: 0deg; }
    56% { opacity: 1; translate: 0 0; rotate: 0deg; }
    67.25% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    74.75% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    100% { opacity: 0; }
}
@keyframes piano-note-5b {
    0% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.48% { opacity: 0; translate: 0 0; rotate: 0deg; }
    43.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    54.75% { opacity: 1; translate: calc(var(--tile) * -0.12) calc(var(--tile) * -0.45); rotate: -12deg; }
    62.25% { opacity: 0; translate: calc(var(--tile) * -0.20) calc(var(--tile) * -0.7); rotate: -20deg; }
    78.47% { opacity: 0; translate: 0 0; rotate: 0deg; }
    78.5% { opacity: 1; translate: 0 0; rotate: 0deg; }
    89.75% { opacity: 1; translate: calc(var(--tile) * 0.12) calc(var(--tile) * -0.45); rotate: 12deg; }
    97.25% { opacity: 0; translate: calc(var(--tile) * 0.20) calc(var(--tile) * -0.7); rotate: 20deg; }
    100% { opacity: 0; }
}

/* easter egg: a row that spells PLUCK twangs like a plucked guitar string. The motion is computed in
   Word.pluck; while it plays (.plucking), the link bar is swapped for one short link per gap, each the
   .letter-extra of the tile on its left, which the animation stretches and turns */
body.row-links .word-row.plucking::before {
    visibility: hidden;
}
body.row-links .word-row.plucking .letter:nth-child(-n+4) .letter-extra {
    display: block;
    position: absolute;
    left: calc(100% + var(--border));
    top: calc(50% - 3px);
    width: var(--row-gap);
    height: 6px;
    background: var(--ink);
    transform-origin: 0 50%;
    pointer-events: none;
}

/* easter egg: a row that spells BUGGY glitches out, once (2 s): in three uneven bursts the tiles jerk sideways
   and tear (a slice clipped away), the letters split into red and blue copies like a broken screen, and for a
   frame here and there a tile shows a junk character or turns into a solid ink block, while the whole row
   jumps. Every change is a hard cut (step-end), with nothing in between. The keyframes were generated with
   a fixed random seed, so it glitches the same way every time. The tiles' own pop, win hop and error shake
   come first */
.word-row.buggy {
    animation: glitch-row 2s step-end;
}
.word-row.buggy .letter:nth-child(1):not(.pop, .celebrate, .shake) { animation: glitch-tile-1 2s step-end; }
.word-row.buggy .letter:nth-child(2):not(.pop, .celebrate, .shake) { animation: glitch-tile-2 2s step-end; }
.word-row.buggy .letter:nth-child(3):not(.pop, .celebrate, .shake) { animation: glitch-tile-3 2s step-end; }
.word-row.buggy .letter:nth-child(4):not(.pop, .celebrate, .shake) { animation: glitch-tile-4 2s step-end; }
.word-row.buggy .letter:nth-child(5):not(.pop, .celebrate, .shake) { animation: glitch-tile-5 2s step-end; }
.word-row.buggy .letter:nth-child(1):not(.pop) .letter-text { animation: glitch-text-1 2s step-end; }
.word-row.buggy .letter:nth-child(2):not(.pop) .letter-text { animation: glitch-text-2 2s step-end; }
.word-row.buggy .letter:nth-child(3):not(.pop) .letter-text { animation: glitch-text-3 2s step-end; }
.word-row.buggy .letter:nth-child(4):not(.pop) .letter-text { animation: glitch-text-4 2s step-end; }
.word-row.buggy .letter:nth-child(5):not(.pop) .letter-text { animation: glitch-text-5 2s step-end; }
/* the junk character or ink block covers the tile (each tile's .letter-extra) */
.word-row.buggy .letter-extra {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.word-row.buggy .letter-extra::before {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - var(--border));
    opacity: 0;
}
.word-row.buggy .letter:nth-child(1) .letter-extra::before { animation: glitch-block-1 2s step-end; }
.word-row.buggy .letter:nth-child(2) .letter-extra::before { animation: glitch-block-2 2s step-end; }
.word-row.buggy .letter:nth-child(3) .letter-extra::before { animation: glitch-block-3 2s step-end; }
.word-row.buggy .letter:nth-child(4) .letter-extra::before { animation: glitch-block-4 2s step-end; }
.word-row.buggy .letter:nth-child(5) .letter-extra::before { animation: glitch-block-5 2s step-end; }
.word-row.buggy .letter:nth-child(1) .letter-extra::before { content: '#'; }
.word-row.buggy .letter:nth-child(2) .letter-extra::before { content: '%'; }
.word-row.buggy .letter:nth-child(3) .letter-extra::before { content: '&'; }
.word-row.buggy .letter:nth-child(4) .letter-extra::before { content: '@'; }
.word-row.buggy .letter:nth-child(5) .letter-extra::before { content: '?'; }
@keyframes glitch-tile-1 {
    0% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    1.4% { translate: 5px 2px; clip-path: inset(-20% -20% -20% -20%); }
    5% { translate: 3px 0px; clip-path: inset(30% -20% 0% -20%); }
    8.9% { translate: 3px 2px; clip-path: inset(-20% -20% -20% -20%); }
    12.55% { translate: -7px -2px; clip-path: inset(15% -20% 35% -20%); }
    15.95% { translate: 5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    19.25% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    39.45% { translate: 7px 0px; clip-path: inset(-20% -20% -20% -20%); }
    43.7% { translate: -3px 0px; clip-path: inset(-20% -20% -20% -20%); }
    47.5% { translate: -7px 2px; clip-path: inset(30% -20% 20% -20%); }
    50.65% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    73.95% { translate: -7px 2px; clip-path: inset(-20% -20% -20% -20%); }
    78% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    100% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes glitch-text-1 {
    0% { translate: 0 0; opacity: 1; text-shadow: none; }
    1.4% { translate: 0 0; opacity: 0; text-shadow: none; }
    5% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    8.9% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    12.55% { translate: 2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    15.95% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    19.25% { translate: 0 0; opacity: 1; text-shadow: none; }
    39.45% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    43.7% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    47.5% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    50.65% { translate: 0 0; opacity: 1; text-shadow: none; }
    73.95% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    78% { translate: 0 0; opacity: 1; text-shadow: none; }
    100% { translate: 0 0; opacity: 1; text-shadow: none; }
}
@keyframes glitch-block-1 {
    0% { opacity: 0; background-color: transparent; color: var(--ink); }
    1.4% { opacity: 1; background-color: var(--ink); color: var(--card); }
    5% { opacity: 0; background-color: transparent; color: var(--ink); }
    8.9% { opacity: 0; background-color: transparent; color: var(--ink); }
    12.55% { opacity: 0; background-color: transparent; color: var(--ink); }
    15.95% { opacity: 0; background-color: transparent; color: var(--ink); }
    19.25% { opacity: 0; background-color: transparent; color: var(--ink); }
    39.45% { opacity: 0; background-color: transparent; color: var(--ink); }
    43.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    47.5% { opacity: 0; background-color: transparent; color: var(--ink); }
    50.65% { opacity: 0; background-color: transparent; color: var(--ink); }
    73.95% { opacity: 0; background-color: transparent; color: var(--ink); }
    78% { opacity: 0; background-color: transparent; color: var(--ink); }
    100% { opacity: 0; background-color: transparent; color: var(--ink); }
}
@keyframes glitch-tile-2 {
    0% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    0.6% { translate: 7px 0px; clip-path: inset(-20% -20% -20% -20%); }
    5% { translate: -7px 0px; clip-path: inset(0% -20% 0% -20%); }
    7.55% { translate: 7px 0px; clip-path: inset(-20% -20% -20% -20%); }
    10.85% { translate: 7px 2px; clip-path: inset(45% -20% 0% -20%); }
    14.7% { translate: -3px -2px; clip-path: inset(45% -20% 35% -20%); }
    17.15% { translate: -5px 2px; clip-path: inset(30% -20% 20% -20%); }
    19.65% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    39.85% { translate: 7px 0px; clip-path: inset(30% -20% 20% -20%); }
    43.65% { translate: -5px 2px; clip-path: inset(15% -20% 20% -20%); }
    47.95% { translate: -5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    51.5% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    72.9% { translate: -7px 2px; clip-path: inset(0% -20% 0% -20%); }
    77.25% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    100% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes glitch-text-2 {
    0% { translate: 0 0; opacity: 1; text-shadow: none; }
    0.6% { translate: 3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    5% { translate: 3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    7.55% { translate: -2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    10.85% { translate: 0 0; opacity: 0; text-shadow: none; }
    14.7% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    17.15% { translate: 0 0; opacity: 0; text-shadow: none; }
    19.65% { translate: 0 0; opacity: 1; text-shadow: none; }
    39.85% { translate: 3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    43.65% { translate: -2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    47.95% { translate: 0 0; opacity: 0; text-shadow: none; }
    51.5% { translate: 0 0; opacity: 1; text-shadow: none; }
    72.9% { translate: -2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    77.25% { translate: 0 0; opacity: 1; text-shadow: none; }
    100% { translate: 0 0; opacity: 1; text-shadow: none; }
}
@keyframes glitch-block-2 {
    0% { opacity: 0; background-color: transparent; color: var(--ink); }
    0.6% { opacity: 0; background-color: transparent; color: var(--ink); }
    5% { opacity: 0; background-color: transparent; color: var(--ink); }
    7.55% { opacity: 0; background-color: transparent; color: var(--ink); }
    10.85% { opacity: 1; background-color: var(--ink); color: var(--card); }
    14.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    17.15% { opacity: 1; background-color: transparent; color: var(--ink); }
    19.65% { opacity: 0; background-color: transparent; color: var(--ink); }
    39.85% { opacity: 0; background-color: transparent; color: var(--ink); }
    43.65% { opacity: 0; background-color: transparent; color: var(--ink); }
    47.95% { opacity: 1; background-color: var(--ink); color: var(--card); }
    51.5% { opacity: 0; background-color: transparent; color: var(--ink); }
    72.9% { opacity: 0; background-color: transparent; color: var(--ink); }
    77.25% { opacity: 0; background-color: transparent; color: var(--ink); }
    100% { opacity: 0; background-color: transparent; color: var(--ink); }
}
@keyframes glitch-tile-3 {
    0% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    0.8% { translate: 3px 2px; clip-path: inset(15% -20% 35% -20%); }
    4.3% { translate: 5px -2px; clip-path: inset(15% -20% 35% -20%); }
    7.6% { translate: 3px 0px; clip-path: inset(15% -20% 20% -20%); }
    9.85% { translate: -3px 0px; clip-path: inset(-20% -20% -20% -20%); }
    13.7% { translate: -7px -2px; clip-path: inset(-20% -20% -20% -20%); }
    15.75% { translate: 5px -2px; clip-path: inset(-20% -20% -20% -20%); }
    17.95% { translate: -7px 2px; clip-path: inset(-20% -20% -20% -20%); }
    19.4% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    40.5% { translate: -3px 0px; clip-path: inset(45% -20% 0% -20%); }
    44.05% { translate: 5px -2px; clip-path: inset(-20% -20% -20% -20%); }
    47.95% { translate: -7px -2px; clip-path: inset(0% -20% 20% -20%); }
    51.85% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    72.45% { translate: 3px 2px; clip-path: inset(-20% -20% -20% -20%); }
    75.4% { translate: 5px -2px; clip-path: inset(-20% -20% -20% -20%); }
    77.95% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    100% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes glitch-text-3 {
    0% { translate: 0 0; opacity: 1; text-shadow: none; }
    0.8% { translate: 0 0; opacity: 0; text-shadow: none; }
    4.3% { translate: 0 0; opacity: 0; text-shadow: none; }
    7.6% { translate: -2px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    9.85% { translate: -2px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    13.7% { translate: -3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    15.75% { translate: -2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    17.95% { translate: 0 0; opacity: 0; text-shadow: none; }
    19.4% { translate: 0 0; opacity: 1; text-shadow: none; }
    40.5% { translate: -3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    44.05% { translate: -3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    47.95% { translate: 3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    51.85% { translate: 0 0; opacity: 1; text-shadow: none; }
    72.45% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    75.4% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    77.95% { translate: 0 0; opacity: 1; text-shadow: none; }
    100% { translate: 0 0; opacity: 1; text-shadow: none; }
}
@keyframes glitch-block-3 {
    0% { opacity: 0; background-color: transparent; color: var(--ink); }
    0.8% { opacity: 1; background-color: transparent; color: var(--ink); }
    4.3% { opacity: 1; background-color: transparent; color: var(--ink); }
    7.6% { opacity: 0; background-color: transparent; color: var(--ink); }
    9.85% { opacity: 0; background-color: transparent; color: var(--ink); }
    13.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    15.75% { opacity: 0; background-color: transparent; color: var(--ink); }
    17.95% { opacity: 1; background-color: transparent; color: var(--ink); }
    19.4% { opacity: 0; background-color: transparent; color: var(--ink); }
    40.5% { opacity: 0; background-color: transparent; color: var(--ink); }
    44.05% { opacity: 0; background-color: transparent; color: var(--ink); }
    47.95% { opacity: 0; background-color: transparent; color: var(--ink); }
    51.85% { opacity: 0; background-color: transparent; color: var(--ink); }
    72.45% { opacity: 0; background-color: transparent; color: var(--ink); }
    75.4% { opacity: 0; background-color: transparent; color: var(--ink); }
    77.95% { opacity: 0; background-color: transparent; color: var(--ink); }
    100% { opacity: 0; background-color: transparent; color: var(--ink); }
}
@keyframes glitch-tile-4 {
    0% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    2.1% { translate: 3px 0px; clip-path: inset(-20% -20% -20% -20%); }
    5.75% { translate: -5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    8.75% { translate: 3px 0px; clip-path: inset(45% -20% 0% -20%); }
    11.4% { translate: -5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    13.9% { translate: -7px 2px; clip-path: inset(-20% -20% -20% -20%); }
    17.9% { translate: 5px 2px; clip-path: inset(-20% -20% -20% -20%); }
    19.2% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    40.65% { translate: -7px 0px; clip-path: inset(-20% -20% -20% -20%); }
    44.45% { translate: -3px 0px; clip-path: inset(-20% -20% -20% -20%); }
    46.85% { translate: 3px 2px; clip-path: inset(30% -20% 0% -20%); }
    50.3% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    73% { translate: 5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    76.8% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    100% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes glitch-text-4 {
    0% { translate: 0 0; opacity: 1; text-shadow: none; }
    2.1% { translate: -2px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    5.75% { translate: -2px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    8.75% { translate: 2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    11.4% { translate: 2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    13.9% { translate: 3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    17.9% { translate: 3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    19.2% { translate: 0 0; opacity: 1; text-shadow: none; }
    40.65% { translate: 2px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    44.45% { translate: 0 0; opacity: 0; text-shadow: none; }
    46.85% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    50.3% { translate: 0 0; opacity: 1; text-shadow: none; }
    73% { translate: 0 0; opacity: 0; text-shadow: none; }
    76.8% { translate: 0 0; opacity: 1; text-shadow: none; }
    100% { translate: 0 0; opacity: 1; text-shadow: none; }
}
@keyframes glitch-block-4 {
    0% { opacity: 0; background-color: transparent; color: var(--ink); }
    2.1% { opacity: 0; background-color: transparent; color: var(--ink); }
    5.75% { opacity: 0; background-color: transparent; color: var(--ink); }
    8.75% { opacity: 0; background-color: transparent; color: var(--ink); }
    11.4% { opacity: 0; background-color: transparent; color: var(--ink); }
    13.9% { opacity: 0; background-color: transparent; color: var(--ink); }
    17.9% { opacity: 0; background-color: transparent; color: var(--ink); }
    19.2% { opacity: 0; background-color: transparent; color: var(--ink); }
    40.65% { opacity: 0; background-color: transparent; color: var(--ink); }
    44.45% { opacity: 1; background-color: transparent; color: var(--ink); }
    46.85% { opacity: 0; background-color: transparent; color: var(--ink); }
    50.3% { opacity: 0; background-color: transparent; color: var(--ink); }
    73% { opacity: 1; background-color: var(--ink); color: var(--card); }
    76.8% { opacity: 0; background-color: transparent; color: var(--ink); }
    100% { opacity: 0; background-color: transparent; color: var(--ink); }
}
@keyframes glitch-tile-5 {
    0% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    0.55% { translate: 7px -2px; clip-path: inset(-20% -20% -20% -20%); }
    3.25% { translate: -3px 0px; clip-path: inset(-20% -20% -20% -20%); }
    6.5% { translate: 7px 0px; clip-path: inset(45% -20% 0% -20%); }
    9.7% { translate: 5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    14% { translate: 7px -2px; clip-path: inset(45% -20% 0% -20%); }
    16.8% { translate: 7px -2px; clip-path: inset(-20% -20% -20% -20%); }
    20.75% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    39.3% { translate: -3px 2px; clip-path: inset(-20% -20% -20% -20%); }
    42.65% { translate: -7px 0px; clip-path: inset(-20% -20% -20% -20%); }
    46.15% { translate: -5px 2px; clip-path: inset(-20% -20% -20% -20%); }
    50.7% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    72.4% { translate: 5px 0px; clip-path: inset(-20% -20% -20% -20%); }
    75.35% { translate: 7px 2px; clip-path: inset(-20% -20% -20% -20%); }
    77.7% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
    100% { translate: 0 0; clip-path: inset(-20% -20% -20% -20%); }
}
@keyframes glitch-text-5 {
    0% { translate: 0 0; opacity: 1; text-shadow: none; }
    0.55% { translate: -2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    3.25% { translate: -2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    6.5% { translate: -3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    9.7% { translate: -3px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    14% { translate: 2px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    16.8% { translate: 0 0; opacity: 0; text-shadow: none; }
    20.75% { translate: 0 0; opacity: 1; text-shadow: none; }
    39.3% { translate: -3px 0; opacity: 1; text-shadow: -2px 0 var(--c1), 2px 0 var(--c4); }
    42.65% { translate: -2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    46.15% { translate: -3px 0; opacity: 1; text-shadow: -3px 0 var(--c1), 3px 0 var(--c4); }
    50.7% { translate: 0 0; opacity: 1; text-shadow: none; }
    72.4% { translate: 2px 0; opacity: 1; text-shadow: -4px 0 var(--c1), 4px 0 var(--c4); }
    75.35% { translate: 0 0; opacity: 0; text-shadow: none; }
    77.7% { translate: 0 0; opacity: 1; text-shadow: none; }
    100% { translate: 0 0; opacity: 1; text-shadow: none; }
}
@keyframes glitch-block-5 {
    0% { opacity: 0; background-color: transparent; color: var(--ink); }
    0.55% { opacity: 0; background-color: transparent; color: var(--ink); }
    3.25% { opacity: 0; background-color: transparent; color: var(--ink); }
    6.5% { opacity: 0; background-color: transparent; color: var(--ink); }
    9.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    14% { opacity: 0; background-color: transparent; color: var(--ink); }
    16.8% { opacity: 1; background-color: transparent; color: var(--ink); }
    20.75% { opacity: 0; background-color: transparent; color: var(--ink); }
    39.3% { opacity: 0; background-color: transparent; color: var(--ink); }
    42.65% { opacity: 0; background-color: transparent; color: var(--ink); }
    46.15% { opacity: 0; background-color: transparent; color: var(--ink); }
    50.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    72.4% { opacity: 0; background-color: transparent; color: var(--ink); }
    75.35% { opacity: 1; background-color: var(--ink); color: var(--card); }
    77.7% { opacity: 0; background-color: transparent; color: var(--ink); }
    100% { opacity: 0; background-color: transparent; color: var(--ink); }
}
@keyframes glitch-row {
    0% { translate: 0 0; }
    3% { translate: -6px 0; }
    7% { translate: 4px 0; }
    11% { translate: 0px 0; }
    41% { translate: 5px 0; }
    45% { translate: 0px 0; }
    72% { translate: -3px 0; }
    74.5% { translate: 0px 0; }
    100% { translate: 0 0; }
}

/* easter egg: a row that spells GLASS turns its tiles into slabs of glass, for as long as the word is there:
   nearly clear, so the link bar shows through, softened by a blur (backdrop-filter); a bright edge on the
   top and left and a darker one on the bottom and right for thickness; a diagonal sheen across the face;
   colored tiles become stained glass in their own color; and the hard shadow turns see-through. When the
   word lands, a glint of light sweeps across the row once (each tile's .letter-extra). body raises the
   specificity over the given and colored tile rules */
body .word-row.glass .letter:not(.paused) {
    background-color: rgba(255, 255, 255, 0.22);
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.18) 34%,
        rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, 0) 72%, rgba(255, 255, 255, 0.2) 100%);
    -webkit-backdrop-filter: blur(2.5px) saturate(1.5);
    backdrop-filter: blur(2.5px) saturate(1.5);
    border-color: rgba(29, 27, 32, 0.55);
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.85), inset -2px -2px 0 rgba(29, 27, 32, 0.14),
        3px 3px 0 color-mix(in srgb, var(--c) 30%, transparent);
}
body .word-row.glass .letter:is(.c1, .c2, .c3, .c4):not(.paused) {
    background-color: color-mix(in srgb, var(--c) 24%, transparent);
    border-color: color-mix(in srgb, var(--c) 70%, var(--ink));
    box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.7), inset -2px -2px 0 color-mix(in srgb, var(--c) 35%, transparent),
        3px 3px 0 color-mix(in srgb, var(--c) 40%, transparent);
}
.word-row.glass .letter-text {
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.6); /* a faint catch of light under each letter */
}
/* the glint: a pale band, slanted, that slides across each tile once, a little after the one before */
.word-row.glass .letter-extra {
    display: block;
    position: absolute;
    inset: 0;
    border-radius: calc(var(--radius) - var(--border));
    overflow: hidden;
    pointer-events: none;
}
.word-row.glass .letter-extra::before {
    content: '';
    position: absolute;
    top: -20%;
    bottom: -20%;
    left: 0;
    width: 35%;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
    rotate: 20deg;
    translate: -200% 0;
    animation: glass-glint 700ms ease-in-out 150ms both;
}
.word-row.glass .letter:nth-child(2) .letter-extra::before { animation-delay: 240ms; }
.word-row.glass .letter:nth-child(3) .letter-extra::before { animation-delay: 330ms; }
.word-row.glass .letter:nth-child(4) .letter-extra::before { animation-delay: 420ms; }
.word-row.glass .letter:nth-child(5) .letter-extra::before { animation-delay: 510ms; }
@keyframes glass-glint {
    from { translate: -200% 0; }
    to { translate: 400% 0; }
}

/* the ink edge between the cube's top and right side: from the face's top-right corner up and to the
   right to the back corner (the depth is 7px, so the line is about 7 * 1.41 long) */
.letter-extra {
    display: none;
}
.word-row.cubic .letter-extra {
    display: block;
    position: absolute;
    left: calc(100% + var(--border) - 1.25px);
    bottom: calc(100% + var(--border));
    width: 2.5px;
    height: 11px;
    background: var(--ink);
    transform-origin: bottom center;
    transform: rotate(45deg);
    pointer-events: none;
}
/* easter egg: a row that spells BLINK turns its tiles into eyes: ink eyelids close from the top and bottom
   and open again, twice in quick succession, then the eyes stay open. The lids are the
   tile's extra span (covering the tile, under its rounded corners) and that span's ::before and ::after;
   their curved edges meet in the middle like real eyelids */
.word-row.blink .letter-extra {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: calc(var(--radius) - var(--border));
    overflow: hidden;
    pointer-events: none;
}
.word-row.blink .letter-extra::before, .word-row.blink .letter-extra::after {
    content: '';
    position: absolute;
    left: -10%;
    right: -10%;
    height: 0;
    background: var(--ink);
    animation: eyelid 3.6s ease-in-out;
}
.word-row.blink .letter-extra::before {
    top: 0;
    border-radius: 0 0 50% 50% / 0 0 40% 40%; /* the top lid's edge curves down in the middle */
}
.word-row.blink .letter-extra::after {
    bottom: 0;
    border-radius: 50% 50% 0 0 / 40% 40% 0 0;
}
@keyframes eyelid {
    0%, 26%, 100% { height: 0; }
    5% { height: 62%; }
    11% { height: 0; }
    16% { height: 62%; }
    22% { height: 0; }
}

.word-row.cubic .letter.c1, .word-row.cubic .letter.c2, .word-row.cubic .letter.c3, .word-row.cubic .letter.c4 {
    --side: color-mix(in srgb, var(--c) 75%, var(--ink));
}

/* easter egg: a row that spells CLONE clones its letters: each tile shows its letter twice, one above the other
   and smaller, so the word runs across the row twice, for as long as the word is there. When the word lands,
   each letter divides like a cell, one tile after another: it stretches tall, pinches, and the copy pulls
   away downward as the original rises, overshooting a little before they settle; it stays full size until it
   splits, then shrinks as the two pull apart. The copy is the letter-text's ::after (a block, so it sits on
   the line below), which reads the letter from data-letter (set in Letter.update). The letter-text is two
   lines tall, so it starts shifted down by a quarter (half a line) with the copy pulled up over the
   original: one letter, centered */
.word-row.clone .letter-text {
    font-size: 0.7em;
    text-align: center;
}
.word-row.clone .letter-text::after {
    content: attr(data-letter);
    display: block;
}
.word-row.clone .letter { --clone-delay: 125ms; } /* each tile divides a little after the one before */
.word-row.clone .letter:nth-child(2) { --clone-delay: 325ms; }
.word-row.clone .letter:nth-child(3) { --clone-delay: 525ms; }
.word-row.clone .letter:nth-child(4) { --clone-delay: 725ms; }
.word-row.clone .letter:nth-child(5) { --clone-delay: 925ms; }
.word-row.clone .letter-text {
    transform-origin: 50% 25%; /* the middle of the one letter showing at the start, so it stretches in place */
    animation: clone-divide 1350ms cubic-bezier(.3, 1.3, .5, 1) var(--clone-delay) backwards;
}
/* a letter still popping in (typed fast) divides on time too: its pop runs alongside, and the division
   keeps going when the pop ends, so it never shows the finished look early and then snaps back */
.word-row.clone .letter.pop .letter-text {
    animation: pop-in 300ms cubic-bezier(.3, 1.6, .5, 1) var(--pop-delay, 0ms) backwards,
        clone-divide 1350ms cubic-bezier(.3, 1.3, .5, 1) var(--clone-delay) backwards;
}
.word-row.clone .letter-text::after {
    animation: clone-copy 1350ms cubic-bezier(.3, 1.3, .5, 1) var(--clone-delay) backwards;
}
@keyframes clone-divide {
    0% { translate: 0 25%; scale: 1 1; font-size: 1em; }
    30% { translate: 0 25%; scale: 0.88 1.25; font-size: 1em; }   /* stretching tall */
    45% { translate: 0 20%; scale: 0.84 1.3; font-size: 1em; }    /* about to pinch */
    70% { translate: 0 0; scale: 1.04 0.96; font-size: 0.7em; }
    85% { scale: 0.99 1.02; }
    100% { translate: 0 0; scale: 1 1; }
}
@keyframes clone-copy {
    0%, 40% { translate: 0 -100%; }
    70% { translate: 0 10%; }    /* pulls away, a little too far */
    85% { translate: 0 -3%; }
    100% { translate: 0 0; }
}

/* easter egg: a row that spells REPEL pushes the rows around it away, like the same poles of two magnets: the
   nearest row on each side is shoved hard (15px) and crowds into the next, which is pushed along less (11px)
   and a moment later, and so on (8px): the gap next to the REPEL row opens wide while the rows beyond bunch up,
   like a crowd being pushed back. Each overshoots and wobbles as it finds its balance, then they hover there
   for as long as the word is there. Change the word and they spring back (the translate transition below).
   Each row works out where the REPEL row is from its neighbors (+ and :has) and gets --push (how far and
   which way) and --push-delay (how long until the row in front reaches it) */
.word-row {
    transition: background-color 200ms ease-out, transform 350ms cubic-bezier(.3, 1.6, .5, 1),
        translate 450ms cubic-bezier(.3, 1.6, .5, 1);
}
.word-row.repel + .word-row { --push: 15px; --push-delay: 0ms; }
.word-row.repel + .word-row + .word-row { --push: 11px; --push-delay: 25ms; }
.word-row.repel + .word-row + .word-row + .word-row { --push: 8px; --push-delay: 50ms; }
.word-row:has(+ .word-row.repel) { --push: -15px; --push-delay: 0ms; }
.word-row:has(+ .word-row + .word-row.repel) { --push: -11px; --push-delay: 25ms; }
.word-row:has(+ .word-row + .word-row + .word-row.repel) { --push: -8px; --push-delay: 50ms; }
.word-row.repel ~ .word-row, .word-row:has(~ .word-row.repel) {
    translate: 0 var(--push);
    animation: repel-push 1300ms ease-out var(--push-delay) backwards;
}
@keyframes repel-push {
    0% { translate: 0 0; }
    18% { translate: 0 calc(var(--push) * 1.2); }    /* shoved away hard */
    36% { translate: 0 calc(var(--push) * 0.75); }   /* swings back toward it */
    54% { translate: 0 calc(var(--push) * 1.18); }
    72% { translate: 0 calc(var(--push) * 0.92); }
    86% { translate: 0 calc(var(--push) * 1.04); }
    100% { translate: 0 var(--push); }              /* hovering, balanced */
}

/* easter egg: a row that spells CYCLE runs once around like a bike chain. The motion is computed in
   Word.cycle; while it plays (.cycling), the row sits above the rows around it, since the tile going around
   under it passes over the row below */
.word-row.cycling {
    position: relative;
    z-index: 2;
}

/* easter egg: a row that spells DEPTH sinks each tile into the screen like a deep hole, with its letter at
   the bottom, for as long as the word is there. It's real 3D: each tile gets a perspective whose vanishing
   point is above the middle of the row, so the floors slide toward it and the outer holes show their side
   walls. The floor is two layers pushed back by --depth: the .letter-extra (the floor's color, and its
   ::before and ::after are the left and right walls) and the .letter-text over it (the letter, and its
   ::before and ::after are the top and bottom walls). Each wall hangs from the floor's edge and is turned
   90 degrees to come back up to the rim. The tile clips everything to the hole (overflow: hidden), and
   loses its shadow, since a hole casts none. --depth is registered so it can animate: the tiles sink in
   once, one after another, with a small settle.
   The perspective is a perspective() inside each floor layer's own transform, not the tile's perspective
   property: Safari ignores a tile's perspective when the tile also clips (overflow: hidden), and the
   clipping is what keeps the walls inside the tile's border. The layer's transform-origin is the vanishing
   point. The letter's pop is turned off in this row, as it would replace the letter layer's transform */
@property --depth {
    syntax: '<length>';
    inherits: true;
    initial-value: 0px;
}
.word-row.depth .letter {
    --depth: calc(var(--tile) * 1.2);
    --floor: var(--t, var(--card));
    --step: calc((var(--tile) + var(--row-gap)) * 0.45); /* the vanishing point is closer than the true center, so the outer letters stay in view */
    --eye: calc(50% - var(--tile) * 0.3);
    overflow: hidden;
    background-color: color-mix(in srgb, var(--floor), var(--ink) 45%);
    animation: depth-sink 900ms cubic-bezier(.3, 1.3, .5, 1) var(--depth-delay, 0ms) backwards;
}
.word-row.depth .letter:not(.pop, .celebrate, .shake) {
    box-shadow: none;
}
.word-row.depth .letter:nth-child(1) { --eye-x: calc(50% + var(--step) * 2); }
.word-row.depth .letter:nth-child(2) { --eye-x: calc(50% + var(--step)); --depth-delay: 60ms; }
.word-row.depth .letter:nth-child(3) { --depth-delay: 120ms; }
.word-row.depth .letter:nth-child(4) { --eye-x: calc(50% - var(--step)); --depth-delay: 180ms; }
.word-row.depth .letter:nth-child(5) { --eye-x: calc(50% - var(--step) * 2); --depth-delay: 240ms; }
@keyframes depth-sink {
    from { --depth: 0px; }
}
/* the color's shape, the points (score mode) and the cursor stay on the rim, over the hole */
.word-row.depth .letter::before, .word-row.depth .letter::after, .word-row.depth .letter-points {
    z-index: 2;
}
/* the two floor layers */
.word-row.depth .letter-extra, .word-row.depth .letter-text {
    position: absolute;
    inset: 0;
    transform-origin: var(--eye-x, 50%) var(--eye);
    transform: perspective(calc(var(--tile) * 3)) translateZ(calc(var(--depth) * -1)); /* the floor ends up about 70% of the tile */
    transform-style: preserve-3d;
    pointer-events: none;
}
.word-row.depth .letter-extra {
    display: block;
    z-index: 0;
    /* the floor, a little darker than the tile, and shaded in its corners where the walls meet it */
    background: color-mix(in srgb, var(--floor), var(--ink) 10%);
    box-shadow: inset 0 0 calc(var(--tile) * 0.12) color-mix(in srgb, var(--ink) 45%, transparent);
}
.word-row.depth .letter.pop .letter-text {
    animation: none;
}
.word-row.depth .letter-text {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* the walls: lit from above, so the bottom wall (which faces up) is the lightest and the top wall the darkest,
   each darker toward the floor */
.word-row.depth .letter-extra::before, .word-row.depth .letter-extra::after,
.word-row.depth .letter-text::before, .word-row.depth .letter-text::after {
    content: '';
    position: absolute;
    display: block;
}
.word-row.depth .letter-extra::before, .word-row.depth .letter-extra::after {
    top: 0;
    bottom: 0;
    width: var(--depth);
}
.word-row.depth .letter-extra::before { /* left */
    left: 0;
    transform-origin: left center;
    transform: rotateY(-90deg);
    background: linear-gradient(to left, color-mix(in srgb, var(--floor), var(--ink) 30%), color-mix(in srgb, var(--floor), var(--ink) 50%));
}
.word-row.depth .letter-extra::after { /* right */
    right: 0;
    transform-origin: right center;
    transform: rotateY(90deg);
    background: linear-gradient(to right, color-mix(in srgb, var(--floor), var(--ink) 30%), color-mix(in srgb, var(--floor), var(--ink) 50%));
}
.word-row.depth .letter-text::before, .word-row.depth .letter-text::after {
    left: 0;
    right: 0;
    height: var(--depth);
}
.word-row.depth .letter-text::before { /* top */
    top: 0;
    transform-origin: center top;
    transform: rotateX(90deg);
    background: linear-gradient(to top, color-mix(in srgb, var(--floor), var(--ink) 45%), color-mix(in srgb, var(--floor), var(--ink) 60%));
}
.word-row.depth .letter-text::after { /* bottom */
    bottom: 0;
    transform-origin: center bottom;
    transform: rotateX(-90deg);
    background: linear-gradient(to bottom, color-mix(in srgb, var(--floor), var(--ink) 8%), color-mix(in srgb, var(--floor), var(--ink) 28%));
}

/* easter egg: a row that spells DICEY rolls like a handful of dice, once, and then the tiles are dice for as long
   as the word is there. Each tile hops and tumbles in quarter turns, bouncing three times out of step with the
   others, lands a little crooked and straightens; while it tumbles its letter hides and its face flicks through
   pip patterns. Each die lands with its letter as the middle pip, showing 3 (two dots, on the top-right and
   bottom-left corners, clear of the color shape and the points) or 1 (the letter alone): 3-1-3-3-1. The pips are
   radial gradients on the tile's .letter-extra, one per dot (--face-N, with the letter-less 3 being --face-2).
   A tile still popping in runs its bump alongside the roll, so the roll keeps going when the pop ends */
.word-row.dicey .letter {
    border-radius: calc(var(--tile) * 0.2);
}
.word-row.dicey .letter:not(.celebrate, .shake) {
    animation: var(--roll) var(--roll-time) ease-out var(--roll-delay) backwards;
}
.word-row.dicey .letter.pop:not(.celebrate, .shake) {
    animation: bump 260ms ease-out var(--pop-delay, 0ms), var(--roll) var(--roll-time) ease-out var(--roll-delay) backwards;
}
.word-row.dicey .letter:nth-child(1) { --roll: dice-roll-1; --roll-time: 1250ms; --roll-delay: 0ms; --faces: dice-faces-a; }
.word-row.dicey .letter:nth-child(2) { --roll: dice-roll-2; --roll-time: 1400ms; --roll-delay: 70ms; --faces: dice-faces-b; }
.word-row.dicey .letter:nth-child(3) { --roll: dice-roll-3; --roll-time: 1150ms; --roll-delay: 30ms; --faces: dice-faces-a; }
.word-row.dicey .letter:nth-child(4) { --roll: dice-roll-4; --roll-time: 1350ms; --roll-delay: 110ms; --faces: dice-faces-b; }
.word-row.dicey .letter:nth-child(5) { --roll: dice-roll-5; --roll-time: 1300ms; --roll-delay: 50ms; --faces: dice-faces-a; }
.word-row.dicey .letter-extra {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    --pip: calc(var(--tile) * 0.065);
    --face-1: radial-gradient(circle at 50% 50%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    --face-2: radial-gradient(circle at 80% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    --face-3: radial-gradient(circle at 80% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 50% 50%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    --face-4: radial-gradient(circle at 20% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    --face-5: radial-gradient(circle at 20% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 50% 50%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    --face-6: radial-gradient(circle at 20% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 20%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 50%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 50%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 20% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px)), radial-gradient(circle at 80% 80%, var(--ink) var(--pip), transparent calc(var(--pip) + 0.5px));
    background-image: var(--rest);
    animation: var(--faces) var(--roll-time) step-end var(--roll-delay) backwards;
}
.word-row.dicey .letter:nth-child(1) .letter-extra { --rest: var(--face-2); }
.word-row.dicey .letter:nth-child(2) .letter-extra { --rest: none; }
.word-row.dicey .letter:nth-child(3) .letter-extra { --rest: var(--face-2); }
.word-row.dicey .letter:nth-child(4) .letter-extra { --rest: var(--face-2); }
.word-row.dicey .letter:nth-child(5) .letter-extra { --rest: none; }
/* the letter hides while the die tumbles (scale, since the pop-in animates the transform), and so do the
   color shape and the points, so only pips show */
.word-row.dicey .letter::before, .word-row.dicey .letter-points {
    animation: dice-hide var(--roll-time) step-end var(--roll-delay) backwards;
}
.word-row.dicey .letter-text {
    scale: 1;
    animation: dice-hide var(--roll-time) step-end var(--roll-delay) backwards;
}
.word-row.dicey .letter.pop .letter-text {
    animation: pop-in 300ms cubic-bezier(.3, 1.6, .5, 1) var(--pop-delay, 0ms) backwards,
        dice-hide var(--roll-time) step-end var(--roll-delay) backwards;
}
@keyframes dice-hide {
    0% { scale: 0; }
    66% { scale: 1; }
}
@keyframes dice-faces-a {
    0.0% { background-image: var(--face-5); }
    7.3% { background-image: var(--face-2); }
    14.7% { background-image: var(--face-6); }
    22.0% { background-image: var(--face-1); }
    29.3% { background-image: var(--face-4); }
    36.7% { background-image: var(--face-3); }
    44.0% { background-image: var(--face-6); }
    51.3% { background-image: var(--face-2); }
    58.7% { background-image: var(--face-5); }
    66% { background-image: var(--rest); }
}
@keyframes dice-faces-b {
    0.0% { background-image: var(--face-3); }
    7.3% { background-image: var(--face-6); }
    14.7% { background-image: var(--face-1); }
    22.0% { background-image: var(--face-5); }
    29.3% { background-image: var(--face-2); }
    36.7% { background-image: var(--face-4); }
    44.0% { background-image: var(--face-1); }
    51.3% { background-image: var(--face-6); }
    58.7% { background-image: var(--face-3); }
    66% { background-image: var(--rest); }
}
@keyframes dice-roll-1 {
    0% { translate: 0 0; rotate: 0deg; }
    14% { translate: 0 -55%; rotate: 90deg; }
    28% { translate: 0 0; rotate: 180deg; }
    40% { translate: 0 -25%; rotate: 270deg; }
    52% { translate: 0 0; rotate: 360deg; }
    60% { translate: 0 -8%; rotate: 405deg; }
    68% { translate: 0 0; rotate: 367deg; }
    86% { translate: 0 0; rotate: 367deg; }
    100% { translate: 0 0; rotate: 360deg; }
}
@keyframes dice-roll-2 {
    0% { translate: 0 0; rotate: 0deg; }
    14% { translate: 0 -65%; rotate: -90deg; }
    28% { translate: 0 0; rotate: -180deg; }
    40% { translate: 0 -30%; rotate: -270deg; }
    52% { translate: 0 0; rotate: -360deg; }
    60% { translate: 0 -10%; rotate: -405deg; }
    68% { translate: 0 0; rotate: -366deg; }
    86% { translate: 0 0; rotate: -366deg; }
    100% { translate: 0 0; rotate: -360deg; }
}
@keyframes dice-roll-3 {
    0% { translate: 0 0; rotate: 0deg; }
    14% { translate: 0 -50%; rotate: 90deg; }
    28% { translate: 0 0; rotate: 180deg; }
    40% { translate: 0 -20%; rotate: 270deg; }
    52% { translate: 0 0; rotate: 360deg; }
    60% { translate: 0 -6%; rotate: 405deg; }
    68% { translate: 0 0; rotate: 352deg; }
    86% { translate: 0 0; rotate: 352deg; }
    100% { translate: 0 0; rotate: 360deg; }
}
@keyframes dice-roll-4 {
    0% { translate: 0 0; rotate: 0deg; }
    14% { translate: 0 -60%; rotate: -90deg; }
    28% { translate: 0 0; rotate: -180deg; }
    40% { translate: 0 -28%; rotate: -270deg; }
    52% { translate: 0 0; rotate: -360deg; }
    60% { translate: 0 -9%; rotate: -405deg; }
    68% { translate: 0 0; rotate: -355deg; }
    86% { translate: 0 0; rotate: -355deg; }
    100% { translate: 0 0; rotate: -360deg; }
}
@keyframes dice-roll-5 {
    0% { translate: 0 0; rotate: 0deg; }
    14% { translate: 0 -58%; rotate: 90deg; }
    28% { translate: 0 0; rotate: 180deg; }
    40% { translate: 0 -24%; rotate: 270deg; }
    52% { translate: 0 0; rotate: 360deg; }
    60% { translate: 0 -7%; rotate: 405deg; }
    68% { translate: 0 0; rotate: 353deg; }
    86% { translate: 0 0; rotate: 353deg; }
    100% { translate: 0 0; rotate: 360deg; }
}

/* in a CUBIC row, a SOLVE given tile stays pressed into the board (no cube sides), as it did when these
   rules lived inside style.css, where the given tile's rule came after them */
.word-row.cubic .letter.given:not(.paused) {
    box-shadow: none;
}

/* reduced motion: no egg moves (the looks stay). !important because many egg animations use more specific
   selectors than these (to stay out of the way of the game's own pop, win hop and error shake). PLUCK
   and CYCLE check this setting themselves, in Word.pluck and Word.cycle */
@media (prefers-reduced-motion: reduce) {
    .word-row, .word-row::after, .word-row .letter, .word-row .letter-text, .word-row .letter-extra,
    .word-row .letter-extra::before, .word-row .letter-extra::after, .word-row .letter-text::after,
    #board:has(.word-row.quake) {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- RETRO: the whole site turns into an 8-bit video game ----------
   body.retro is on while any row spells RETRO (updateRetroTheme in word.js, which also loads the two pixel
   fonts the first time). Pixel fonts, square pixel corners, the color shapes redrawn in pixels, faint TV
   scanlines and square confetti that falls in steps. Other eggs keep their own looks. Turning it on plays the
   power-on of an old TV once (body.retro-on) */
body.retro {
    --display-font: 'Press Start 2P', 'Courier New', monospace;
    --ui-font: 'Pixelify Sans', 'Courier New', monospace;
    --border: 3px;
    font-variant-ligatures: none; /* Pixelify Sans draws "fi" as one letter that reads like an A */
}
/* no round corners anywhere (more specific rules, like the ROUND egg's circles, still win) */
body.retro *, body.retro *::before, body.retro *::after {
    border-radius: 0;
}
/* the tiles and buttons get pixel-art corners: the frame is drawn from a 3x3-pixel pattern with an empty corner,
   so each corner steps in by one pixel. background-clip keeps the fill out of the corners */
body.retro .letter, body.retro .example-letter, body.retro .wordmark span, body.retro .key, body.retro .pill, body.retro .popup,
body.retro #mode-switch, body.retro #how-to-play-button, body.retro #stats-button, body.retro #friends-button, body.retro #archive-button {
    border-style: solid;
    border-radius: 0;
    border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='9'%3E%3Cpath d='M3 0h3v3H3zM0 3h3v3H0zM6 3h3v3H6zM3 6h3v3H3z' fill='%231d1b20'/%3E%3C/svg%3E") 3 / 3px / 0 stretch;
    background-clip: padding-box;
}
/* Press Start 2P is big for its size */
body.retro .letter {
    font-size: calc(var(--tile) * 0.36);
}
body.retro .wordmark span {
    font-size: calc((var(--content) - 33px) / 12 * 0.42);
}
body.retro .key-word {
    font-size: min(9px, calc(var(--key-wide) * 0.15));
}
/* the color shapes, redrawn on a 5x5 pixel grid: circle, square, diamond, triangle */
body.retro .letter.c1::before, body.retro .letter.c2::before, body.retro .letter.c3::before,
body.retro .letter.c4::before {
    width: 10px;
    height: 10px;
    transform: none;
}
body.retro .c1::before {
    clip-path: polygon(20% 0, 80% 0, 80% 20%, 100% 20%, 100% 80%, 80% 80%, 80% 100%, 20% 100%, 20% 80%, 0 80%, 0 20%, 20% 20%);
}
body.retro .c3::before {
    clip-path: polygon(40% 0, 60% 0, 60% 20%, 80% 20%, 80% 40%, 100% 40%, 100% 60%, 80% 60%, 80% 80%, 60% 80%, 60% 100%,
        40% 100%, 40% 80%, 20% 80%, 20% 60%, 0 60%, 0 40%, 20% 40%, 20% 20%, 40% 20%);
}
body.retro .c4::before {
    clip-path: polygon(40% 0, 60% 0, 60% 20%, 80% 20%, 80% 60%, 100% 60%, 100% 100%, 0 100%, 0 60%, 20% 60%, 20% 20%, 40% 20%);
}
/* the cursor blinks like a text cursor on an old computer: a solid block of a bar */
body.retro .letter.selected::after {
    height: 5px;
}
/* faint scanlines over everything, like an old TV screen */
body.retro::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2000;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, transparent 0 2px, rgb(29 27 32 / 0.07) 2px 3px);
}
/* confetti: square pixels that fall in jerky steps and never spin (!important beats the pieces' inline sizes) */
body.retro .confetti i:not(.emoji) {
    width: 8px !important;
    height: 8px !important;
    border: none;
    --rot: 0deg !important;
    animation-timing-function: steps(18) !important;
}
/* the power-on: a dot of light stretches into a bright line across a dark screen, then opens up into the
   page, which glows too bright for a moment and settles */
body.retro-on #container {
    animation: retro-power-on 800ms ease-out;
}
html:has(> body.retro-on), body.retro-on {
    animation: retro-screen 800ms ease-out;
}
body.retro-on::before {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    top: calc(50% - 2px);
    height: 4px;
    z-index: 1999;
    pointer-events: none;
    background: #fff;
    box-shadow: 0 0 14px 4px rgb(255 255 255 / 0.8);
    animation: retro-line 800ms ease-out forwards;
}
@keyframes retro-power-on {
    0% { scale: 0.02 0.004; filter: brightness(6); }
    20% { scale: 1 0.004; filter: brightness(6); }
    50% { scale: 1 1.04; filter: brightness(2); }
    62% { scale: 1 0.98; filter: brightness(1.5); }
    100% { scale: 1 1; filter: none; }
}
@keyframes retro-line {
    0% { scale: 0.02 1; opacity: 1; }
    20% { scale: 1 1; opacity: 1; }
    34%, 100% { scale: 1 1; opacity: 0; }
}
@keyframes retro-screen {
    0%, 35% { background-color: var(--ink); }
    100% { background-color: var(--paper); }
}
@media (prefers-reduced-motion: reduce) {
    body.retro-on #container, html:has(> body.retro-on), body.retro-on {
        animation: none;
    }
    body.retro-on::before {
        display: none;
    }
}
