/* ============================================================
   Learn Languages — Games Engine Styles
   Loaded only on lesson.php (alongside flashcard.css)
   ============================================================ */

/* ---- Overlay ---------------------------------------------- */
.lrn-games-overlay {
  position: fixed;
  inset: 0;
  z-index: 9150;
  background: linear-gradient(160deg, #e0f2fe 0%, #ede9fe 50%, #fef9f0 100%);
  color: #1e1b4b;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Nunito', 'Poppins', system-ui, sans-serif;
}
.lrn-games-overlay[hidden] { display: none; }

/* Decorative blobs */
.lrn-games-overlay::before,
.lrn-games-overlay::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.2;
}
.lrn-games-overlay::before {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #7dd3fc, transparent 70%);
  top: -80px; right: -60px;
  animation: gBlobA 9s ease-in-out infinite alternate;
}
.lrn-games-overlay::after {
  width: 280px; height: 280px;
  background: radial-gradient(circle, #fbbf24, transparent 70%);
  bottom: -60px; left: -40px;
  animation: gBlobB 11s ease-in-out infinite alternate;
}
@keyframes gBlobA { from { transform: scale(1); } to { transform: translate(20px,25px) scale(1.15); } }
@keyframes gBlobB { from { transform: scale(1); } to { transform: translate(-15px,-20px) scale(1.1); } }

/* All screens above blobs */
.lrn-gp-wrap,
.lrn-gplay-wrap,
.lrn-gr-wrap { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }

/* ======================================================
   PICKER SCREEN
   ====================================================== */
.lrn-gp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  flex-shrink: 0;
}
.lrn-gp-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #1e1b4b;
  letter-spacing: -0.02em;
}
.lrn-gp-close {
  background: rgba(124,58,237,.1);
  border: 2px solid rgba(124,58,237,.2);
  color: #7c3aed;
  border-radius: 50%;
  width: 2.2rem; height: 2.2rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
  transition: background 0.2s, transform 0.2s;
}
.lrn-gp-close:hover { background: rgba(124,58,237,.2); transform: rotate(90deg); }

/* Language pills */
.lrn-gp-lang-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.25rem 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.lrn-gp-lang-label { font-size: 0.78rem; font-weight: 800; color: #7c3aed; }
.lrn-gp-lang-pill {
  background: #fff;
  border: 2px solid #ddd6fe;
  color: #5b21b6;
  border-radius: 9999px;
  padding: 0.25rem 0.875rem;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.lrn-gp-lang-pill:hover  { border-color: #7c3aed; background: #ede9fe; }
.lrn-gp-lang-pill.active { background: #7c3aed; border-color: #7c3aed; color: #fff; }

/* Game grid */
.lrn-gp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  padding: 0 0.875rem 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

/* Game card */
.lrn-gp-card {
  background: #fff;
  border: 2.5px solid transparent;
  border-radius: 1.125rem;
  padding: 0.875rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
  position: relative;
  overflow: hidden;
}
.lrn-gp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, #7c3aed, #0369a1);
  border-radius: 1.25rem 1.25rem 0 0;
}
.lrn-gp-card:nth-child(2)::before { background: linear-gradient(90deg, #0369a1, #06b6d4); }
.lrn-gp-card:nth-child(3)::before { background: linear-gradient(90deg, #f97316, #eab308); }
.lrn-gp-card:nth-child(4)::before { background: linear-gradient(90deg, #0d9488, #22c55e); }
.lrn-gp-card:nth-child(5)::before { background: linear-gradient(90deg, #7c3aed, #06b6d4); }
.lrn-gp-card:nth-child(6)::before { background: linear-gradient(90deg, #f97316, #7c3aed); }
.lrn-gp-card:nth-child(7)::before { background: linear-gradient(90deg, #eab308, #f97316); }
.lrn-gp-card:nth-child(8)::before { background: linear-gradient(90deg, #22c55e, #06b6d4); }
.lrn-gp-card:nth-child(9)::before { background: linear-gradient(90deg, #0369a1, #7c3aed); }

.lrn-gp-card:hover:not(.disabled) {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 28px rgba(124,58,237,.18);
  border-color: rgba(124,58,237,.3);
}
.lrn-gp-card.disabled { opacity: 0.45; cursor: not-allowed; }

.lrn-gp-card-icon { font-size: 1.75rem; line-height: 1; margin-top: 0.15rem; }
.lrn-gp-card-name { font-size: 0.72rem; font-weight: 900; color: #1e1b4b; line-height: 1.2; }
.lrn-gp-card-desc { font-size: 0.62rem; font-weight: 600; color: #6b7280; line-height: 1.3; }
.lrn-gp-card-unavail {
  font-size: 0.58rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 9999px;
  padding: 0.1rem 0.4rem;
  font-weight: 700;
}

/* ======================================================
   PLAY SCREEN — HUD
   ====================================================== */
.lrn-gplay-wrap { overflow: hidden; }

.lrn-ghud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.35rem;
  flex-shrink: 0;
  gap: 0.5rem;
}
.lrn-ghud-left  { display: flex; align-items: center; }
.lrn-ghud-center { flex: 1; text-align: center; }
.lrn-ghud-right { display: flex; align-items: center; gap: 0.5rem; }

/* Timer circle */
.lrn-ghud-timer {
  position: relative;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.lrn-ghud-timer-svg { width: 44px; height: 44px; position: absolute; top: 0; left: 0; }
.lrn-ghud-timer-num {
  font-size: 0.8rem;
  font-weight: 900;
  color: #1e1b4b;
  position: relative;
  z-index: 1;
}

.lrn-ghud-mode-label { font-size: 0.75rem; font-weight: 800; color: #7c3aed; }

.lrn-ghud-streak {
  font-size: 0.78rem; font-weight: 800; color: #6b7280;
  display: flex; align-items: center; gap: 0.15rem;
  background: #fff; border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  border: 2px solid #e5e7eb;
  transition: all 0.3s;
}
.lrn-ghud-streak.hot { color: #ea580c; border-color: #fdba74; background: #fff7ed; animation: gHudPulse 0.5s ease; }

.lrn-ghud-mult {
  font-size: 0.78rem; font-weight: 900; color: #6b7280;
  background: #fff; border-radius: 9999px;
  padding: 0.2rem 0.5rem;
  border: 2px solid #e5e7eb;
  transition: all 0.3s;
  min-width: 2rem; text-align: center;
}
.lrn-ghud-mult.boosted { color: #7c3aed; border-color: #c4b5fd; background: #ede9fe; }

.lrn-ghud-score {
  font-size: 0.88rem; font-weight: 900; color: #1e1b4b;
  background: #fff; border-radius: 9999px;
  padding: 0.2rem 0.75rem;
  border: 2px solid #e5e7eb;
  min-width: 3.5rem; text-align: center;
  transition: transform 0.2s;
}
.lrn-ghud-score.flash { animation: gScoreFlash 0.4s ease; }

.lrn-ghud-close {
  background: rgba(239,68,68,.1);
  border: 2px solid rgba(239,68,68,.2);
  color: #ef4444;
  border-radius: 50%;
  width: 2.1rem; height: 2.1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem;
  transition: background 0.2s, transform 0.2s;
}
.lrn-ghud-close:hover { background: rgba(239,68,68,.2); transform: scale(1.1); }

@keyframes gHudPulse { from { transform: scale(1); } 50% { transform: scale(1.15); } to { transform: scale(1); } }
@keyframes gScoreFlash { 0% { transform: scale(1); } 40% { transform: scale(1.3); color: #7c3aed; } 100% { transform: scale(1); } }

/* Stage */
.lrn-gstage {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.lrn-gstage > * { width: 100%; max-width: 540px; }

/* ======================================================
   SHARED: Progress + Feedback
   ====================================================== */
.lrn-mc-progress {
  font-size: 0.72rem;
  font-weight: 800;
  color: #7c3aed;
  text-align: center;
  margin: 0.25rem 0 0.75rem;
}
.lrn-mc-feedback {
  text-align: center;
  padding: 0.6rem 1rem;
  border-radius: 0.875rem;
  font-size: 0.88rem;
  font-weight: 800;
  display: none;
  margin-top: 0.75rem;
  animation: gFeedback 0.25s cubic-bezier(.34,1.56,.64,1);
}
.lrn-mc-feedback.visible { display: block; }
.lrn-mc-feedback.great  { background: #d1fae5; color: #065f46; border: 2px solid #6ee7b7; }
.lrn-mc-feedback.wrong  { background: #fee2e2; color: #7f1d1d; border: 2px solid #fca5a5; }
@keyframes gFeedback { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ======================================================
   MULTIPLE CHOICE (guess-meaning, listen-guess, speed-round)
   ====================================================== */
.lrn-mc-wrap { display: flex; flex-direction: column; gap: 0; }

.lrn-mc-question {
  background: #fff;
  border: 2.5px solid #ede9fe;
  border-radius: 1.25rem;
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
  position: relative;
}
.lrn-mc-question::before {
  content: '';
  position: absolute;
  top: -2.5px; left: -2.5px; right: -2.5px;
  height: 6px;
  background: linear-gradient(90deg, #0369a1, #7c3aed, #f97316);
  border-radius: 1.25rem 1.25rem 0 0;
}
.lrn-mc-q-lang {
  font-size: 0.68rem; font-weight: 900; color: #7c3aed;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(124,58,237,.08); border-radius: 9999px;
  padding: 0.2rem 0.75rem; display: inline-flex;
  margin-bottom: 0.5rem;
}
.lrn-mc-q-phrase {
  font-size: clamp(1.3rem, 5vw, 1.9rem);
  font-weight: 900; color: #1e1b4b; line-height: 1.25;
}
.lrn-mc-q-roman { font-size: 0.9rem; color: #7c3aed; font-style: italic; font-weight: 600; margin-top: 0.25rem; }

/* Listen prompt */
.lrn-mc-listen-prompt {
  background: #fff;
  border: 2.5px solid #ede9fe;
  border-radius: 1.25rem;
  padding: 2rem 1rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
}
.lrn-mc-play-btn {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.5rem;
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  border: none; color: #fff; border-radius: 9999px;
  padding: 1rem 2.5rem; font-size: 1rem; font-weight: 900;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(124,58,237,.3);
}
.lrn-mc-play-btn:hover { transform: scale(1.05); box-shadow: 0 10px 28px rgba(124,58,237,.4); }
.lrn-mc-play-icon { font-size: 2.5rem; animation: gSpeakerBounce 2s ease infinite; }
@keyframes gSpeakerBounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* Image question */
.lrn-mc-image-q {
  background: #fff; border: 2.5px solid #ede9fe; border-radius: 1.25rem;
  padding: 0.75rem; text-align: center;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
}
.lrn-mc-q-image {
  border-radius: 0.875rem; max-height: 200px; width: auto; max-width: 100%;
  object-fit: cover; margin: 0 auto;
  border: 3px solid #ede9fe;
}

/* Choices */
.lrn-mc-choices {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.6rem; margin-top: 0.75rem;
}
.lrn-mc-choice {
  background: #fff;
  border: 2.5px solid #ddd6fe;
  border-radius: 1rem;
  padding: 0.75rem 0.5rem;
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  text-align: left;
}
.lrn-mc-choice:hover:not(:disabled) { border-color: #7c3aed; background: #faf5ff; transform: translateY(-1px); }
.lrn-mc-choice:disabled { cursor: default; }
.lrn-mc-choice.correct { background: #d1fae5; border-color: #6ee7b7; animation: gChoiceCorrect 0.4s ease; }
.lrn-mc-choice.wrong   { background: #fee2e2; border-color: #fca5a5; animation: gChoiceWrong 0.4s ease; }

@keyframes gChoiceCorrect { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes gChoiceWrong   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.lrn-mc-choice-letter {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  color: #fff; font-size: 0.72rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lrn-mc-choice.correct .lrn-mc-choice-letter { background: #059669; }
.lrn-mc-choice.wrong   .lrn-mc-choice-letter { background: #dc2626; }
.lrn-mc-choice-text { font-size: 0.82rem; font-weight: 700; color: #1e1b4b; line-height: 1.3; }

/* ======================================================
   BUILD THE SENTENCE
   ====================================================== */
.lrn-bs-wrap { display: flex; flex-direction: column; gap: 0.75rem; }

.lrn-bs-prompt {
  background: #fff; border: 2.5px solid #ede9fe; border-radius: 1.25rem;
  padding: 1rem; text-align: center;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
}
.lrn-bs-prompt-lang {
  font-size: 0.68rem; font-weight: 900; color: #7c3aed;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: rgba(124,58,237,.08); border-radius: 9999px;
  padding: 0.2rem 0.75rem; display: inline-flex; margin-bottom: 0.4rem;
}
.lrn-bs-prompt-text { font-size: 1.1rem; font-weight: 900; color: #1e1b4b; }
.lrn-bs-roman { font-size: 0.82rem; color: #7c3aed; font-style: italic; font-weight: 600; margin-top: 0.2rem; }

.lrn-bs-answer {
  min-height: 3.5rem;
  background: rgba(124,58,237,.04);
  border: 2.5px dashed #c4b5fd;
  border-radius: 1rem;
  padding: 0.6rem 0.75rem;
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  transition: border-color 0.2s;
}
.lrn-bs-answer.correct { border-color: #6ee7b7; background: #d1fae5; }
.lrn-bs-answer.wrong   { border-color: #fca5a5; background: #fee2e2; animation: gChoiceWrong 0.4s ease; }

.lrn-bs-bank {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: #fff; border: 2.5px solid #e5e7eb;
  border-radius: 1rem; min-height: 3rem;
}

.lrn-bs-word {
  background: linear-gradient(135deg, #ede9fe, #e0f2fe);
  border: 2px solid #c4b5fd;
  color: #1e1b4b; border-radius: 0.625rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.9rem; font-weight: 800; font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, opacity 0.15s;
}
.lrn-bs-word:hover:not(:disabled) { transform: translateY(-2px) scale(1.06); }
.lrn-bs-word.used { opacity: 0.3; cursor: default; }
.lrn-bs-word.in-answer {
  background: linear-gradient(135deg, #ddd6fe, #bae6fd);
  border-color: #7c3aed;
}

.lrn-bs-actions { display: flex; gap: 0.6rem; justify-content: center; }
.lrn-bs-clear-btn {
  background: #fff; border: 2.5px solid #e5e7eb; color: #6b7280;
  border-radius: 9999px; padding: 0.5rem 1.25rem;
  font-size: 0.85rem; font-weight: 800; font-family: inherit; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.lrn-bs-clear-btn:hover { border-color: #ef4444; color: #ef4444; }
.lrn-bs-check-btn {
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  border: none; color: #fff;
  border-radius: 9999px; padding: 0.5rem 1.75rem;
  font-size: 0.9rem; font-weight: 900; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 14px rgba(124,58,237,.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.lrn-bs-check-btn:hover { transform: translateY(-1px) scale(1.04); box-shadow: 0 8px 22px rgba(124,58,237,.4); }
.lrn-bs-check-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ======================================================
   MATCH THE PAIRS
   ====================================================== */
.lrn-mp-wrap { display: flex; flex-direction: column; gap: 0.6rem; }

.lrn-mp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0.25rem;
}
.lrn-mp-header-lang { font-size: 0.72rem; font-weight: 900; color: #7c3aed; text-transform: uppercase; letter-spacing: 0.06em; }
.lrn-mp-header-sep { flex: 1; height: 2px; background: linear-gradient(90deg, #c4b5fd, transparent, #c4b5fd); margin: 0 0.5rem; }

.lrn-mp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.lrn-mp-col  { display: flex; flex-direction: column; gap: 0.4rem; }

.lrn-mp-item {
  background: #fff;
  border: 2.5px solid #ddd6fe;
  border-radius: 0.875rem;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem; font-weight: 700; font-family: inherit;
  color: #1e1b4b; cursor: pointer; text-align: center;
  transition: all 0.2s;
  min-height: 3rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.15rem;
}
.lrn-mp-item-main  { display: block; line-height: 1.3; }
.lrn-mp-item-roman { display: block; font-size: 0.68rem; color: #7c3aed; font-style: italic; font-weight: 600; opacity: 0.85; }
.lrn-mp-item:hover:not(.matched) { border-color: #7c3aed; background: #faf5ff; transform: scale(1.03); }
.lrn-mp-item.selected { border-color: #7c3aed; background: #ede9fe; box-shadow: 0 0 0 3px rgba(124,58,237,.2); }
.lrn-mp-item.matched  { background: #d1fae5; border-color: #6ee7b7; color: #065f46; cursor: default; opacity: 0.7; }
.lrn-mp-item.wrong-flash { animation: gChoiceWrong 0.5s ease; border-color: #fca5a5; background: #fee2e2; }

.lrn-mp-progress { font-size: 0.72rem; font-weight: 800; color: #7c3aed; text-align: center; }

/* ======================================================
   MEMORY CARDS
   ====================================================== */
.lrn-mem-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.lrn-mem-status { font-size: 0.72rem; font-weight: 800; color: #7c3aed; text-align: center; }

.lrn-mem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.lrn-mem-card {
  aspect-ratio: 2/3;
  perspective: 600px;
  cursor: pointer;
}
.lrn-mem-card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(.34,1.3,.64,1);
  border-radius: 0.875rem;
}
.lrn-mem-card.flipped .lrn-mem-card-inner { transform: rotateY(180deg); }
.lrn-mem-card.matched .lrn-mem-card-inner { transform: rotateY(180deg); }
.lrn-mem-card.matched { opacity: 0.65; }

.lrn-mem-card-front,
.lrn-mem-card-back {
  position: absolute; inset: 0;
  border-radius: 0.875rem;
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 0.4rem;
  text-align: center;
}
.lrn-mem-card-front {
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  color: #fff; font-size: 1.5rem; font-weight: 900;
  border: 3px solid rgba(255,255,255,.2);
  box-shadow: 0 4px 12px rgba(124,58,237,.3);
}
.lrn-mem-card-back {
  background: #fff; border: 2.5px solid #ddd6fe;
  transform: rotateY(180deg);
  font-size: 0.72rem; font-weight: 800; color: #1e1b4b;
  box-shadow: 0 4px 12px rgba(124,58,237,.12);
  flex-direction: column; gap: 0.15rem;
}
.lrn-mem-card-roman { display: block; font-size: 0.6rem; color: #7c3aed; font-style: italic; font-weight: 600; opacity: 0.85; }
.lrn-mem-card.matched .lrn-mem-card-back { border-color: #6ee7b7; background: #d1fae5; }

/* ======================================================
   FILL IN THE BLANK
   ====================================================== */
.lrn-fib-q-src  { font-size: 0.9rem !important; color: #6b7280 !important; font-weight: 700 !important; }
.lrn-fib-roman  { font-size: 0.82rem; color: #7c3aed; font-style: italic; font-weight: 600; margin-top: 0.2rem; }
.lrn-fib-sentence {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 900; color: #1e1b4b; line-height: 1.4;
  margin-top: 0.5rem;
}
.lrn-fib-blank {
  display: inline-block;
  min-width: 4rem;
  border-bottom: 3px solid #7c3aed;
  color: transparent;
  background: rgba(124,58,237,.1);
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  vertical-align: bottom;
  transition: all 0.3s;
}
.lrn-fib-blank.filled-correct { background: #d1fae5; border-color: #059669; color: #065f46; }
.lrn-fib-blank.filled-wrong   { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }

/* ======================================================
   PRONUNCIATION
   ====================================================== */
.lrn-pron-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; text-align: center;
}
.lrn-pron-phrase {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 900; color: #1e1b4b;
  background: #fff; border: 2.5px solid #ede9fe;
  border-radius: 1.25rem; padding: 1.25rem 1.5rem;
  width: 100%; box-shadow: 0 4px 16px rgba(124,58,237,.1);
}
.lrn-pron-roman { font-size: 0.9rem; color: #7c3aed; font-style: italic; font-weight: 600; }
.lrn-pron-listen-btn {
  background: #fff; border: 2.5px solid #ddd6fe; color: #7c3aed;
  border-radius: 9999px; padding: 0.5rem 1.5rem;
  font-size: 0.88rem; font-weight: 800; font-family: inherit; cursor: pointer;
  transition: all 0.2s;
}
.lrn-pron-listen-btn:hover { background: #ede9fe; border-color: #7c3aed; }

.lrn-pron-mic-btn {
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  border: none; color: #fff;
  border-radius: 9999px; padding: 0.75rem 2rem;
  font-size: 1rem; font-weight: 900; font-family: inherit; cursor: pointer;
  box-shadow: 0 6px 20px rgba(124,58,237,.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.lrn-pron-mic-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 28px rgba(124,58,237,.45); }
.lrn-pron-mic-btn.listening {
  background: linear-gradient(135deg, #dc2626, #f97316);
  animation: gMicPulse 1s ease infinite;
}
.lrn-pron-mic-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

@keyframes gMicPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%      { box-shadow: 0 0 0 12px rgba(220,38,38,0); }
}

.lrn-pron-score-wrap {
  background: #fff; border: 2.5px solid #ede9fe;
  border-radius: 1.25rem; padding: 1rem 1.5rem;
  width: 100%; box-shadow: 0 4px 16px rgba(124,58,237,.1);
}
.lrn-pron-score-num {
  font-size: 3rem; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lrn-pron-score-num.great  { background: linear-gradient(135deg, #059669, #22c55e); -webkit-background-clip: text; background-clip: text; }
.lrn-pron-score-num.almost { background: linear-gradient(135deg, #d97706, #f97316); -webkit-background-clip: text; background-clip: text; }
.lrn-pron-score-num.retry  { background: linear-gradient(135deg, #dc2626, #ef4444); -webkit-background-clip: text; background-clip: text; }
.lrn-pron-score-label { font-size: 1rem; font-weight: 800; color: #1e1b4b; margin-top: 0.25rem; }
.lrn-pron-heard { font-size: 0.8rem; color: #6b7280; font-style: italic; margin-top: 0.25rem; }

.lrn-pron-next-btn {
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  border: none; color: #fff;
  border-radius: 9999px; padding: 0.65rem 2rem;
  font-size: 0.95rem; font-weight: 900; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 14px rgba(124,58,237,.3);
  transition: transform 0.2s;
}
.lrn-pron-next-btn:hover { transform: translateY(-2px) scale(1.04); }

/* ======================================================
   RESULTS SCREEN
   ====================================================== */
.lrn-gr-wrap { align-items: center; justify-content: center; overflow-y: auto; }
.lrn-gr-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 2rem 1.5rem;
  animation: gSlideIn 0.4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes gSlideIn { from { transform: translateY(30px) scale(0.95); opacity: 0; } to { transform: none; opacity: 1; } }

.lrn-gr-icon { font-size: 5rem; margin-bottom: 0.5rem; animation: gBounce 0.6s cubic-bezier(.34,1.56,.64,1) 0.2s both; }
@keyframes gBounce { from { transform: scale(0) rotate(-15deg); opacity: 0; } to { transform: none; opacity: 1; } }

.lrn-gr-grade { font-size: 1.6rem; font-weight: 900; color: #1e1b4b; margin-bottom: 0.5rem; }
.lrn-gr-great  { color: #059669; }
.lrn-gr-almost { color: #d97706; }
.lrn-gr-retry  { color: #dc2626; }

.lrn-gr-score {
  font-size: 4rem; font-weight: 900; line-height: 1;
  background: linear-gradient(135deg, #7c3aed, #06b6d4, #f97316);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.lrn-gr-score-label { font-size: 0.85rem; font-weight: 700; color: #6b7280; margin-top: 0.15rem; margin-bottom: 1.25rem; }

.lrn-gr-stats {
  display: flex; gap: 1.5rem; margin-bottom: 1.75rem;
  background: #fff; border: 2px solid #ede9fe;
  border-radius: 1rem; padding: 0.875rem 1.5rem;
  box-shadow: 0 4px 14px rgba(124,58,237,.1);
}
.lrn-gr-stat { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; }
.lrn-gr-stat-val { font-size: 1.5rem; font-weight: 900; color: #1e1b4b; }
.lrn-gr-stat-lbl { font-size: 0.7rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; }

.lrn-gr-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; justify-content: center; }
.lrn-gr-btn-play {
  background: linear-gradient(135deg, #7c3aed, #0369a1);
  border: none; color: #fff; border-radius: 9999px;
  padding: 0.7rem 1.75rem; font-size: 0.95rem; font-weight: 900;
  font-family: inherit; cursor: pointer;
  box-shadow: 0 6px 18px rgba(124,58,237,.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.lrn-gr-btn-play:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 24px rgba(124,58,237,.45); }
.lrn-gr-btn-pick {
  background: #fff; border: 2.5px solid #ddd6fe; color: #7c3aed;
  border-radius: 9999px; padding: 0.7rem 1.5rem;
  font-size: 0.9rem; font-weight: 800; font-family: inherit; cursor: pointer;
  transition: all 0.2s;
}
.lrn-gr-btn-pick:hover { background: #ede9fe; border-color: #7c3aed; }
.lrn-gr-btn-exit {
  background: #fff; border: 2.5px solid #fca5a5; color: #dc2626;
  border-radius: 9999px; padding: 0.7rem 1.25rem;
  font-size: 0.9rem; font-weight: 800; font-family: inherit; cursor: pointer;
  transition: all 0.2s;
}
.lrn-gr-btn-exit:hover { background: #fee2e2; }

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 480px) {
  .lrn-gp-header { padding: 0.75rem 1rem 0.5rem; }
  .lrn-gp-title  { font-size: 1.05rem; }
  .lrn-gp-grid   { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; padding: 0 0.625rem 0.625rem; }
  .lrn-gp-card   { padding: 0.625rem 0.35rem; border-radius: 0.875rem; }
  .lrn-gp-card-icon { font-size: 1.5rem; }
  .lrn-gp-card-name { font-size: 0.65rem; }
  .lrn-gp-card-desc { display: none; }

  .lrn-ghud       { padding: 0.35rem 0.6rem 0.25rem; gap: 0.3rem; }
  .lrn-ghud-timer { width: 38px; height: 38px; }
  .lrn-ghud-timer-svg { width: 38px; height: 38px; }
  .lrn-ghud-score { font-size: 0.8rem; padding: 0.15rem 0.5rem; min-width: 2.75rem; }
  .lrn-ghud-streak,
  .lrn-ghud-mult  { font-size: 0.72rem; padding: 0.15rem 0.45rem; }

  .lrn-gstage { padding: 0.35rem 0.625rem 0.75rem; }

  .lrn-mc-choices { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .lrn-mc-choice  { padding: 0.6rem 0.4rem; }
  .lrn-mc-choice-text { font-size: 0.75rem; }

  .lrn-mem-grid { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }

  .lrn-mp-item { font-size: 0.72rem; padding: 0.5rem 0.4rem; min-height: 2.5rem; border-radius: 0.625rem; }

  .lrn-pron-phrase { font-size: clamp(1.2rem, 6vw, 1.6rem); padding: 1rem; }
  .lrn-pron-score-num { font-size: 2.5rem; }

  .lrn-gr-icon   { font-size: 4rem; }
  .lrn-gr-grade  { font-size: 1.3rem; }
  .lrn-gr-score  { font-size: 3rem; }
  .lrn-gr-stats  { gap: 1rem; padding: 0.75rem 1rem; }
  .lrn-gr-stat-val { font-size: 1.25rem; }
}

@media (max-height: 600px) {
  .lrn-gp-grid { grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
  .lrn-gp-card { padding: 0.5rem 0.25rem; }
  .lrn-gp-card-desc { display: none; }
  .lrn-mem-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ======================================================
   SURVIVAL MODE — hearts HUD & ouch flash
   ====================================================== */
.lrn-ghud-hearts {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  background: #fff;
  border: 2px solid #fca5a5;
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
}
.lrn-ghud-heart { font-size: 1.1rem; line-height: 1; transition: transform 0.3s; }
.lrn-ghud-heart.lost { filter: grayscale(1); opacity: 0.4; transform: scale(0.8); }

/* Red flash when heart lost */
@keyframes gSurvivalOuch {
  0%        { background-color: rgba(239,68,68,0); }
  20%       { background-color: rgba(239,68,68,0.22); }
  100%      { background-color: rgba(239,68,68,0); }
}
.lrn-survival-ouch { animation: gSurvivalOuch 0.6s ease forwards; }

.lrn-survival-survived-label {
  font-size: 0.88rem; font-weight: 700; color: #6b7280; margin-bottom: 0.25rem;
}

/* Skull bounce on game over */
.lrn-survival-skull { animation: gSkullBounce 0.7s cubic-bezier(.34,1.56,.64,1) 0.2s both; }
@keyframes gSkullBounce { from { transform: scale(0) rotate(20deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ======================================================
   SPEAK AFTER ME
   ====================================================== */
.lrn-sam-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.875rem; text-align: center;
}

.lrn-sam-status {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  background: #fff;
  border: 2.5px solid #ede9fe;
  border-radius: 1.25rem;
  padding: 1.25rem 2rem;
  width: 100%;
  box-shadow: 0 4px 16px rgba(124,58,237,.1);
}

.lrn-sam-status-icon {
  font-size: 3rem;
  line-height: 1;
  animation: gSpeakerPulse 1.2s ease infinite;
}
.lrn-sam-status-icon.countdown {
  font-size: 3.5rem; font-weight: 900;
  font-family: 'Nunito', system-ui;
  color: #7c3aed;
  animation: gCountdownPop 0.4s cubic-bezier(.34,1.56,.64,1);
}
.lrn-sam-status-icon.recording {
  animation: gMicPulse 1s ease infinite;
  color: #dc2626;
}

.lrn-sam-status-label {
  font-size: 0.88rem; font-weight: 800; color: #7c3aed; letter-spacing: 0.01em;
}

@keyframes gSpeakerPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes gCountdownPop  { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.lrn-sam-score-wrap {
  background: #fff; border: 2.5px solid #ede9fe;
  border-radius: 1.25rem; padding: 1rem 1.5rem;
  width: 100%; box-shadow: 0 4px 16px rgba(124,58,237,.1);
  animation: gFeedback 0.3s cubic-bezier(.34,1.56,.64,1);
}

/* ======================================================
   PHRASE ILLUSTRATIONS — shared across all games
   ====================================================== */

/* Default: compact banner inside question boxes */
.lrn-game-phrase-img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 0.875rem;
  border: 2.5px solid #ede9fe;
  box-shadow: 0 4px 14px rgba(124,58,237,.12);
  display: block;
  margin-bottom: 0.625rem;
}

/* Inside listen prompt — centred, taller allowed */
.lrn-mc-listen-prompt .lrn-game-phrase-img {
  max-height: 160px;
  border-color: #bae6fd;
  box-shadow: 0 4px 14px rgba(3,105,161,.12);
}

/* Match-pairs left items — tiny thumbnail */
.lrn-mp-item-img {
  width: 100%;
  max-height: 70px;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 2px solid #ede9fe;
  display: block;
  margin-bottom: 0.3rem;
}

/* Match-pairs item with image: stack vertically */
.lrn-mp-item.has-img {
  flex-direction: column;
  gap: 0.2rem;
  min-height: 4rem;
  padding: 0.4rem 0.5rem;
}

/* Memory card back — image fills the face */
.lrn-mem-card-back-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.625rem;
  display: block;
}

/* Pronunciation — image above phrase, wider */
.lrn-pron-phrase-img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 1rem;
  border: 2.5px solid #ede9fe;
  box-shadow: 0 4px 16px rgba(124,58,237,.12);
  display: block;
}

/* Mobile: slightly shorter images to save space */
@media (max-width: 480px) {
  .lrn-game-phrase-img  { max-height: 110px; }
  .lrn-mp-item-img      { max-height: 52px;  }
  .lrn-pron-phrase-img  { max-height: 130px; }
}
@media (max-height: 600px) {
  .lrn-game-phrase-img  { max-height: 80px; }
  .lrn-pron-phrase-img  { max-height: 90px; }
}

/* ======================================================
   GAME LAUNCH BUTTON (on lesson page)
   ====================================================== */
.lrn-games-btn {
  background: linear-gradient(135deg, #f97316, #eab308) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-weight: 900 !important;
  box-shadow: 0 4px 14px rgba(249,115,22,.35) !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
}
.lrn-games-btn:hover {
  transform: translateY(-1px) scale(1.04) !important;
  box-shadow: 0 8px 22px rgba(249,115,22,.45) !important;
}
