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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.screen { display: none; width: 100%; max-width: 640px; }
.screen.active { display: block; }
.hidden { display: none !important; }

h1 { font-size: 2rem; text-align: center; margin-bottom: .25rem; }
.subtitle { text-align: center; color: #94a3b8; margin-bottom: 1.5rem; }

.card {
  background: #1e293b;
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

label { display: block; font-size: .85rem; color: #94a3b8; margin-bottom: .4rem; }

select {
  width: 100%;
  padding: .65rem .9rem;
  border-radius: .5rem;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 1rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
}

.mode-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  flex: 1;
  padding: .75rem 1rem;
  border: none;
  border-radius: .75rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-desc { font-size: .75rem; font-weight: 400; opacity: .8; }

.btn-learn  { background: #6366f1; color: #fff; }
.btn-exam   { background: #0ea5e9; color: #fff; }
.btn-primary { background: #6366f1; color: #fff; flex-direction: row; }
.btn-secondary { background: #334155; color: #e2e8f0; flex-direction: row; }

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
  font-size: .85rem;
  color: #94a3b8;
}

#mode-badge {
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: #334155;
  color: #e2e8f0;
}

.progress-bar {
  background: #1e293b;
  border-radius: 999px;
  height: 6px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  background: #6366f1;
  transition: width .4s ease;
}

.question-meta { font-size: .8rem; color: #f59e0b; min-height: 1.2em; margin-bottom: .5rem; }
h2 { font-size: 1.15rem; line-height: 1.5; margin-bottom: 1.25rem; }

/* Options */
#q-options { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.25rem; }

.option-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: .75rem;
  border: 2px solid #334155;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.option-label:hover { border-color: #6366f1; background: #1e3a5f22; }
.option-label input { accent-color: #6366f1; width: 1.1rem; height: 1.1rem; flex-shrink: 0; }

.option-label.correct   { border-color: #22c55e; background: #14532d33; }
.option-label.incorrect { border-color: #ef4444; background: #7f1d1d33; }
.option-label.missed    { border-color: #f59e0b; background: #78350f33; }

/* Feedback */
.feedback {
  padding: .9rem 1rem;
  border-radius: .75rem;
  margin-bottom: 1rem;
  background: #0f172a;
  border-left: 4px solid #6366f1;
}
.feedback.success { border-color: #22c55e; }
.feedback.error   { border-color: #ef4444; }
#feedback-text { font-weight: 700; margin-bottom: .35rem; }
.explanation { font-size: .88rem; color: #94a3b8; line-height: 1.5; }

.action-row { display: flex; gap: .75rem; }

/* Results */
.result-card { text-align: center; }
.score-emoji { font-size: 3.5rem; margin-bottom: .75rem; }
.score-text  { font-size: 1.5rem; font-weight: 700; margin: .5rem 0 1rem; }
#score-detail { color: #94a3b8; font-size: .9rem; margin-bottom: 1.5rem; }
.result-buttons { display: flex; flex-direction: column; gap: .75rem; }
.result-buttons .btn { flex-direction: row; justify-content: center; }

@media (max-width: 480px) {
  .mode-buttons { flex-direction: column; }
}

/* ── Récapitulatif examen ─────────────────────────────────────────────────── */
#exam-recap {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  max-width: 640px;
  width: 100%;
}

#exam-recap h3 {
  color: #e2e8f0;
  font-size: 1rem;
  margin-bottom: .25rem;
}

.recap-item {
  background: #1e293b;
  border-radius: .75rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid #334155;
}

.recap-correct   { border-color: #22c55e; }
.recap-incorrect { border-color: #ef4444; }

.recap-q    { font-size: .9rem; font-weight: 600; margin-bottom: .4rem; color: #e2e8f0; }
.recap-given  { font-size: .85rem; color: #94a3b8; margin-bottom: .2rem; }
.recap-answer { font-size: .85rem; color: #22c55e; margin-bottom: .2rem; }
.recap-expl   { font-size: .8rem; color: #64748b; margin-top: .35rem; font-style: italic; }

/* ── Mode Réponses ───────────────────────────────────────────────────────── */
.mode-badge-answers {
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  background: #334155;
  color: #e2e8f0;
}

.btn-answers { background: #8b5cf6; color: #fff; }

.btn-small {
  padding: .35rem .75rem;
  font-size: .8rem;
  flex-direction: row;
  flex: 0;
}

.answers-toolbar {
  margin-bottom: 1rem;
  padding: .85rem 1.25rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  cursor: pointer;
  color: #e2e8f0;
}

.toggle-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #8b5cf6;
  cursor: pointer;
}

#answers-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
  width: 100%;
}

.answer-block {
  padding: 1.25rem 1.5rem;
}

.answer-q-meta {
  font-size: .75rem;
  color: #64748b;
  margin-bottom: .3rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.answer-q-text {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: .85rem;
  line-height: 1.5;
}

.answer-options {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: .75rem;
}

.answer-option {
  padding: .55rem .9rem;
  border-radius: .5rem;
  font-size: .9rem;
}

.answer-correct {
  background: #14532d33;
  border: 1.5px solid #22c55e;
  color: #86efac;
  font-weight: 600;
}

.answer-wrong {
  background: #1e293b;
  border: 1.5px solid #334155;
  color: #64748b;
}

.answer-hidden {
  background: #1e293b;
  border: 1.5px dashed #334155;
  color: #334155;
  font-style: italic;
}

.answer-expl {
  font-size: .82rem;
  color: #94a3b8;
  font-style: italic;
  border-top: 1px solid #334155;
  padding-top: .6rem;
}
