/* sam quiz : design du quiz */

body.no-scroll {
  overflow: hidden;
}

.quiz-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  background: var(--bg);
  animation: slideUp 0.3s ease both;
}

.quiz-screen[hidden] {
  display: none;
}

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}

.quiz-close {
  flex: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #e8eaf3;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.quiz-progress {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: #e0e3f1;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.4s ease;
}

.quiz-count {
  min-width: 36px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
}

.quiz-body {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}

.quiz-question {
  margin: 14px 0 20px;
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  animation: fadeUp 0.35s ease both;
  transition: transform 0.12s ease, border-color 0.2s ease, background 0.2s ease;
}

.quiz-choice:nth-child(2) { animation-delay: 0.05s; }
.quiz-choice:nth-child(3) { animation-delay: 0.1s; }
.quiz-choice:nth-child(4) { animation-delay: 0.15s; }

.quiz-choice:active:not(:disabled) {
  transform: scale(0.98);
}

.quiz-choice:disabled {
  cursor: default;
}

.quiz-letter {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef0ff;
  color: var(--primary-dark);
  font-weight: 800;
}

.quiz-choice.correct {
  border-color: #10b981;
  background: #ecfdf5;
  animation: bump 0.35s ease;
}

.quiz-choice.correct .quiz-letter {
  background: #10b981;
  color: #fff;
}

.quiz-choice.wrong {
  border-color: #ef4444;
  background: #fef2f2;
  animation: shake 0.35s ease;
}

.quiz-choice.wrong .quiz-letter {
  background: #ef4444;
  color: #fff;
}

@keyframes bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.quiz-feedback {
  margin: 16px 0 12px;
  padding: 14px 16px;
  border-radius: 14px;
  animation: fadeUp 0.3s ease both;
}

.quiz-feedback.ok {
  background: #ecfdf5;
  color: #065f46;
}

.quiz-feedback.ko {
  background: #fef2f2;
  color: #991b1b;
}

.quiz-feedback p {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--text);
}

.quiz-result {
  text-align: center;
  padding-top: 40px;
}

.quiz-result-emoji {
  font-size: 4rem;
  animation: popIn 0.5s ease both;
}

.quiz-result-score {
  margin: 10px 0 4px;
  font-size: 2.4rem;
  font-weight: 900;
}

.quiz-result-msg {
  margin: 0 0 18px;
  color: var(--muted);
}

.quiz-sg {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
  animation: popIn 0.5s ease 0.3s both;
}

.quiz-result-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
}

.quiz-result-actions .btn {
  flex: 1;
}

.confetti-box {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 2.6s ease-in forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}
