/* Fourfold. */

.ff { container-type: inline-size; padding: 0.5rem 0 0.25rem; }

/* a group that has been sorted: a bar of the game's own ochre with its link and its four words */
.ff-found { display: grid; gap: 6px; }
.ff-found:not(:empty) { margin-bottom: 6px; }
.ff-group {
  display: grid; gap: 0.25rem; justify-items: center; text-align: center; padding: 0.75rem 0.5rem; border-radius: 6px;
  background: var(--c); color: #fff;
}
.ff-group strong { font: 600 1.0625rem/1.2 var(--sans); }
.ff-group span { font: 400 1rem/1.3 var(--sans); }
/* a group shown because the guesses ran out is outlined, not filled: it was not found */
.ff-group.missed { background: var(--sheet); color: var(--ink); border: 1.5px dashed var(--c); }

/* links a hint has named, until their groups are found */
.ff-hints p { margin: 0 0 6px; padding: 0.5rem 0.75rem; border-left: 3px solid var(--c); background: var(--sheet); font: 400 1rem/1.3 var(--sans); }
.ff-hints b { font-weight: 600; }

/* The tiles: four to a row, paper on paper. A word is never under 15px, and the gaps are fixed
   sizes so that an eight-letter word fits a tile on a 320px phone however large the text is set. */
.ff-tiles {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ff-tiles[hidden] { display: none; }
.ff-tile {
  min-height: clamp(52px, 17cqw, 4.25rem); padding: 0 1px; border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet); color: var(--ink);
  font: 600 clamp(15px, 4.4cqw, 1.125rem)/1.1 var(--sans); letter-spacing: -0.01em; cursor: pointer;
  display: grid; place-items: center; overflow: hidden; -webkit-tap-highlight-color: transparent;
}
.ff-tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; z-index: 1; }
/* a picked tile is filled with ink and carries a heavier edge, so it is told apart without colour */
.ff-tile.on { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--ink); }

/* what happened to the last guess, in words */
.ff-note { min-height: 1.5rem; margin: 0.625rem 0 0; text-align: center; font: 400 1rem/1.4 var(--sans); color: var(--ink); }

.ff-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; padding-top: 0.625rem; }
.ff-actions .btn { flex: 1 1 auto; padding: 0 0.5rem; }

/* a wrong guess: the four tiles shake once, unless motion is to be kept down */
@keyframes ff-shake {
  20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); }
}
@media (prefers-reduced-motion: no-preference) {
  .ff-tile.shake { animation: ff-shake 0.36s ease-in-out; }
}

/* On the narrowest phones every pixel of a tile goes to its word: the widest word the bank shows
   (Showdown) is 70.5px across at 15px with its letters drawn closer, and a tile holds 70.75. A test
   measures every word of the bank against this. */
@media (max-width: 22.5rem) {
  .ff-tiles, .ff-found { gap: 3px; }
  .ff-tile { padding: 0; letter-spacing: -0.025em; }
  /* the board's side padding grows with the text; the tiles take that growth back, so they keep their 72px */
  .ff { margin-inline: calc(10px - 0.625rem); }
}

/* Where the system sets the colours, a picked tile and a found group keep a sign. */
@media (forced-colors: active) {
  .ff-tile.on { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; box-shadow: none; }
  .ff-group { border: 2px solid CanvasText; }
}

/* the answers page: the four links, each with its words */
.ff-answer { margin: 1rem 0 1.5rem; display: grid; gap: 6px; max-width: 30rem; }


/* While the board loads, about the room it will take (game.css): the drawn board measured 321px at 320 wide, 367 at 412,
   394 from 600. */
#board { --board-wait: min(calc(50vw + 161px), 394px); }
