/* BounceWords shares the site's tokens and the duel rules in duels.css, so it reads as a sibling of Tug of Word. Seat One
   is the accent colour with a corner triangle, and seat Two the progress colour with a corner dot, so colour is never
   the only sign of an owner. */
@layer components  {
  /* Match page */
  .bw  {
    display: grid;
    gap: var(--s3);
    max-width: var(--game-max);
    margin: 0 auto;
    padding: var(--s4) var(--s5) var(--s6);
  }
  .bw-scores  {
    display: grid;
    gap: var(--s2);
  }
  .bw-player, .bw-round  {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--s2) var(--s4);
    margin: 0;
    font-size: var(--text-sm);
  }
  .bw-player  {
    position: relative;
    padding: var(--s2) var(--s3) var(--s2) var(--s6);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
  }
  .bw-player[data-turn="true"]  {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
  }
  .bw-player .owner-mark  {
    top: 50%;
    left: var(--s2);
    translate: 0 -50%;
  }
  .bw-player .player-score  {
    font: 700 var(--text-lg) var(--font-mono);
  }
  .bw-player .player-rating, .bw-player .player-track, .bw-round  {
    color: var(--muted);
  }
  .bw-round .team-score strong, .bw-round .timer  {
    color: var(--ink);
    font-family: var(--font-mono);
  }
  /* The status box takes the player's seat colour while they act, and a dashed muted edge while they wait. */
  .bw-prompt  {
    --who: var(--line);
    margin: 0;
    padding: var(--s3) var(--s4);
    border: 1px solid var(--who);
    border-left-width: 4px;
    border-radius: var(--radius-card);
    background: var(--surface);
  }
  .bw-prompt[data-who="you"]  {
    --who: var(--accent);
    background: color-mix(in srgb, var(--who) 10%, var(--surface));
  }
  .bw-prompt[data-who="you"][data-seat="2"]  {
    --who: var(--progress);
  }
  .bw-prompt[data-who="wait"]  {
    --who: var(--muted);
    border-style: dashed;
  }
  .bw-prompt :is(p, ul)  {
    margin: 0;
  }
  .bw-prompt .bw-now  {
    font-weight: var(--weight-bold);
  }
  .bw-prompt :is(.bw-hint, .bw-options)  {
    margin-top: var(--s1);
    color: var(--muted);
    font-size: 0.92em;
    line-height: 1.35;
  }
  .bw-prompt .bw-options  {
    padding: 0;
    list-style: none;
  }
  /* The chosen die's line is marked by colour and an edge, not by bold, so it keeps to one line on a phone. */
  .bw-prompt .bw-options li  {
    padding-left: var(--s3);
    border-left: 2px solid transparent;
  }
  .bw-prompt .bw-options li[data-chosen="true"]  {
    border-left-color: var(--who);
    color: var(--ink);
  }
  /* Every die is used in the words step, so the trays only take room from the grid and the buttons. */
  .bw[data-step="words"] .bw-table > .bw-dice  {
    display: none;
  }
  .bw-chaos  {
    margin: 0;
    padding: var(--s2) var(--s3);
    border-radius: var(--radius-card);
    background: var(--surface-2);
    font-weight: var(--weight-bold);
    animation: bw-pop 400ms ease-out;
  }
  .bw .board-wrap  {
    position: relative;
    justify-self: center;
    width: min(100%, 26rem);
  }
  .bw-pause-frame  {
    min-height: max(600px, calc(100dvh - 8rem));
  }
  /* The grid fills the width of a phone. */
  .bw-grid  {
    position: relative;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-card);
    background: var(--surface-2);
    touch-action: manipulation;
  }
  .bw-grid .cell  {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font: 700 clamp(1rem, 6vw, 1.6rem) var(--font-mono);
    cursor: pointer;
  }
  .bw-grid .cell-name  {
    font-size: var(--text-xs);
    font-weight: 400;
    opacity: 0.6;
  }
  .bw-grid .cell[data-owner]  {
    color: var(--ink);
  }
  .bw-grid .cell[data-seat="1"]  {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  }
  .bw-grid .cell[data-seat="2"]  {
    border-color: var(--progress);
    background: color-mix(in srgb, var(--progress) 18%, var(--surface));
  }
  /* A traced tile lights as in Tug of Word, over its owner's colour. */
  .bw-grid .cell.traced  {
    background: var(--accent);
    color: var(--on-accent);
  }
  .bw-grid[data-trace="word"] .cell.traced  {
    background: var(--correct);
    color: var(--on-correct);
  }
  :root[data-contrast="true"] .bw-grid[data-trace="word"] .cell.traced  {
    background: var(--present);
    color: var(--on-present);
  }
  /* A corner triangle for seat One and a corner dot for seat Two. */
  .owner-mark  {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 9px;
    height: 9px;
  }
  [data-seat="1"] > .owner-mark  {
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 0 100%);
  }
  [data-seat="2"] > .owner-mark  {
    border-radius: 50%;
    background: var(--progress);
  }
  .bw-player[data-seat="1"] .owner-mark  {
    background: var(--accent);
    clip-path: polygon(0 0, 100% 0, 0 100%);
  }
  .bw-player[data-seat="2"] .owner-mark  {
    border-radius: 50%;
    background: var(--progress);
  }
  .lock-badge  {
    position: absolute;
    right: 2px;
    bottom: 1px;
    font-size: 0.65em;
    line-height: 1;
  }
  .bw-grid .cell[data-locked="true"]  {
    border-width: 2px;
  }
  /* An exhausted tile is dimmed and hatched. */
  .cell[data-exhausted="true"]  {
    background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--muted) 35%, transparent) 5px 7px);
  }
  .cell[data-exhausted="true"] .letter  {
    opacity: 0.55;
  }
  .bw-grid .cell[data-lit="true"]  {
    outline: 3px solid var(--correct);
    outline-offset: -3px;
  }
  .bw-grid .cell[data-preview="true"]  {
    outline: 3px solid var(--ink);
    outline-offset: -3px;
  }
  .bw-grid .cell[data-mirror="true"]  {
    outline: 3px dashed var(--ink);
    outline-offset: -3px;
  }
  .bw-grid .cell[data-focus="true"]  {
    box-shadow: 0 0 0 3px var(--focus, var(--accent));
  }
  .bw-grid .cell[data-event="true"]  {
    animation: bw-pop 500ms ease-out;
  }
  .bw-grid .mirror-arrow  {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    pointer-events: none;
  }
  .bw-grid .mirror-arrow line  {
    stroke: var(--ink);
    stroke-width: 0.06;
    stroke-dasharray: 0.15 0.1;
  }
  .bw .float-word  {
    position: absolute;
    top: 40%;
    left: 50%;
    translate: -50% 0;
    padding: var(--s1, 4px) var(--s3);
    border-radius: var(--radius-card);
    background: var(--correct);
    color: var(--on-correct);
    font: 700 var(--text-lg) var(--font-mono);
    pointer-events: none;
    animation: bw-float 1500ms ease-out forwards;
  }
  .bw .countdown  {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font: 700 4rem var(--font-mono);
    color: var(--accent);
    pointer-events: none;
  }
  /* The steps of a round */
  .bw-steps  {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s1, 4px);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
  }
  .bw-steps li  {
    padding: 2px var(--s3);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
  }
  .bw-steps li[data-state="now"]  {
    background: var(--accent);
    color: var(--on-accent);
  }
  .bw-steps li[data-state="done"]  {
    text-decoration: line-through;
  }
  /* A phone reads down the page in the DOM's order. A wider screen keeps the dice beside the grid, above the fold. */
  .bw-table  {
    display: grid;
    gap: var(--s3);
    grid-template-columns: minmax(0, 1fr);
  }
  .bw-table .board-status  {
    margin: 0;
    min-height: 1.25rem;
  }
  /* The Skip button names the chosen die. Its width stays the same, so Place does not move when the choice changes. */
  .bw-table [data-action="skip"]  {
    min-width: 8.5rem;
  }
  /* A prompt that grows by a line would move the buttons under the player's finger, so it keeps its room. */
  .bw-table .bw-prompt  {
    min-height: 5.5em;
  }
  .bw-table .trace-score  {
    font-size: var(--text-sm);
    letter-spacing: 0;
  }
  @media (min-width: 56rem)  {
    .bw-table  {
      justify-content: center;
      column-gap: var(--s6);
      grid-template-columns: minmax(0, 26rem) minmax(0, 26rem);
      grid-template-rows: repeat(6, auto) 1fr;
      /* The status can grow by a line at any moment, so it sits below the buttons and cannot move them. */
      grid-template-areas: "board prompt" "board trace" "board you" "board actions" "board status" "board other" "board .";
    }
    .bw-table .bw-prompt  {
      grid-area: prompt;
      min-height: 8em;
    }
    .bw-table .board-status  {
      grid-area: status;
      text-align: left;
    }
    .bw-table .trace-letters  {
      grid-area: trace;
    }
    .bw-table .board-wrap  {
      grid-area: board;
      align-self: start;
    }
    .bw-table > .bw-dice[data-side="you"]  {
      grid-area: you;
      justify-items: start;
    }
    .bw-table .trace-actions  {
      grid-area: actions;
      justify-content: flex-start;
    }
    .bw-table > .bw-dice[data-side="other"]  {
      grid-area: other;
      justify-items: start;
    }
  }
  @media (max-width: 30rem)  {
    /* Both players share one row, so the grid and the dice fit on one screen. */
    .bw-scores  {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .bw-round  {
      grid-column: 1 / -1;
    }
    .bw-player .player-rating  {
      display: none;
    }
    .bw-player  {
      row-gap: 0;
      column-gap: var(--s2);
    }
    .bw-player .player-score  {
      font-size: var(--text-base, 1rem);
    }
    .bw-table .bw-prompt  {
      font-size: var(--text-sm);
      min-height: 6.2em;
    }
    .bw .board-wrap  {
      width: min(100%, 26rem, max(16rem, calc(100dvh - 32.5rem)));
    }
    /* Every step has a timer, so the buttons stay on the screen however short the phone is. */
    .bw-table .trace-actions:has(button)  {
      position: sticky;
      bottom: 0;
      z-index: 2;
      box-sizing: content-box;
      padding-block: var(--s2);
      background: var(--bg);
    }
    /* The traced word's line is empty outside the words step, and the dice need that room above the buttons. */
    .bw:not([data-step="words"]) .bw-table .trace-letters  {
      display: none;
    }
  }
  /* A phone with its browser bars showing keeps the grid, the dice and the buttons on one screen. The prompt still names the step. */
  @media (max-width: 30rem) and (max-height: 46rem)  {
    .bw-steps  {
      display: none;
    }
    .bw-table  {
      gap: var(--s1, 4px);
    }
    /* The match opens by scrolling the buttons into view. This margin takes it past the site's header too. */
    .bw-table .trace-actions  {
      scroll-margin-bottom: 13rem;
    }
    .bw-table > .bw-dice[data-side="you"] :is(.bw-dice-label, .die-name)  {
      display: none;
    }
    .bw-table > .bw-dice[data-side="you"] .bw-dice-row  {
      --die: 2.75rem;
      min-height: calc(var(--die) + 0.5rem);
      padding-top: var(--s1, 4px);
    }
    .bw-table .bw-prompt  {
      font-size: var(--text-xs);
    }
    .bw-table .trace-actions:has(button)  {
      padding-block: var(--s1, 4px);
    }
  }
  .bw-player[data-side="you"][data-seat="1"]  {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  }
  .bw-player[data-side="you"][data-seat="2"]  {
    background: color-mix(in srgb, var(--progress) 10%, var(--surface));
  }
  /* Dice. Each is a real cube: the page turns it in 3D with no script. --die sets its size. */
  .bw-dice  {
    display: grid;
    justify-items: center;
    gap: var(--s1, 4px);
    --die-tint: var(--accent);
  }
  .bw-dice[data-seat="2"]  {
    --die-tint: var(--progress);
  }
  .bw-dice[data-concealed="true"] .bw-dice-row  {
    visibility: hidden;
  }
  .bw-dice-label  {
    color: var(--muted);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
  }
  .bw-dice-row  {
    display: flex;
    justify-content: center;
    gap: var(--s5);
    min-height: calc(var(--die, 3.5rem) + 1.5rem);
    padding: var(--s2) var(--s2) 0;
    --die: 3.5rem;
  }
  .bw-dice[data-side="other"] .bw-dice-row  {
    gap: var(--s4);
    --die: 2.5rem;
  }
  .die  {
    position: relative;
    display: inline-grid;
    justify-items: center;
    align-content: start;
    gap: 2px;
    width: var(--die, 3.5rem);
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 700 calc(var(--die, 3.5rem) * 0.46) var(--font-mono);
    transition: translate 150ms ease-out;
  }
  /* A die shows hover, a press and its choice by moving and with its own bar, not with the site's button fills. */
  button.die  {
    --hover-bg: transparent;
    --hover-ink: var(--ink);
    --press-bg: transparent;
    --press-ink: var(--ink);
  }
  button.die:not(:disabled)  {
    cursor: pointer;
  }
  button.die:not(:disabled):hover, .die[data-chosen="true"]  {
    translate: 0 -4px;
  }
  .die:has(> .die-cube:not([data-rest]))  {
    perspective: calc(var(--die, 3.5rem) * 12);
  }
  .die-cube  {
    position: relative;
    display: block;
    width: var(--die, 3.5rem);
    height: var(--die, 3.5rem);
    transform-style: preserve-3d;
    transform: translateZ(calc(var(--die, 3.5rem) / -2)) rotateX(-10deg) rotateY(12deg);
  }
  .die-side  {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border: 2px solid var(--die-tint, var(--accent));
    border-radius: 18%;
    background: color-mix(in srgb, var(--die-tint, var(--accent)) 8%, white);
    box-shadow: inset 0 -3px 6px color-mix(in srgb, var(--die-tint, var(--accent)) 25%, transparent);
    color: #1a1a2e;
    line-height: 1;
    backface-visibility: hidden;
  }
  .die-side[data-side="front"]  {
    transform: translateZ(calc(var(--die, 3.5rem) / 2));
  }
  .die-side[data-side="back"]  {
    transform: rotateY(180deg) translateZ(calc(var(--die, 3.5rem) / 2));
  }
  .die-side[data-side="right"]  {
    transform: rotateY(90deg) translateZ(calc(var(--die, 3.5rem) / 2));
  }
  .die-side[data-side="left"]  {
    transform: rotateY(-90deg) translateZ(calc(var(--die, 3.5rem) / 2));
  }
  .die-side[data-side="top"]  {
    transform: rotateX(90deg) translateZ(calc(var(--die, 3.5rem) / 2));
  }
  .die-side[data-side="bottom"]  {
    transform: rotateX(-90deg) translateZ(calc(var(--die, 3.5rem) / 2));
  }
  /* A die at rest draws only its front face, flat, with an edge for depth, so no 3D layer stays behind after a roll. */
  .die-cube[data-rest="true"]  {
    transform: none;
    transform-style: flat;
  }
  .die-cube[data-rest="true"] .die-side  {
    transform: none;
    backface-visibility: visible;
    box-shadow: inset 0 -3px 6px color-mix(in srgb, var(--die-tint, var(--accent)) 25%, transparent),
      2px 3px 0 color-mix(in srgb, var(--die-tint, var(--accent)) 45%, transparent);
  }
  .die-side[data-face="bounce"]  {
    background: #e8f0ff;
    color: #1d4ed8;
  }
  .die-side[data-face="lock"]  {
    background: #fff4d6;
  }
  /* At rest, the slivers of the other sides show no letters, so the rolled face is the only one to read. */
  .die-side:not([data-side="front"])  {
    color: transparent;
  }
  [data-rolling="true"] .die-side:not([data-side="front"])  {
    color: #1a1a2e;
  }
  .die[data-chosen="true"]::after  {
    content: "";
    position: absolute;
    inset: auto 10% -6px;
    height: 4px;
    border-radius: 2px;
    background: var(--accent);
  }
  .die[data-used="true"]  {
    opacity: 0.35;
    filter: grayscale(1);
  }
  .die-name  {
    min-height: 1rem;
    color: var(--muted);
    font: 400 var(--text-xs) var(--font-body, inherit);
  }
  .die-key  {
    position: absolute;
    top: -4px;
    left: -4px;
    display: grid;
    place-items: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--muted);
    font: 400 0.6rem var(--font-mono);
  }
  /* The roll plays over the grid. The dice fall one after another, tumble with their real faces, and land. */
  .bw-roll  {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: var(--s4);
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  }
  .bw-roll-title  {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
  }
  .bw-roll .bw-dice[data-side="you"] .bw-dice-row  {
    --die: 4.5rem;
  }
  .bw-roll .bw-dice[data-side="other"] .bw-dice-row  {
    --die: 3rem;
  }
  [data-rolling="true"] .die-cube  {
    animation: bw-tumble 1300ms cubic-bezier(0.25, 0.7, 0.4, 1) calc(var(--slot, 0) * 120ms) backwards;
  }
  [data-rolling="true"] .die-side:not([data-side="front"])  {
    animation: bw-blank 1ms linear calc(1300ms + var(--slot, 0) * 120ms) forwards;
  }
  [data-rolling="true"] .die-name  {
    animation: bw-appear 300ms ease-out 1400ms backwards;
  }
  .bw-roll .bw-dice[data-side="other"] .die-cube, .bw-roll .bw-dice[data-side="other"] .die-side, .bw-roll .bw-dice[data-side="other"] .die-name  {
    animation-delay: calc(360ms + var(--slot, 0) * 120ms);
  }
  .bw-roll .bw-dice[data-side="other"] .die-side:not([data-side="front"])  {
    animation-delay: calc(1660ms + var(--slot, 0) * 120ms);
  }
  /* Replay */
  .bw-words  {
    display: grid;
    gap: var(--s1, 4px);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--text-sm);
  }
  .bw-words li  {
    display: flex;
    gap: var(--s3);
  }
  .bw-words .word-time, .bw-words .word-player  {
    color: var(--muted);
  }
  .bw-words .word-points  {
    margin-left: auto;
    font-family: var(--font-mono);
  }
  /* The three steps on the start page */
  .bw-how  {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: var(--s3);
    width: 100%;
    margin: var(--s4) 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
  }
  .bw-how > li  {
    display: grid;
    align-content: start;
    gap: var(--s2);
    padding: var(--s3);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--surface);
    font-size: var(--text-sm);
  }
  .bw-how-dice  {
    display: flex;
    gap: var(--s3);
    min-height: 2.75rem;
    --die: 2.5rem;
  }
  .bw-how .how-picture  {
    min-height: 2.75rem;
  }
  :is(.bw-rules, .bw-how) .how-picture .arrow  {
    color: var(--accent);
    font-size: var(--text-lg);
  }
  /* How to play pictures */
  .bw-goal  {
    margin: 0 0 var(--s3);
  }
  .bw-faces  {
    display: grid;
    gap: var(--s3);
    margin: var(--s2) 0;
    padding: 0;
    list-style: none;
  }
  .bw-faces > li  {
    display: grid;
    gap: var(--s1, 4px);
  }
  .bw-faces p, .bw-rules p  {
    margin: 0 0 var(--s2);
  }
  .bw-rules .how-picture .die  {
    --die: 2.5rem;
    margin-right: var(--s3);
  }
  :is(.bw-rules, .bw-how) .how-picture  {
    display: flex;
    align-items: center;
    gap: var(--s2, 8px);
  }
  :is(.bw-rules, .bw-how) .how-picture .cell  {
    position: relative;
    display: grid;
    place-items: center;
    width: 2.25rem;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: 700 var(--text-base, 1rem) var(--font-mono);
  }
  :is(.bw-rules, .bw-how) .how-picture .cell[data-seat="1"]  {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  }
  :is(.bw-rules, .bw-how) .how-picture .cell[data-seat="2"]  {
    border-color: var(--progress);
    background: color-mix(in srgb, var(--progress) 18%, var(--surface));
  }
  :is(.bw-rules, .bw-how) .how-picture .cell[data-lit="true"]  {
    outline: 3px solid var(--correct);
    outline-offset: -3px;
  }
  :root[data-contrast="true"] .bw-grid .cell[data-seat]  {
    border-width: 3px;
  }
  :root[data-contrast="true"] .bw-grid .cell[data-lit="true"]  {
    outline-color: var(--present);
  }
  /* Each score races to its target, and the text beside the bar says what it still needs. */
  .bw .race  {
    display: flex;
    flex: 1 1 100%;
    align-items: center;
    gap: var(--s2);
    color: var(--muted);
    font-size: var(--text-sm);
  }
  .bw .race-bar  {
    flex: 1;
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--surface-2);
  }
  .bw .race-fill  {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 400ms ease-out;
  }
  .bw-player[data-seat="2"] .race-fill  {
    background: var(--progress);
  }
  .bw-round .race-fill  {
    background: var(--correct);
  }
  .bw .race[data-race="won"] .race-need  {
    color: var(--ink);
    font-weight: var(--weight-bold);
  }
  /* The hurry-up turns the status box urgent while the last player spells. */
  .bw-prompt[data-hurry]  {
    --who: var(--present);
    border-style: solid;
  }
  .bw-prompt :is(.bw-why, .bw-missed)  {
    margin-top: var(--s1);
    font-size: 0.92em;
  }
  .bw-prompt .bw-missed  {
    font-weight: var(--weight-bold);
  }
  /* A letter another word took first shakes in the warning colour. */
  .bw-grid .cell[data-clash="true"]  {
    z-index: 1;
    outline: 3px solid var(--present);
    outline-offset: -3px;
    animation: bw-shake 400ms ease-in-out 2;
  }
  /* The bounced letter jumps in an arc from its cell to the mirrored cell. A swapped letter jumps back. Each step of
     the grid is a cell's size plus the 4px gap. */
  .bw-grid .cell[data-bounce]  {
    z-index: 2;
    animation: bw-bounce 750ms cubic-bezier(0.3, 0.6, 0.4, 1);
  }
  .bw-grid .cell[data-bounce="swap"]  {
    z-index: 1;
  }
  /* Before a Bounce is placed, its landing cell says where the letter goes. */
  .bw-grid .cell[data-mirror="true"]::after  {
    content: "lands";
    position: absolute;
    top: 1px;
    left: 50%;
    translate: -50% 0;
    color: var(--ink);
    font-size: 0.5rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    animation: bw-appear 300ms ease-out;
  }
  @media (prefers-reduced-motion: reduce)  {
    .bw-grid .cell[data-event="true"], .bw-grid .cell[data-bounce], .bw-grid .cell[data-clash="true"], .bw-chaos, .bw .float-word,
    [data-rolling="true"] .die-cube, [data-rolling="true"] .die-side:not([data-side="front"]), [data-rolling="true"] .die-name  {
      animation: none;
    }
    [data-rolling="true"] .die-side:not([data-side="front"])  {
      color: transparent;
    }
    .die  {
      transition: none;
    }
  }
  /* Each rotation ends where the die rests, so the rolled face lands towards the player. An opacity change here would
     flatten the cube into a card, so the dice fall in with no fade. */
  @keyframes bw-tumble  {
    0%  {
      transform: translateY(-120%) translateZ(calc(var(--die, 3.5rem) / -2)) rotateX(900deg) rotateY(720deg);
    }
    60%  {
      transform: translateY(0) translateZ(calc(var(--die, 3.5rem) / -2)) rotateX(250deg) rotateY(200deg);
    }
    80%  {
      transform: translateY(-14%) translateZ(calc(var(--die, 3.5rem) / -2)) rotateX(30deg) rotateY(50deg);
    }
    100%  {
      transform: translateY(0) translateZ(calc(var(--die, 3.5rem) / -2)) rotateX(-10deg) rotateY(12deg);
    }
  }
  @keyframes bw-blank  {
    to  {
      color: transparent;
    }
  }
  @keyframes bw-appear  {
    from  {
      opacity: 0;
    }
  }
  @keyframes bw-pop  {
    from  {
      scale: 0.85;
    }
    to  {
      scale: 1;
    }
  }
  @keyframes bw-bounce  {
    0%  {
      translate: calc(var(--dx) * (100% + 4px)) calc(var(--dy) * (100% + 4px));
      scale: 1;
    }
    50%  {
      translate: calc(var(--dx) * (50% + 2px)) calc((var(--dy) * (50% + 2px)) - 70%);
      scale: 1.3;
    }
    80%  {
      translate: 0 0;
      scale: 1.1 0.9;
    }
    90%  {
      translate: 0 -12%;
      scale: 1;
    }
    100%  {
      translate: 0 0;
    }
  }
  @keyframes bw-shake  {
    25%  {
      translate: -3px 0;
    }
    75%  {
      translate: 3px 0;
    }
  }
  @keyframes bw-float  {
    from  {
      opacity: 1;
      translate: -50% 0;
    }
    to  {
      opacity: 0;
      translate: -50% -2.5rem;
    }
  }
}
/* The site fills a pressed button in its states layer, which beats the components layer whatever the specificity. */
@layer states  {
  .bw-dice-row button.die[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"])  {
    background: transparent;
    color: var(--ink);
  }
}
