:root {
  --bg: #0f1a14;
  --bg-2: #15241b;
  --card: #1b2c22;
  --line: #2c4234;
  --text: #ecefe8;
  --muted: #a3b2a6;
  --accent: #c8312b;
  --accent-soft: rgba(200, 49, 43, 0.15);
  --ok: #5fb37a;
  --ok-soft: rgba(95, 179, 122, 0.15);
  --ko: #e0654f;
  --ko-soft: rgba(224, 101, 79, 0.14);
  --bar-a: #8aa16a;
  --bar-b: #b68ad6;
  --bar-c: #e0a84a;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 600px at 50% -10%, #23402f 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; margin: 0 0 0.4em; }
h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 800; }
h1 em { font-style: normal; color: var(--accent); }
h2 { font-size: clamp(1.35rem, 4vw, 1.75rem); font-weight: 600; }

.card {
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 5vw, 40px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.6em;
}

.warning {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 20px 0;
  white-space: pre-line;
}
.warning strong { display: block; margin-bottom: 4px; letter-spacing: 0.08em; font-size: 0.8rem; }

.rules { color: var(--muted); }
.rules ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.rules li b { color: var(--text); display: inline-block; width: 1.6em; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font: 600 1rem Inter, system-ui, sans-serif;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible, .choice:focus-visible { outline: 3px solid var(--bar-c); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

/* Progression */
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; color: var(--muted); font-size: 0.85rem; }
.progress-bar { flex: 1; height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s ease; }

.question-emoji { font-size: 2.4rem; line-height: 1; margin-bottom: 12px; }

/* Choix */
.choices { display: grid; gap: 10px; margin-top: 24px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font: 500 1rem Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.choice:hover:not(:disabled) { border-color: var(--muted); }
.choice:disabled { cursor: default; }
.choice .letter {
  flex: none;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card);
  font-weight: 700;
}
.choice .pct { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.correct .letter { background: var(--ok); color: #0f1a14; }
.choice.wrong { border-color: var(--ko); background: var(--ko-soft); }
.choice.wrong .letter { background: var(--ko); color: #0f1a14; }
.choice.dim { opacity: 0.55; }

/* Correction */
.verdict { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); animation: fade 0.3s ease; }
.verdict-head { font-family: Fraunces, Georgia, serif; font-size: 1.3rem; font-weight: 600; margin-bottom: 12px; }
.verdict-head.ok { color: var(--ok); }
.verdict-head.ko { color: var(--ko); }
.verdict ul { padding-left: 0; list-style: none; margin: 0 0 16px; display: grid; gap: 8px; }
.verdict li::before { content: "✅ "; }
.notes p { margin: 0 0 8px; color: var(--muted); }
.sources { font-size: 0.88rem; color: var(--muted); background: var(--bg-2); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.sources b { color: var(--text); }
.sources ul { margin: 6px 0 0; gap: 4px; }
.sources li::before { content: "· "; }

/* Stats collectives */
.collective { margin-top: 20px; }
.collective h3 { font-family: Inter, system-ui, sans-serif; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 10px; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg-2); gap: 2px; }
.stack span { display: block; height: 100%; transition: flex-grow 0.5s ease; }
.stack .a { background: var(--bar-a); }
.stack .b { background: var(--bar-b); }
.stack .c { background: var(--bar-c); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Résultats */
.score { font-family: Fraunces, Georgia, serif; font-size: clamp(3.5rem, 14vw, 5.5rem); font-weight: 800; line-height: 1; margin: 12px 0; }
.score small { font-size: 0.4em; color: var(--muted); font-weight: 600; }
.score-msg { font-size: 1.1rem; margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0; }
.fact { background: var(--bg-2); border-radius: 12px; padding: 14px; }
.fact b { display: block; font-size: 1.4rem; font-family: Fraunces, Georgia, serif; }
.fact span { color: var(--muted); font-size: 0.85rem; }
.conclusion { border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; margin-top: 24px; }
.conclusion p { margin: 0; }

.footer { margin-top: 20px; color: var(--muted); font-size: 0.8rem; text-align: center; }
.loading, .error { color: var(--muted); text-align: center; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
