:root {
  --bg: #F3F1EC;
  --surface: #FFFFFF;
  --text: #1C1C1A;
  --muted: #6E6E68;
  --border: #DDD9D0;
  --bmd: #C4C0B7;
  --green: #7C1D2E;
  --green-l: #FAE8EC;
  --green-m: #A83248;
  --blue: #153E6E;
  --blue-l: #E4EDF8;
  --amber: #6B430C;
  --amber-l: #FDF2DC;
  --amber-m: #C47A00;
  --ok: #14532D;
  --ok-l: #DCFCE7;
  --ok-b: #4ADE80;
  --ko: #7F1D1D;
  --ko-l: #FEE2E2;
  --ko-b: #F87171;
  --r: 8px;
  --r-lg: 14px;
}

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

body {
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column
}

.screen { display: none; flex: 1; flex-direction: column }
.screen.active { display: flex }

.site-footer {
  background: transparent;
  color: var(--muted);
  text-align: center;
  padding: 0 24px 20px;
  font-size: 12px;
  margin-top: auto;
}

/* ── COVER ── */
#cover { align-items: center; justify-content: center; padding: 2rem 1rem 0 }

.cover-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 460px;
  overflow: hidden
}

.cover-hero { background: var(--green); padding: 1.75rem 2rem 1.5rem; color: #fff }

.cv-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; opacity: .65; margin-bottom: .4rem
}

.cover-hero h1 { font-size: 1.55rem; font-weight: 900; line-height: 1.2; margin-bottom: .4rem }
.cover-hero p  { font-size: 13px; opacity: .8; font-weight: 500; line-height: 1.5 }

.cover-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--border)
}

.cs { padding: .85rem .5rem; text-align: center; border-right: 1px solid var(--border) }
.cs:last-child { border-right: none }
.cs-val { font-size: 1.35rem; font-weight: 900; line-height: 1 }
.cs-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-top: .2rem }

.cover-body { padding: 1.5rem 1.75rem }

.id-group { display: flex; flex-direction: column; gap: 9px; margin-bottom: 1.4rem }

.id-row { display: flex; align-items: center; gap: 10px }

.id-row label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); width: 72px; flex-shrink: 0
}

.id-row input {
  flex: 1; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--r); font-family: 'Nunito', sans-serif;
  font-size: 13.5px; color: var(--text); background: var(--bg);
  outline: none; transition: border-color .15s
}

.id-row input:focus { border-color: var(--green-m); background: #fff }

.btn-start {
  width: 100%; padding: 12px; background: var(--green); color: #fff;
  border: none; border-radius: var(--r); font-family: 'Nunito', sans-serif;
  font-size: 14px; font-weight: 800; cursor: pointer; transition: background .15s
}

.btn-start:hover { background: var(--green-m) }

/* ── QUIZ ── */
#qcm-screen { align-items: center; padding: 0 1rem }

.qcm-topbar {
  width: 100%; max-width: 680px; display: flex; align-items: center;
  gap: 12px; padding: 1.1rem 0 .9rem; border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem
}

.qcm-brand { font-size: 13px; font-weight: 900; color: var(--green); white-space: nowrap }

.qcm-prog { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden }
.qcm-prog-fill { height: 100%; background: var(--green-m); border-radius: 2px; transition: width .4s cubic-bezier(.4,0,.2,1) }
.qcm-n { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap }

.q-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.6rem 1.75rem; width: 100%; max-width: 680px; margin-bottom: 1rem
}

.q-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 99px; margin-bottom: .8rem
}

.q-tag.fo   { background: var(--green-l); color: var(--green) }
.q-tag.cl   { background: var(--blue-l);  color: var(--blue)  }
.q-tag.both { background: var(--amber-l); color: var(--amber) }

.qdot { width: 5px; height: 5px; border-radius: 50%; background: currentColor }

.situation {
  background: var(--bg); border-left: 3px solid var(--bmd);
  border-radius: 0 var(--r) var(--r) 0; padding: .8rem 1rem;
  margin-bottom: 1rem; font-size: 13px; line-height: 1.65
}

.sit-label {
  font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); display: block; margin-bottom: .3rem
}

.q-question { font-size: 1rem; font-weight: 800; line-height: 1.5; margin-bottom: 1.1rem }

.choices { display: flex; flex-direction: column; gap: 7px }

.choice {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r); font-size: 13.5px;
  font-family: 'Nunito', sans-serif; cursor: pointer; background: var(--surface);
  color: var(--text); text-align: left; transition: border-color .12s, background .12s; line-height: 1.45
}

.choice:hover:not([disabled]) { background: var(--bg); border-color: var(--bmd) }

.ltr {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: var(--muted); margin-top: 1px; transition: all .12s
}

.choice.correct { background: var(--ok-l); border-color: var(--ok-b); color: var(--ok) }
.choice.correct .ltr { background: #16A34A; border-color: #16A34A; color: #fff }
.choice.wrong   { background: var(--ko-l); border-color: var(--ko-b); color: var(--ko) }
.choice.wrong .ltr  { background: #DC2626; border-color: #DC2626; color: #fff }
.choice.reveal  { background: var(--ok-l); border-color: #86EFAC; color: #166534; opacity: .7 }
.choice.reveal .ltr { background: #4ADE80; border-color: #4ADE80; color: #fff }

.feedback {
  font-size: 13px; line-height: 1.6; padding: 10px 13px; border-radius: var(--r);
  border: 1px solid transparent; margin-top: .85rem; display: none; animation: fu .2s ease
}

.feedback.show { display: block }
.feedback.ok { background: var(--ok-l); border-color: var(--ok-b); color: var(--ok) }
.feedback.ko { background: var(--ko-l); border-color: var(--ko-b); color: var(--ko) }
.feedback b { font-weight: 800 }

@keyframes fu { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

.q-nav { width: 100%; max-width: 680px; display: flex; justify-content: flex-end; margin-bottom: 1.5rem }

.btn-next {
  padding: 10px 22px; background: var(--green); color: #fff; border: none;
  border-radius: var(--r); font-family: 'Nunito', sans-serif; font-size: 13px;
  font-weight: 800; cursor: pointer; display: none; transition: background .15s
}

.btn-next:hover { background: var(--green-m) }
.btn-next.show { display: inline-block }

/* ── RESULTS ── */
#results-screen { align-items: center; padding: 1.5rem 1rem 0; background: var(--bg) }

.res-wrap { width: 100%; max-width: 680px; display: flex; flex-direction: column }

.res-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 1rem }

.btn-act {
  padding: 8px 18px; border-radius: var(--r); font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s; border: 1px solid var(--border)
}

.btn-act:hover { opacity: .78 }
.btn-print { background: var(--green); color: #fff; border-color: var(--green) }
.btn-retry  { background: var(--surface); color: var(--text) }

.res-page {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 1.5rem
}

/* en-tête page résultats */
.rph {
  background: var(--green); color: #fff; padding: 1.25rem 1.75rem .9rem;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem
}

.rph-ey { font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .6; margin-bottom: .25rem }
.rph-ti { font-size: 1.2rem; font-weight: 900; line-height: 1.2 }
.rph-su { font-size: 12px; opacity: .72; margin-top: .2rem }
.rph-dt { font-size: 11px; opacity: .7; text-align: right; white-space: nowrap; flex-shrink: 0 }

/* identité */
.rp-id { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border) }

.rp-id-c {
  display: flex; align-items: center; gap: 8px; padding: .65rem 1.25rem;
  border-right: 1px solid var(--border); font-size: 13px
}

.rp-id-c:nth-child(2n) { border-right: none }
.rp-id-l { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); min-width: 72px }
.rp-id-v { font-weight: 700 }

/* score */
.rp-score {
  display: flex; align-items: center; gap: 1.75rem;
  padding: 1.25rem 1.75rem; border-bottom: 1px solid var(--border)
}

.score-ring { position: relative; width: 96px; height: 96px; flex-shrink: 0 }
.score-ring svg { width: 96px; height: 96px }
.rg-bg { fill: none; stroke: var(--border); stroke-width: 8 }
.rg-val {
  fill: none; stroke-width: 8; stroke-linecap: round; stroke-dasharray: 283; stroke-dashoffset: 283;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1) .25s
}

.ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center }
.ring-pct { font-size: 1.3rem; font-weight: 900; line-height: 1 }
.ring-lbl { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 1px }
.score-right { flex: 1 }
.score-nums { display: flex; gap: 1.5rem; margin-bottom: .75rem }
.sni { text-align: center }
.sni-v { font-size: 1.5rem; font-weight: 900; line-height: 1 }
.sni-l { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 2px }

.verdict {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: 99px; font-size: 12px; font-weight: 800; letter-spacing: .03em; margin-bottom: .5rem
}

.verdict.pass { background: var(--ok-l); color: var(--ok); border: 1px solid var(--ok-b) }
.verdict.fail  { background: var(--ko-l); color: var(--ko); border: 1px solid var(--ko-b) }
.vdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor }

.res-mention { font-size: 12.5px; color: var(--muted); line-height: 1.5 }
.res-mention b { color: var(--text); font-weight: 700 }

/* barre seuil */
.rp-th {
  display: flex; align-items: center; gap: 10px; padding: .7rem 1.75rem;
  background: var(--bg); border-bottom: 1px solid var(--border); font-size: 11.5px; color: var(--muted)
}

.th-track { flex: 1; height: 7px; background: var(--border); border-radius: 4px; position: relative }
.th-fill { height: 100%; border-radius: 4px; transition: width 1.1s ease .5s }

.th-mk { position: absolute; top: -4px; left: 80%; width: 2px; height: 15px; background: var(--amber-m) }
.th-mk::after {
  content: '80 %'; position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: var(--amber-m); white-space: nowrap
}

.th-val { font-weight: 900; color: var(--text) }

/* breakdown thèmes */
.rp-bk { padding: 1.1rem 1.75rem; border-bottom: 1px solid var(--border) }

.sec-ti { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .75rem }

.theme-rows { display: flex; flex-direction: column; gap: 7px }
.theme-row { display: flex; align-items: center; gap: 10px }

.th-tag {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  padding: 2px 8px; border-radius: 99px; width: 160px; flex-shrink: 0; text-align: center
}

.th-tag.fo   { background: var(--green-l); color: var(--green) }
.th-tag.cl   { background: var(--blue-l);  color: var(--blue)  }
.th-tag.both { background: var(--amber-l); color: var(--amber) }

.th-track2 { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden }
.th-fill2  { height: 100%; border-radius: 3px; transition: width 1s ease .6s }
.th-cnt { font-size: 11px; font-weight: 800; color: var(--muted); width: 34px; text-align: right }

/* tableau détail */
.rp-det { padding: 1.1rem 1.75rem 1.5rem }

.dtable { width: 100%; border-collapse: collapse; font-size: 12px }

.dtable th {
  text-align: left; font-size: 9.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); padding: 0 6px 7px; border-bottom: 1px solid var(--border)
}

.dtable td { padding: 5px 6px; border-bottom: 1px solid var(--bg); vertical-align: top; line-height: 1.45 }
.dtable tr:last-child td { border-bottom: none }
.dtable td.num { color: var(--muted); font-weight: 700; font-size: 11px; width: 22px }
.dtable td.ico { width: 20px; text-align: center; font-size: 13px }
.dtable td.sit { color: var(--muted); font-size: 11.5px; max-width: 200px }
.ico-ok { color: #16A34A }
.ico-ko { color: #DC2626 }

/* pied de page résultats */
.rp-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: .65rem 1.75rem; background: var(--bg); border-top: 1px solid var(--border);
  font-size: 10.5px; color: var(--muted)
}

/* ── IMPRESSION ── */
@media print {
  body { background: #fff }
  #cover, #qcm-screen, .site-footer { display: none !important }
  #results-screen { display: flex !important; padding: 0; background: #fff; min-height: unset }
  .res-wrap { max-width: 100% }
  .res-actions { display: none !important }
  .res-page { border: 1pt solid #ccc; border-radius: 0; box-shadow: none; margin-bottom: 0 }
  .rph { background: var(--green) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact }
  .rg-val, .th-fill, .th-fill2, .verdict, .q-tag, .th-tag {
    -webkit-print-color-adjust: exact; print-color-adjust: exact
  }
  @page { size: A4 portrait; margin: 1.4cm 1.6cm }
}

@media (max-width: 480px) {
  .rp-score { flex-direction: column; gap: 1rem }
  .rp-id { grid-template-columns: 1fr }
  .rp-id-c { border-right: none !important; border-bottom: 1px solid var(--border) }
  .cover-hero { padding: 1.4rem 1.4rem 1.2rem }
  .cover-body { padding: 1.25rem }
}
