:root {
  --navy: #0f1b2d;
  --ink: #1b2430;
  --muted: #5b6675;
  --line: #dde2e8;
  --bg: #f3f5f7;
  --card: #ffffff;
  --brand: #f04549;
  --accent: #d6323a;
  --accent-dark: #b32830;
  --ok: #1f7a4d;
  --ko: #b32830;
  --radius: 4px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  background: var(--navy); color: #fff; padding: 10px 14px; border-radius: var(--radius);
}
.skip:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

/* En-tête */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.brand img { display: block; height: 72px; width: auto; }
.site-header nav { display: flex; gap: 28px; }
.site-header nav a {
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.site-header nav a:hover { border-bottom-color: var(--brand); }

/* Bandeau */
.hero { background: var(--navy); color: #fff; border-bottom: 4px solid var(--brand); }
.hero .wrap { padding: 56px 0 60px; max-width: 1080px; }
.eyebrow {
  margin: 0 0 12px; font-size: .8rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: #ff8c8f;
}
.hero h1 {
  margin: 0 0 16px; max-width: 720px;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.15; font-weight: 700;
}
.lead { margin: 0; max-width: 640px; font-size: 1.08rem; color: #c9d3e0; }

/* Mise en page */
.layout {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px; padding: 36px 0 56px; align-items: start;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px;
}
.card h2 {
  margin: 0 0 6px; font-size: 1.35rem; line-height: 1.25; position: relative; padding-top: 14px;
}
.card h2::before {
  content: ""; position: absolute; top: 0; left: 0; width: 36px; height: 4px; background: var(--brand);
}
.card h3 { margin: 28px 0 10px; font-size: 1.05rem; }
.muted { color: var(--muted); margin: 0 0 18px; }
h2:focus { outline: none; }

/* Formulaire */
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"] {
  width: 100%; padding: 12px 14px; font: inherit; color: inherit;
  border: 1px solid #b8c1cc; border-radius: var(--radius); background: #fff;
}
input[type="text"]:focus { outline: 3px solid var(--navy); outline-offset: 0; border-color: var(--navy); }
.help { margin: 6px 0 18px; font-size: .88rem; color: var(--muted); }
.error { margin: 0 0 14px; color: var(--ko); font-weight: 600; font-size: .95rem; }

.btn {
  display: inline-block; padding: 12px 24px; font: inherit; font-weight: 700;
  color: #fff; background: var(--accent); border: 0; border-radius: var(--radius); cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--accent-dark); }
.btn:disabled { background: #c3c9d1; cursor: not-allowed; }

/* Progression */
.progress-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; margin-bottom: 8px; }
.progress-head .muted { margin: 0; font-weight: 400; }
.progress { height: 6px; background: #e4e8ed; border-radius: 3px; margin-bottom: 26px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--brand); transition: width .25s ease; }

/* Question */
fieldset { border: 0; margin: 0 0 20px; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 16px; font-size: 1.2rem; font-weight: 700; line-height: 1.35; }
.option-wrap { position: relative; margin-bottom: 10px; }
.option-wrap input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.option {
  display: flex; align-items: center; gap: 14px; margin: 0; padding: 12px 14px;
  font-weight: 400; border: 1px solid #b8c1cc; border-radius: var(--radius); background: #fff;
}
.option-key {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-weight: 700; border-radius: var(--radius);
}
.option-wrap:hover .option { border-color: var(--navy); background: #f7f9fb; }
.option-wrap input:checked + .option { border-color: var(--accent); background: #fdf1f1; box-shadow: inset 0 0 0 1px var(--accent); }
.option-wrap input:checked + .option .option-key { background: var(--accent); }
.option-wrap input:focus-visible + .option { outline: 3px solid var(--navy); outline-offset: 2px; }

/* Résultat */
.score { margin: 18px 0 4px; display: flex; align-items: baseline; gap: 10px; }
#score-value { font-size: 3.6rem; font-weight: 700; line-height: 1; color: var(--navy); }
.score-total { font-size: 1.4rem; color: var(--muted); }
.result-message { margin: 0 0 6px; font-size: 1.1rem; font-weight: 600; }

.review { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.review li { border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius); padding: 12px 14px; }
.review li.ok { border-left-color: var(--ok); }
.review li.ko { border-left-color: var(--ko); }
.review .q { margin: 0 0 6px; font-weight: 600; }
.review .a { margin: 0; font-size: .95rem; }
.review .tag { font-weight: 700; }
.review li.ok .tag { color: var(--ok); }
.review li.ko .tag { color: var(--ko); }
.review .expl { margin: 6px 0 0; font-size: .92rem; color: var(--muted); }

/* Classement */
.board { width: 100%; border-collapse: collapse; font-size: .97rem; }
.board th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--navy);
}
.board td { padding: 10px 6px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.board td:first-child { width: 36px; font-weight: 700; }
.board tr.top td:first-child { color: var(--accent); }
.board tr.me td { background: #fdf1f1; font-weight: 600; }

/* Pied de page */
.site-footer { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.site-footer p { margin: 0; padding: 22px 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .hero .wrap { padding: 40px 0 44px; }
}
@media (max-width: 480px) {
  .card { padding: 20px; }
  .site-header nav { gap: 18px; }
  .brand img { height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress-fill { transition: none; }
}
