/*
 * TheraQuiz engagement TEST RC4
 * A restrained, accessible reward layer for server-confirmed answer feedback.
 */

.quiz-feedback-bar {
  min-height: 48px;
  margin: 10px 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quiz-score {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #59647a;
  font-size: 13px;
}

.quiz-score strong { color: var(--ink-strong); }

.score-spark {
  color: var(--blue);
  font-size: 17px;
  line-height: 1;
}

.score-streak,
.feedback-momentum {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #a9e1c8;
  border-radius: 999px;
  color: #0d6b48;
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sound-toggle {
  min-width: 112px;
  min-height: 44px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: #59647a;
  background: #fff;
  font-weight: 750;
}

.sound-toggle:hover { border-color: #aebdff; color: #2946bc; }

.sound-toggle[aria-pressed="true"] {
  border-color: #c6d1ff;
  color: #2946bc;
  background: var(--blue-soft);
}

.feedback-card {
  position: relative;
  isolation: isolate;
}

.feedback-heading {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-heading > strong {
  color: var(--ink-strong);
  font-size: 18px;
}

.feedback-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 17px;
  font-weight: 900;
}

.feedback-card.wrong .feedback-icon {
  color: #a42c32;
  background: #fff;
  border: 2px solid var(--coral);
}

.feedback-momentum { margin-left: auto; }

.feedback-card.feedback-celebrate {
  animation: feedback-correct-arrive 420ms cubic-bezier(.2,.8,.2,1) both;
}

.feedback-card.feedback-milestone {
  box-shadow: 0 14px 34px rgba(51, 196, 128, .15);
}

.feedback-card.feedback-settle {
  animation: feedback-wrong-arrive 220ms ease-out both;
}

.feedback-sparkles {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.feedback-sparkle {
  position: absolute;
  left: 18%;
  top: 24px;
  color: var(--sparkle-color, var(--blue));
  font-size: var(--sparkle-size, 14px);
  line-height: 1;
  opacity: 0;
  animation: feedback-sparkle-flight 620ms cubic-bezier(.16,.72,.27,1) var(--sparkle-delay, 0ms) both;
}

#clinical-pearl-wrap.pearl-reveal {
  border: 1px solid #cbd6ff;
  border-left: 4px solid var(--blue);
  border-radius: 12px;
  padding: 13px 14px;
  margin-top: 14px;
  background: #f4f6fb;
  animation: pearl-reveal 420ms cubic-bezier(.2,.8,.2,1) 120ms both;
}

#clinical-pearl-wrap.pearl-reveal strong { color: #2946bc; }

@keyframes feedback-correct-arrive {
  0% { transform: translateY(4px) scale(.992); box-shadow: 0 0 0 rgba(51, 196, 128, 0); }
  60% { transform: translateY(0) scale(1.004); box-shadow: 0 12px 28px rgba(51, 196, 128, .13); }
  100% { transform: none; box-shadow: none; }
}

@keyframes feedback-wrong-arrive {
  0% { transform: translateY(3px); opacity: .7; }
  100% { transform: none; opacity: 1; }
}

@keyframes feedback-sparkle-flight {
  0% { transform: translate(0, 0) scale(.45) rotate(0); opacity: 0; }
  22% { opacity: 1; }
  100% { transform: translate(var(--sparkle-x), var(--sparkle-y)) scale(1.15) rotate(70deg); opacity: 0; }
}

@keyframes pearl-reveal {
  0% { transform: translateY(6px); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

@media (max-width: 560px) {
  .quiz-feedback-bar { align-items: stretch; flex-direction: column; }
  .quiz-score { min-height: 36px; flex-wrap: wrap; }
  .sound-toggle { width: 100%; }
  .feedback-heading { flex-wrap: wrap; }
  .feedback-momentum { margin-left: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-card.feedback-celebrate,
  .feedback-card.feedback-settle,
  #clinical-pearl-wrap.pearl-reveal { animation: none !important; }
  .feedback-sparkles { display: none !important; }
}
