/* Esercizi «associa gli animali alle caratteristiche» (trascinamento).
   Usato dalla lezione «Le caratteristiche degli animali»; il comportamento sta in match.js.
   Se si cambia questo file va alzato MATCH_ASSET_VERSION in scripts/create-animals-vocabulary.mjs. */

.match-section {
  border-top: 1px solid var(--line);
  background: #f4ede4;
}
.match-section.match-negative {
  background: #fffaf4;
}
.match-lesson-link {
  margin: -6px 0 22px;
  color: var(--muted);
}
.match-lesson-link a {
  color: var(--primary);
  font-weight: 800;
}
.match-progress-box .match-progress-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  margin: 10px 0 0;
}
.match-reset {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}
.match-reset:hover {
  background: #fff2e7;
}
.match-complete {
  color: #116846;
  font-weight: 850;
}

.match-set {
  margin-top: 30px;
}
.match-set-title {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.match-rows {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.match-row {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(0, 2fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(35, 29, 23, 0.05);
}
.match-row.is-done {
  border-color: #16824f;
  background: #f2fbf6;
}
.match-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.match-num {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--dark);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}
.match-trait {
  font-family: Georgia, serif;
  font-size: 1.28rem;
  line-height: 1.2;
}
.match-not {
  margin-right: 4px;
  color: #a53a28;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.72em;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.match-drop {
  display: flex;
  min-height: 62px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: #fffaf4;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.match-drop:empty::before {
  content: attr(data-empty);
  color: var(--muted);
  font-size: 0.88rem;
}
.match-drop:focus-visible {
  outline: 3px solid rgba(181, 63, 39, 0.35);
  outline-offset: 2px;
}
.match-drop.is-ready,
.match-drop.is-over {
  border-color: var(--primary);
  background: #fff2e7;
}
.match-drop.is-over {
  border-style: solid;
}
.match-hint {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}
.match-hint:hover {
  background: #fff2e7;
}
.match-feedback {
  grid-column: 1 / -1;
  min-height: 0;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 800;
}
.match-feedback:empty {
  display: none;
}
.match-feedback.is-ok {
  color: #116846;
}
.match-feedback.is-bad {
  color: #a53a28;
}

.match-placed {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px 3px 3px;
  border: 1px solid;
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}
.match-placed img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}
.match-placed.is-ok {
  border-color: #16824f;
  background: #e7f7ee;
  color: #116846;
}
.match-placed.is-ok::after {
  content: '✓';
}
.match-placed.is-bad {
  border-color: #c6624f;
  background: #fdece8;
  color: #a53a28;
  cursor: default;
  animation: match-shake 0.4s;
}
.match-placed.is-bad::after {
  content: '✗';
}
@keyframes match-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* La barra degli animali resta in basso mentre si scorrono le righe. */
.match-tray {
  position: sticky;
  bottom: 0;
  z-index: 12;
  margin-top: 16px;
  padding: 10px 12px 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 244, 0.97);
  box-shadow: 0 -8px 26px rgba(35, 29, 23, 0.12);
  backdrop-filter: blur(10px);
}
.match-tray-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}
.match-bank {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0 0 4px;
  overflow-x: auto;
  list-style: none;
}
.match-chip {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 92px;
  padding: 6px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
}
.match-chip img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  mix-blend-mode: multiply; /* il bianco delle foto ritoccate senza ritaglio sparisce anche sul fondo colorato */
  pointer-events: none;
  -webkit-user-drag: none;
}
.match-chip:hover {
  background: #fff7ed;
}
.match-chip[aria-pressed='true'] {
  border-color: var(--primary);
  background: #fff2e7;
  box-shadow: 0 0 0 3px rgba(181, 63, 39, 0.25);
}
.match-chip.is-dragging {
  opacity: 0.35;
}
.match-chip.is-hint {
  animation: match-pulse 0.7s ease-in-out 3;
}
@keyframes match-pulse {
  50% {
    box-shadow: 0 0 0 5px rgba(22, 130, 79, 0.45);
    background: #e7f7ee;
  }
}
.match-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  opacity: 0.95;
  box-shadow: 0 14px 30px rgba(35, 29, 23, 0.28);
  transform: translate(-50%, -60%) scale(1.06);
}

/* Righe con una foto al posto della parola, barra con parole senza immagine (i verbi delle relazioni). */
.match-photo {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
}
.match-chip.match-chip-word {
  width: auto;
  min-height: 44px;
  justify-content: center;
  padding: 8px 14px;
  font-size: 0.92rem;
}
.match-placed:not(:has(img)) {
  padding-left: 12px;
}

@media (max-width: 720px) {
  .match-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .match-prompt {
    grid-column: 1 / -1;
  }
  .match-drop {
    grid-column: 1 / 2;
  }
  .match-hint {
    grid-column: 2 / 3;
  }
  .match-chip {
    width: 84px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .match-placed.is-bad,
  .match-chip.is-hint {
    animation: none;
  }
}

/* Schede divise in gruppi con un titolo (2026-10-06, «I verbi di influenza»): il paragrafo sull'ordine e
   i titoli dei gruppi occupano tutta la riga della griglia. */
.word-grid > .word-group-intro {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}
.word-grid > .word-group-title {
  grid-column: 1 / -1;
  margin: 28px 0 -2px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}
.word-group-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
