/**
 * @Auteur : Venance Kaou
 * @Projet : Quiz interactif JS
 * @Date : Avril 2026
 */


@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,600;1,400;1,600&family=DM+Sans:wght@400;500&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: #0f1117;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: #e8e6f0;
}

.quiz-app {
  width: 100%;
  max-width: 520px;
  position: relative;
}

/* Écrans */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; gap: 1.5rem; }

/* Label commun */
.quiz-label {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: #4a4860;
  font-weight: 500;
}

/* ── ÉCRAN ACCUEIL ── */
.home-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

h1 {
  font-family: 'Fraunces', serif;
  font-size: 52px;
  font-weight: 600;
  line-height: 1.05;
  color: #f0eeff;
}

h1 em {
  font-style: italic;
  color: #a78bfa;
}

.home-desc {
  font-size: 15px;
  color: #7c7a96;
  line-height: 1.6;
  max-width: 360px;
}

.home-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid #1e1d2e;
  border-bottom: 1px solid #1e1d2e;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-num {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  color: #f0eeff;
}

.meta-text {
  font-size: 11px;
  color: #4a4860;
}

.meta-divider {
  width: 1px;
  height: 32px;
  background: #1e1d2e;
}

/* Bouton primaire */
.btn-primary {
  background: #7c3aed;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  padding: 0.9rem 1.75rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  align-self: flex-start;
}

.btn-primary:hover  { background: #6d28d9; }
.btn-primary:active { transform: scale(0.97); }

/* ── ÉCRAN QUESTION ── */

/* Progression */
.quiz-progress { display: flex; flex-direction: column; gap: 8px; }

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #4a4860;
}

#score-live { color: #a78bfa; font-weight: 500; }

.progress-track {
  width: 100%;
  height: 3px;
  background: #1e1d2e;
  border-radius: 99px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: #7c3aed;
  border-radius: 99px;
  transition: width 0.4s ease;
  width: 0%;
}

/* Carte question */
.question-card {
  background: #16151f;
  border: 1px solid #1e1d2e;
  border-radius: 20px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.question-category {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #a78bfa;
  font-weight: 500;
}

.question-text {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 400;
  color: #f0eeff;
  line-height: 1.35;
}

/* Options */
.options-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Structure attendue pour chaque option (générée par JS) :
  <li>
    <button class="option-btn" data-index="0">Texte de l'option</button>
  </li>
*/

.option-btn {
  width: 100%;
  background: #16151f;
  border: 1px solid #1e1d2e;
  border-radius: 12px;
  color: #c4c2d4;
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  padding: 0.9rem 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.option-btn:hover:not(:disabled) {
  border-color: #7c3aed;
  color: #f0eeff;
  background: #1a1828;
}

/* Classes à ajouter depuis JS après réponse */
.option-btn.correct {
  background: rgba(74, 222, 128, 0.08);
  border-color: #4ade80;
  color: #4ade80;
}

.option-btn.wrong {
  background: rgba(248, 113, 113, 0.08);
  border-color: #f87171;
  color: #f87171;
}

.option-btn:disabled { cursor: default; }

/* Feedback */
.feedback {
  background: #16151f;
  border: 1px solid #1e1d2e;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fade-up 0.25s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.feedback-icon { font-size: 24px; line-height: 1; }

.feedback-text {
  font-size: 14px;
  color: #7c7a96;
  line-height: 1.5;
}

/* Classes à ajouter sur #feedback depuis JS */
.feedback.correct { border-color: rgba(74,222,128,0.3); }
.feedback.wrong   { border-color: rgba(248,113,113,0.3); }

#btn-next { margin-top: 4px; }

/* ── ÉCRAN RÉSULTATS ── */
.results-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.score-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#final-score {
  font-family: 'Fraunces', serif;
  font-size: 72px;
  font-weight: 600;
  color: #f0eeff;
  line-height: 1;
}

.score-sep, .score-total {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  color: #4a4860;
}

.result-title {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  color: #f0eeff;
}

.result-desc {
  font-size: 14px;
  color: #7c7a96;
  line-height: 1.6;
}

/* Récap des réponses */
.recap-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Structure attendue pour chaque recap item (générée par JS) :
  <li class="recap-item correct (ou wrong)">
    <span class="recap-icon">✓ (ou ✕)</span>
    <span class="recap-q">Texte de la question</span>
  </li>
*/

.recap-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #16151f;
  border: 1px solid #1e1d2e;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 13px;
  color: #7c7a96;
}

.recap-item.correct { border-color: rgba(74,222,128,0.2); }
.recap-item.wrong   { border-color: rgba(248,113,113,0.2); }

.recap-icon { font-size: 14px; flex-shrink: 0; }
.recap-item.correct .recap-icon { color: #4ade80; }
.recap-item.wrong   .recap-icon { color: #f87171; }

.recap-q {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Utilitaire */
.hidden { display: none !important; }