/* Matching exercises — public practice pages. Everything is scoped under #match. */
#match {
  --m-purple: #800080; --m-tray: #ffffdd; --m-slot: #ffffcc; --m-correct: #99ff33; --m-wrong: #ff6b6b;
  max-width: 760px; margin: 0 auto;
  font-family: Verdana, "Lucida Grande", sans-serif; color: #333; text-align: left; line-height: 1.35;
}
#match *, #match *::before, #match *::after { box-sizing: border-box; }
#match h1, #match h2, #match p { font-family: inherit; text-transform: none; letter-spacing: normal; line-height: 1.3; }
#match p { font-weight: normal; }
#match button {
  font-family: Arial, sans-serif; text-transform: none; letter-spacing: normal; text-decoration: none;
  box-shadow: none; min-width: 0; min-height: 0; margin: 0; -webkit-appearance: none; appearance: none;
}
#match a { color: var(--m-purple); }

#match .match-title { text-align: center; padding: 8px 12px; background: #ebedf2; border: 2px solid var(--m-purple); margin: 0 0 12px; }
#match .match-title h1 { margin: 6px 0; color: var(--m-purple); font-size: clamp(18px, 4vw, 24px); font-weight: bold; }
#match .match-subtitle { font-size: 13px; color: #666; margin: 0 0 4px; }
#match .match-instructions { text-align: center; color: var(--m-purple); font-size: 15px; margin: 0 0 10px; }
#match .match-status { text-align: center; min-height: 1.4em; font-size: 14px; margin: 6px 0; }
#match .match-status.good { color: #2a7a00; }
#match .match-status.bad { color: #b00020; }

#match .match-tray {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  min-height: 56px; padding: 12px; background: var(--m-tray);
  border: 1px solid #333; border-radius: 10px; box-shadow: 0 0 .3em rgba(0,0,0,.6);
}
#match .match-tray[hidden] { display: none; }
#match .match-card, .match-ghost {
  font-family: Arial, sans-serif; font-size: 15px; line-height: 1.2; color: #000;
  background: #fff; border: 1px solid #333; border-radius: 3px;
  padding: 8px 12px; width: auto; height: auto;
}
#match .match-card {
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#match .match-card:focus-visible, #match .match-slot:focus-visible { outline: 3px solid #1a73e8; outline-offset: 1px; }
#match .match-card.selected { outline: 3px solid var(--m-purple); outline-offset: 1px; background: #f3e6f3; }
#match .match-card.dragging-source { opacity: .3; }
#match .match-card.shake { animation: match-shake .35s; }
.match-ghost {
  position: fixed; z-index: 100000; pointer-events: none; margin: 0; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,.35);
}

#match .match-table { margin-top: 6px; }
#match .match-head, #match .match-row {
  display: grid; grid-template-columns: minmax(120px, 34%) 1fr; column-gap: 16px; align-items: center;
}
#match .match-head { font-weight: bold; text-decoration: underline; font-size: 16px; padding: 4px 0 8px; }
#match .match-row { padding: 10px 0; border-top: 1px solid #ddd; }
#match .match-slot {
  height: 44px; width: 100%; padding: 4px 6px;
  background: var(--m-slot); border: 1px dashed #b5ae6e; border-radius: 3px;
  font-size: 15px; color: #000; cursor: pointer;
}
#match .match-slot.hovered { background: #bbb; }
#match .match-slot.filled { background: var(--m-correct); border: 1px solid #333; cursor: default; opacity: 1; }
#match .match-slot.flash-wrong { animation: match-flash .5s; }
#match .match-desc { font-size: 16px; }
#match .match-why {
  grid-column: 1 / -1; margin-top: 8px; padding: 8px 10px; font-size: 14px;
  background: #f4f8ff; border-left: 4px solid #1a73e8;
}
#match .match-why[hidden] { display: none; }

#match .match-success {
  text-align: center; background: #ddffdd; border: 2px solid #333; border-radius: 10px;
  padding: 14px 20px; margin: 8px 0 10px;
}
#match .match-success[hidden] { display: none; }
#match .match-success h2 { margin: 0 0 6px; font-size: 22px; color: #333; font-weight: bold; }
#match .match-success p { margin: 0 0 8px; font-size: 14px; }
#match .match-success button {
  font-family: Verdana, sans-serif; font-size: 15px; padding: 8px 18px; border-radius: 6px;
  border: 1px solid #333; background: #fff; color: #000; cursor: pointer; width: auto; height: auto;
}

#match .match-footer { margin-top: 22px; padding-top: 10px; border-top: 1px solid #ccc; text-align: center; font-size: 13px; }
#match .match-footer p { margin: 4px 0; }
#match .match-footer .match-legal { font-size: 11px; color: #777; }

@media (max-width: 480px) {
  #match .match-head, #match .match-row { grid-template-columns: 42% 1fr; column-gap: 10px; }
  #match .match-desc { font-size: 14px; }
  #match .match-card, #match .match-slot { font-size: 14px; }
}
@keyframes match-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes match-flash { 0%,100% { background: var(--m-slot); } 30% { background: var(--m-wrong); } }
@media (prefers-reduced-motion: reduce) { #match .match-card.shake, #match .match-slot.flash-wrong { animation: none; } }
