:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --correct: #16a34a;
  --correct-soft: #f0fdf4;
  --wrong: #dc2626;
  --wrong-soft: #fef2f2;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(16, 24, 40, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px;
  flex: 1;
}

.screen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}
.hidden { display: none; }

h1 { font-size: 2rem; line-height: 1.2; margin: 14px 0 8px; }
h2.question { font-size: 1.35rem; line-height: 1.35; margin: 18px 0 22px; }
.subtitle { color: var(--muted); font-size: 1.05rem; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: 999px;
  text-transform: uppercase;
}
.badge-muted { background: #f3f4f6; color: var(--muted); text-transform: none; letter-spacing: 0; }

.facts {
  list-style: none;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.facts li {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--muted);
}
.facts strong { color: var(--text); }

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 13px 24px;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, opacity .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-primary:disabled { background: #c7c9d6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

/* Quiz */
.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.progress-text { color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.progress-bar { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; }

.answers { display: flex; flex-direction: column; gap: 12px; }
.answer {
  text-align: left;
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 15px 18px;
  font-size: 1.02rem;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}
.answer:hover { border-color: var(--accent); background: var(--accent-soft); }
.answer .key {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; color: var(--muted);
}
.answer.selected { border-color: var(--accent); background: var(--accent-soft); }
.answer.selected .key { background: var(--accent); color: #fff; border-color: var(--accent); }

.quiz-footer { display: flex; justify-content: space-between; margin-top: 28px; }

/* Résultats */
.score-ring {
  width: 160px; height: 160px;
  margin: 24px auto 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border: 8px solid var(--accent);
}
.score-ring #score-value { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.score-percent { color: var(--muted); font-size: 1rem; font-weight: 600; }
#screen-results { text-align: center; }
#screen-results .btn-primary { margin: 18px 0 8px; }

.review-title { text-align: left; margin: 32px 0 16px; font-size: 1.2rem; }
.review { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.review-item { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.review-item.ok { background: var(--correct-soft); border-color: #bbf7d0; }
.review-item.ko { background: var(--wrong-soft); border-color: #fecaca; }
.review-item .r-q { font-weight: 600; margin-bottom: 8px; }
.review-item .r-line { font-size: 0.95rem; margin: 3px 0; }
.review-item .r-correct { color: var(--correct); font-weight: 600; }
.review-item .r-wrong { color: var(--wrong); text-decoration: line-through; }
.review-item .r-exp { color: var(--muted); font-size: 0.9rem; margin-top: 8px; font-style: italic; }

.page-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 20px 40px;
}
.page-footer code { background: #eceef3; padding: 2px 6px; border-radius: 6px; font-size: 0.85em; }

@media (max-width: 560px) {
  .screen { padding: 26px 20px; }
  h1 { font-size: 1.6rem; }
  .container { padding: 28px 14px; }
}
