/* Word grid board (board.js). Colors only through the site's variables (tokens.css). Tiles are always light
   (bone on any background); a traced tile is a filled red block with light text, so Red Flare's rule holds. */

.wg { --wg-gap: 8px; display: grid; gap: 12px; width: 100%; max-width: 440px; margin: 0 auto; user-select: none; -webkit-user-select: none; }

.wg-word { min-height: 2.4em; display: flex; align-items: baseline; justify-content: center; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-accent); color: var(--iron-ink); }
.wg-word__text { font-size: 26px; font-weight: 600; letter-spacing: .12em; }
.wg--lost .wg-word__text { opacity: .45; text-decoration: line-through; text-decoration-thickness: 2px; }
.wg-word__note { font-size: 15px; letter-spacing: .06em; color: var(--iron-soft); }
.wg[data-note="good"] .wg-word__note { color: var(--iron-ink); font-weight: 600; }

.wg-grid { position: relative; display: grid; gap: var(--wg-gap); touch-action: none;
  grid-template-columns: repeat(var(--wg-size, 5), minmax(0, 1fr)); }
.wg-tile { position: relative; z-index: 1; aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px;
  font-family: var(--font-accent); font-weight: 700; font-size: clamp(24px, 8vw, 38px); line-height: 1;
  color: var(--paper-title); background: var(--paper-card); cursor: pointer;
  box-shadow: 0 3px 0 color-mix(in oklab, var(--paper-rule) 70%, var(--color-deep)); transition: transform .08s; }
.wg-tile small { font-size: .5em; margin-left: 1px; }
.wg-tile.on { color: var(--on-ember); background: var(--ember); transform: translateY(2px);
  box-shadow: 0 1px 0 var(--flare-deep); }
.wg--off .wg-tile { cursor: default; }

.wg-line { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; overflow: visible; }
.wg-line polyline, .wg-line path { fill: none; stroke: var(--ember); stroke-width: 10px; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }

.wg-tile.good { animation: wg-good .45s ease-out; }
.wg-tile.shake { animation: wg-shake .35s ease-in-out; }
@keyframes wg-good { 0% { transform: scale(1.12); box-shadow: 0 0 0 4px var(--iron-ink); } 100% { transform: none; } }
@keyframes wg-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .wg-tile.good, .wg-tile.shake { animation: none; } }

/* Wrap (setRules({ wrap: true })): the grid steps in so faded copies of the far edges can peek in around it */
.wg { --wg-peek: clamp(30px, 9vw, 40px); }
.wg--wrap .wg-grid { padding: var(--wg-peek); }
.wg-ghosts { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
  border-radius: 14px; outline: 2px dashed color-mix(in oklab, var(--iron-ink) 35%, transparent); outline-offset: -2px; }
.wg .wg-tile.wg-ghost { position: absolute; aspect-ratio: auto; opacity: .5; cursor: default; box-shadow: none; font-size: clamp(15px, 4.5vw, 22px); border-radius: 8px; }
