/* Word search (js/games/word-search.js). Kit styles: css/game.css. Sizes come from the
 * layout in JS: --ws-cell on .ws-board, font-size on .ws-list. */

.ws-room { position: absolute; inset: 0; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; background: var(--surface-100); }

/* the grid */
.ws-board {
  position: absolute; touch-action: none; cursor: pointer;
  border-radius: var(--radius-md); background: var(--surface-200); box-shadow: 0 0 0 1px var(--line);
}
.ws-grid { position: absolute; inset: 0; z-index: 2; display: grid; grid-auto-rows: var(--ws-cell); pointer-events: none; }
.ws-cell {
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  font: 500 calc(var(--ws-cell) * .68)/1 var(--font-sans); color: var(--ink); text-transform: uppercase;
  transition: color .15s ease;
}
.ws-cell.ws-on { color: var(--on-toy); font-weight: 600; }
/* keyboard cursor: Arrow keys move it, Enter picks the first and last letter */
.ws-cell:focus { outline: none; }
.ws-cell:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -2px; border-radius: 50%; }
.ws-cell[aria-pressed="true"] { font-weight: 700; }

/* bands: found words in the toy colours, and the live selection */
.ws-bands { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ws-band { position: absolute; border-radius: 999px; transform-origin: 50% 50%; pointer-events: none; }
.ws-band[hidden] { display: none; }
.ws-found { background: var(--toy); }
.ws-toy-blue { --toy: var(--toy-blue); }
.ws-toy-butter { --toy: var(--toy-butter); }
.ws-toy-pink { --toy: var(--toy-pink); }
.ws-toy-mint { --toy: var(--toy-mint); }
.ws-pop { animation: ws-pop .35s ease-out; }
@keyframes ws-pop { from { opacity: 0; } to { opacity: 1; } }
.ws-sel {
  z-index: 1; background: color-mix(in srgb, var(--accent) 28%, transparent);
  box-shadow: inset 0 0 0 3px var(--accent); transition: opacity .4s ease;
}
.ws-sel.ws-sel-no { opacity: 0; }

/* hint: a steady ring around a first letter; the outer halo breathes three times, then stays still */
.ws-cell.ws-hint { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); animation: ws-glow 1.2s ease-in-out 3; }
@keyframes ws-glow { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); } }

/* the word list */
.ws-list {
  position: absolute; z-index: 3; margin: 0; padding: 0; list-style: none;
  display: grid; align-content: start; column-gap: .9em; overflow: hidden;
}
.ws-word { display: flex; align-items: center; gap: .55em; min-height: 2.1em; min-width: 0; color: var(--ink); font-weight: 500; letter-spacing: .04em; line-height: 1.1; }
.ws-swatch { flex: none; width: .8em; height: .8em; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line-strong); }
.ws-text { overflow-wrap: anywhere; }
.ws-word.is-found { color: var(--ink-muted); }
.ws-word.is-found .ws-text { text-decoration: line-through; text-decoration-thickness: 2px; }
.ws-word.is-found .ws-swatch { background: var(--ws-toy); box-shadow: none; }

/* finished: the grid gets a gentle green edge while the result comes up */
.ws-done .ws-board { box-shadow: 0 0 0 2px var(--positive), 0 12px 40px rgba(0, 0, 0, .3); transition: box-shadow .6s ease; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .ws-cell.ws-hint { animation: none; }
  .ws-pop { animation: none; }
  .ws-sel, .ws-cell { transition: none; }
}
