/* games/match_pairs/match_pairs.css */

/* Spielkarte */
.mp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 18px 20px 20px;
  border-radius: 24px;
  background: radial-gradient(circle at top left, #f6f7ff 0, #eef0ff 38%, #ffffff 100%);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16);
  color: #1c2342;
  overflow: hidden;
}

/* dezentes Schimmer-Overlay */
.mp-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(232, 189, 79, 0.15), transparent 55%);
  opacity: 0.7;
  pointer-events: none;
}

/* Meta-Infos */
.mp-meta-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: #6b6f76;
  z-index: 1;
}

.mp-topic {
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mp-counter {
  opacity: 0.8;
}

/* ==============================
   Question-Box: echte Frage
   ============================== */

.mp-question {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  background: linear-gradient(135deg, #f7f7fb, #eef0f7);
  border: 1px solid rgba(28, 35, 66, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.mp-question-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1c2342;
  line-height: 1.4;
}

.mp-hint {
  font-size: 0.82rem;
  color: rgba(28, 35, 66, 0.45);
  font-style: italic;
  border-top: 1px solid rgba(28, 35, 66, 0.07);
  padding-top: 6px;
}

/* ==============================
   Begriff-Karte (fliegt ein/aus)
   ============================== */

.mp-term-section {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
}

.mp-term-progress {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(28, 35, 66, 0.4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Dunkle Begriff-Karte */
.mp-term-box {
  width: 100%;
  text-align: center;
  padding: 18px 20px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, #2b355e 0, #1c2342 45%, #151a30 100%);
  color: #f9fafb;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Golddot oben rechts */
.mp-term-box::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #e8bd4f;
  opacity: 0.8;
}

/* Fly-in: von unten mit Bounce */
.mp-term-box--in {
  animation: mp-term-fly-in 0.55s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

/* Fly-out: nach oben mit kurzem Rückzieher */
.mp-term-box--out {
  animation: mp-term-fly-out 0.32s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes mp-term-fly-in {
  0%   { opacity: 0; transform: translateY(52px) scale(0.86) rotate(-2deg); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes mp-term-fly-out {
  0%   { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
  25%  { transform: translateY(5px) scale(1.03) rotate(0.5deg); }
  100% { opacity: 0; transform: translateY(-36px) scale(0.88) rotate(1.5deg); }
}

/* ==============================
   Options (Matching-Phase)
   ============================== */

.mp-options-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.mp-option {
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(232, 189, 79, 0.6);
  background: #fffaf0;
  color: #1c2342;
  font-size: 0.95rem;
  line-height: 1.35;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.06s ease,
    opacity 0.2s ease;
  box-shadow: 0 3px 10px rgba(232, 189, 79, 0.2);
}

.mp-option:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(232, 189, 79, 0.35);
}

.mp-option:active:not(:disabled) {
  transform: translateY(0);
}

.mp-option--used {
  opacity: 0.28;
  cursor: default;
  border-color: rgba(28, 35, 66, 0.1);
  background: #f7f7fb;
  box-shadow: none;
}

@media (hover: none) {
  .mp-option:hover:not(:disabled) {
    transform: none;
    box-shadow: 0 3px 10px rgba(232, 189, 79, 0.2);
  }
}

/* ==============================
   Review-Phase: Step-by-Step
   ============================== */

.mp-review-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.mp-review-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;

  /* Step-by-step: startet unsichtbar */
  opacity: 0;
  animation: mp-review-pair-in 0.45s ease-out forwards;
  animation-delay: var(--delay, 0s);
}

.mp-review-pair--correct {
  background: linear-gradient(135deg, #e8f5e9, #f7fff9);
  border-color: #2e7d32;
}

.mp-review-pair--wrong {
  background: linear-gradient(135deg, #ffebee, #fff5f5);
  border-color: #c62828;
}

.mp-review-term {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1c2342;
}

/* Icon stampft nach kurzer Verzögerung rein */
.mp-review-icon {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  animation: mp-icon-stamp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: calc(var(--delay, 0s) + 0.3s);
}

.mp-review-pair--correct .mp-review-icon { color: #2e7d32; }
.mp-review-pair--wrong  .mp-review-icon { color: #c62828; }

.mp-review-answer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.mp-review-chosen {
  font-size: 0.88rem;
  color: #1c2342;
  line-height: 1.3;
}

.mp-review-pair--wrong .mp-review-chosen {
  color: #c62828;
  text-decoration: line-through;
}

.mp-review-correct-hint {
  font-size: 0.78rem;
  color: #2e7d32;
  font-style: italic;
  line-height: 1.3;
}

/* ==============================
   Animationen
   ============================== */

@keyframes mp-review-pair-in {
  0%   { opacity: 0; transform: translateY(22px) scale(0.92); }
  60%  { opacity: 1; transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mp-icon-stamp {
  0%   { opacity: 0; transform: scale(0.1) rotate(-30deg); }
  50%  { opacity: 1; transform: scale(1.55) rotate(8deg); }
  72%  { transform: scale(0.88) rotate(-4deg); }
  88%  { transform: scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ==============================
   Mobile Feintuning
   ============================== */

@media (max-width: 600px) {
  .mp-card {
    gap: 8px;
    padding: 28px 14px calc(env(safe-area-inset-bottom, 0px) + 44px);
    border-radius: 18px;
  }

  /* Matching-Phase: Vollbild, Buttons unten */
  .mp-card--matching {
    min-height: 100%;
  }

  .mp-card--matching .mp-options-wrap {
    margin-top: auto;
  }

  /* Footer in beiden Phasen klein halten */
  .mp-card .game-footer-row {
    margin-top: 0;
    padding-bottom: 0;
  }

  .mp-card .game-feedback {
    min-height: 0;
    margin-bottom: 0;
  }

  .mp-meta-row {
    font-size: 0.85rem;
  }

  .mp-question {
    margin-top: 10px;
    padding: 12px;
  }

  .mp-question-text {
    font-size: 0.95rem;
  }

  .mp-term-box {
    font-size: 1rem;
    padding: 16px 16px;
  }

  .mp-options-wrap {
    gap: 14px;
  }

  .mp-option {
    font-size: 17px;
    padding: 14px 12px;
  }

  .mp-review-wrap {
    gap: 8px;
  }

  .mp-review-pair {
    padding: 10px 10px;
    gap: 8px;
  }

  .mp-review-term {
    font-size: 0.82rem;
  }

  .mp-review-chosen {
    font-size: 0.8rem;
  }

  .mp-review-correct-hint {
    font-size: 0.72rem;
  }
}
