body {
  align-items: flex-start;
  overflow-x: hidden;
}

/* ── Solved groups ───────────────────── */
#solved {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.solved-group {
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.solved-group.animate {
  animation: groupReveal 400ms ease;
}
@keyframes groupReveal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.solved-group-name {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.solved-group-words {
  font-size: 15px;
  font-weight: 600;
}

/* ── Word grid ───────────────────────── */
#grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.word-tile {
  background: #27272a;
  color: #fff;
  border: none;
  border-radius: 10px;
  aspect-ratio: 1;
  padding: 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
  user-select: none;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  word-break: break-word;
  min-width: 0;
}
@media (min-width: 500px) {
  .word-tile {
    font-size: 15px;
  }
}
.word-tile:hover {
  background: #3f3f46;
}
.word-tile.selected {
  background: #52525b;
  transform: scale(0.95);
}
.word-tile.shake {
  animation: tileShake 400ms ease;
}
@keyframes tileShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Mistakes ────────────────────────── */
#mistakes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.mistakes-label {
  font-size: 14px;
  color: #71717a;
}
.mistake-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #27272a;
  display: inline-block;
  margin: 0 2px;
  transition: opacity 300ms ease;
}
.mistake-dot.used {
  opacity: 0.15;
}

/* ── Controls ────────────────────────── */
#controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── Result overlay (game-specific) ─── */
.result-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.result-group {
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.result-group-name {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.result-group-words {
  font-size: 14px;
  font-weight: 600;
}
