.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  flex: 1;
  align-content: start;
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 14px 16px;
  border: 5px solid var(--tone);
  border-radius: 22px;
  box-shadow: 0 6px 0 rgb(31 36 64 / 0.22);
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: pre-line;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tile[data-side="term"] {
  --tone: #5b3df5;
  background: var(--tone);
  color: #fff;
  font-size: 1.3rem;
}

.tile[data-side="definition"] {
  --tone: #0b7f7a;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.tile.selected {
  outline: 4px solid var(--ink);
  outline-offset: 3px;
}

.tile.dragging {
  z-index: 10;
  cursor: grabbing;
  box-shadow: 0 16px 24px rgb(31 36 64 / 0.35);
}

.tile.target {
  outline: 4px dashed var(--ink);
  outline-offset: 3px;
}

.tile.wrong {
  animation: tile-shake 350ms ease;
  border-color: #d6336c;
}

.tile.matched {
  cursor: default;
  border-color: #2f9e44;
  background: #d3f9d8;
  color: var(--ink);
  box-shadow: none;
  opacity: 0.75;
}

.tile:not(.matched) {
  cursor: grab;
}

.done {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  font-weight: 800;
  text-align: center;
}

.done[hidden] {
  display: none;
}


@keyframes tile-shake {
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .tile.wrong {
    animation: none;
  }
}
