/* Groups: periwinkle. Soft periwinkle tiles that go deep periwinkle when
   picked; a solved group becomes a bar in its level's color, its name set in
   the slab face. Level colors: mint (plain), gold, sky, orchid (wordplay). */

:root {
  --peri: #8e9cf9; --peri-ink: #4a55c4; --tile: #eceefc; --tile-hover: #e0e3fa;
  --lv1: #a8dcb9; --lv2: #f3cf63; --lv3: #a4c6f4; --lv4: #d3a6ee;
}
.groups { --game: var(--peri); gap: 14px; padding-top: 16px; }

.lead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0; font-size: 16px; }
.lead .pnum { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.board { display: grid; gap: 8px; }
.solved { display: grid; gap: 8px; }
.solved:empty { display: none; }
.bar {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 76px; padding: 10px 12px; border-radius: 8px; text-align: center;
}
.bar b { font: 700 19px/1.15 var(--slab); }
.bar span { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.bar.fresh { animation: settle 0.35s var(--ease); }
.bar.missed { opacity: 0.85; }
@keyframes settle { from { transform: scale(0.96); opacity: 0.4; } }
.lv1 { background: var(--lv1); }
.lv2 { background: var(--lv2); }
.lv3 { background: var(--lv3); }
.lv4 { background: var(--lv4); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* each word shrinks to fit its tile (--n = its length), so nothing breaks mid-word */
.tile {
  container-type: inline-size;
  display: grid; place-items: center; min-width: 0; height: 76px; padding: 0; border: 0; border-radius: 8px;
  background: var(--tile); color: var(--ink); cursor: pointer; user-select: none;
  font: 700 16px/1.1 var(--ui); text-transform: uppercase; white-space: nowrap;
  transition: background 0.12s, transform 0.08s;
}
.tile span { font-size: min(16px, calc(112cqi / var(--n))); }
.tile:hover { background: var(--tile-hover); }
.tile:active { transform: scale(0.96); }
.tile.on, .tile.on:hover { background: var(--peri-ink); color: #fff; }
.tile.hop { animation: hop 0.3s var(--ease); animation-delay: calc(var(--i) * 70ms); }
@keyframes hop { 40% { transform: translateY(-7px); } }

.left { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 22px; margin: 2px 0 0; font-size: 14px; }
.dots { display: inline-flex; gap: 7px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--peri-ink); transition: background 0.2s, transform 0.2s; }
.dots i.used { background: #dcdcdc; transform: scale(0.8); }

.actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.actions .btn { height: 46px; padding: 0 18px; }

/* modals */
.share-grid { display: grid; justify-content: center; gap: 4px; margin: 0 0 16px; }
.share-grid div { display: flex; gap: 4px; }
.share-grid i { width: 26px; height: 26px; border-radius: 4px; }
.levels { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; font-size: 15px; }
.levels i { width: 22px; height: 22px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  .bar.fresh, .grid.shake, .tile.hop { animation: none; }
  .tile, .dots i { transition: none; }
}
