/* Un isoloir en papier : fond papier, encre graphite, accent jaune « surligneur ».
   Aucune couleur de parti : tous les partis partagent le même style. */
:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --ink: #1f2023;
  --muted: #62646b;
  --line: #dcdad2;
  --accent: #f2c94c;
  --accent-ink: #1f2023;
  --good: #2f7d5b;
  --bad: #b5473a;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b; --surface: #212226; --ink: #ecebe6; --muted: #a3a4aa;
    --line: #34363b; --accent: #e8bd3c; --accent-ink: #17181b;
    --good: #5cbf92; --bad: #e37d6f; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 17px/1.55 var(--body);
  min-height: 100vh; display: flex; flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.brand {
  background: none; border: 0; padding: 0; text-decoration: none;
  font: 800 1.25rem var(--display); letter-spacing: -0.02em;
}
.brand span { background: var(--accent); color: var(--accent-ink); padding: 0 4px; margin-left: 3px; border-radius: 3px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { text-decoration: none; padding: 6px 10px; border-radius: 6px; color: var(--muted); }
.top nav a:hover, .top nav a.on { color: var(--ink); background: var(--surface); }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 16px 48px; }
main:focus, main:focus-visible { outline: none; }
.foot { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 18px 16px 24px; border-top: 1px solid var(--line); }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; text-wrap: balance; line-height: 1.12; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 800; margin: 0 0 14px; }
h2 { font-size: 1.6rem; margin: 0 0 10px; }
h3 { font-size: 1.15rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
mark { background: var(--accent); color: var(--accent-ink); padding: 0 3px; border-radius: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 2px solid var(--ink); background: var(--surface); padding: 10px 18px; border-radius: 10px;
  font-weight: 700; transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: var(--line); font-weight: 400; }
.btn.ghost:hover { box-shadow: none; transform: none; border-color: var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Accueil */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 22px 0; }
.choice {
  text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 18px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s;
}
.choice:hover { border-color: var(--ink); transform: translateY(-2px); }
.choice strong { font-family: var(--display); font-size: 1.15rem; }
.choice span { color: var(--muted); font-size: 0.92rem; }
.step { margin: 26px 0 10px; }

/* Encart du jeu : volontairement distinct du parcours du test */
.promo {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center;
  margin: 40px 0 28px; padding: 28px; border-radius: 18px;
  background: var(--ink); color: var(--bg);
}
.promo-text { display: grid; gap: 10px; justify-items: start; min-width: 0; }
.promo h2 { margin: 0; font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 800; }
.promo p { margin: 0; }
.promo-text > .chip { background: var(--accent); color: var(--accent-ink); padding: 3px 8px; border-radius: 4px; }
.promo .btn { border-color: var(--accent); margin-top: 4px; }
.promo .btn:hover { box-shadow: 3px 3px 0 var(--accent); }
.promo-tip { opacity: .7; }
.promo-card {
  background: var(--bg); color: var(--ink); border-radius: 14px; padding: 18px;
  transform: rotate(2deg); box-shadow: -6px 6px 0 var(--accent); min-width: 0;
  transition: transform .25s;
}
.promo:hover .promo-card { transform: rotate(0deg); }
.promo-card .chip { color: var(--muted); }
.promo-q { font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 1.25; margin: 6px 0 14px !important; }
.promo-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.promo-opts span {
  border: 2px dashed var(--line); border-radius: 8px; padding: 8px; text-align: center;
  font-family: var(--display); font-weight: 800; color: var(--muted);
}
@media (max-width: 640px) {
  .promo { grid-template-columns: 1fr; padding: 22px; }
  .promo-card { transform: rotate(1deg); }
}
.lengths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.len {
  position: relative; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.len input { position: absolute; opacity: 0; pointer-events: none; }
.len strong { font-family: var(--display); font-size: 1.15rem; }
.len-n, .len-h { font-size: 0.85rem; color: var(--muted); }
.len-p { font-size: 0.85rem; }
.len-p { display: inline-flex; align-items: center; gap: 6px; }
.dots { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.dots i.on { background: currentColor; }
.len:hover { border-color: var(--ink); }
.len:has(input:checked) { border-color: var(--ink); background: var(--accent); color: var(--accent-ink); box-shadow: 3px 3px 0 var(--ink); }
.len:has(input:checked) .len-n, .len:has(input:checked) .len-h { color: var(--accent-ink); }
.len:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 560px) { .lengths { grid-template-columns: 1fr; } }

.precision { background: var(--surface); border: 2px dashed var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; display: grid; gap: 8px; justify-items: start; }
.precision p { margin: 0; }

.notice { border-left: 4px solid var(--accent); background: var(--surface); padding: 12px 16px; border-radius: 0 10px 10px 0; font-size: 0.93rem; }

/* Questionnaire */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.progress div { height: 100%; background: var(--accent); transition: width .3s; }
.meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.88rem; margin-bottom: 22px; flex-wrap: wrap; }
.chip { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted); }
.card { background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; padding: 24px; box-shadow: 5px 5px 0 var(--ink); animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .4; } }
.statement { font-family: var(--display); font-weight: 800; font-size: clamp(1.35rem, 4vw, 1.9rem); line-height: 1.2; margin: 6px 0 12px; text-wrap: balance; }
.context { color: var(--muted); font-size: 0.93rem; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 22px; }
.scale button {
  border: 2px solid var(--line); background: var(--bg); border-radius: 10px; padding: 12px 6px;
  font-size: 0.86rem; line-height: 1.2; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .12s, background .12s;
}
.scale button b { font-family: var(--display); font-size: 1.3rem; }
.scale button:hover { border-color: var(--ink); }
.scale button.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); }
.scale button:disabled { cursor: not-allowed; }
.scale button:disabled:not(.sel) { opacity: .45; border-color: var(--line); }
.toggle:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.lock { margin: 18px 0 0; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); }
.under { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; user-select: none; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
@media (max-width: 560px) {
  .scale { grid-template-columns: 1fr; }
  .scale button { flex-direction: row; justify-content: flex-start; padding: 10px 14px; }
  .scale button b { width: 2.2ch; }
}

/* Révélation des positions */
.reveal { margin-top: 18px; display: grid; gap: 8px; }
.reveal .grp { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px dashed var(--line); }
.reveal .grp > span:first-child { font-weight: 700; font-size: 0.88rem; }
.reveal .you { background: var(--accent); color: var(--accent-ink); padding: 0 6px; border-radius: 4px; font-size: 0.75rem; margin-left: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 0.85rem; background: var(--bg); }
@media (max-width: 560px) { .reveal .grp { grid-template-columns: 1fr; gap: 4px; } }

/* Résultats */
.results { display: grid; gap: 8px; margin: 18px 0; }
.res { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.res > button { width: 100%; background: none; border: 0; text-align: left; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.res .name { font-weight: 700; }
.res .pct { font-family: var(--display); font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.bar { grid-column: 1 / -1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar div { height: 100%; background: var(--ink); width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.res .sub { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; }
.detail { padding: 0 14px 14px; display: grid; gap: 12px; }
.detail h4 { margin: 0 0 4px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.detail ul { margin: 0; padding-left: 18px; font-size: 0.92rem; }
.ok { color: var(--good); } .ko { color: var(--bad); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-top: 14px; }
table { border-collapse: collapse; font-size: 0.8rem; min-width: 900px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); white-space: normal; min-width: 170px; }
thead th { font-size: 0.72rem; writing-mode: vertical-rl; transform: rotate(180deg); height: 130px; vertical-align: bottom; font-weight: 700; }
thead th:first-child { writing-mode: horizontal-tb; transform: none; }
td.you { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
td.match { font-weight: 700; }

/* Jeu */
.score { display: flex; gap: 18px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; margin-bottom: 18px; flex-wrap: wrap; }
.score b { color: var(--ink); font-family: var(--display); font-size: 1.15rem; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.options button { border: 2px solid var(--line); background: var(--bg); border-radius: 10px; padding: 14px 10px; font-weight: 700; transition: border-color .12s; }
.options button:hover:not(:disabled) { border-color: var(--ink); }
.options button.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 15%, var(--bg)); }
.options button.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, var(--bg)); }
.options button:disabled { cursor: default; }
.verdict { font-family: var(--display); font-weight: 800; font-size: 1.3rem; margin-top: 16px; }
@media (max-width: 460px) { .options { grid-template-columns: 1fr; } }

.prose h2 { margin-top: 28px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.game-title { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: 6px; }
.backlink { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.backlink:hover { color: var(--ink); text-decoration: underline; }
.current { display: grid; gap: 10px; justify-items: stretch; margin: 24px 0 8px; padding: 18px 20px; background: var(--surface); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); }
.current h2 { margin: 0; font-size: 1.35rem; }
.current p { margin: 0; }
.current .progress { margin: 2px 0 0; }
.current .btn { text-decoration: none; }
.new-test { font-size: 1.25rem; margin: 30px 0 2px; }
.prose .lead { font-size: 1.08rem; }
a.choice, a.len { text-decoration: none; color: inherit; }

/* Partage */
.share { margin: 28px 0; padding: 22px; background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; box-shadow: 5px 5px 0 var(--ink); }
.share h2 { margin: 0 0 14px; }
.share h3 { margin: 18px 0 2px; font-size: 1.05rem; }
.share p { margin: 4px 0 8px; }
.share-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.share-actions { min-width: 0; }
.share-actions .btn { text-decoration: none; }
.share-preview img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.share-preview img.story { max-width: 190px; margin: 0 auto; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--bg); padding: 7px 14px; font-size: 0.9rem; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.share-status { min-height: 1.4em; font-weight: 700; }
@media (max-width: 640px) {
  .share-grid { grid-template-columns: 1fr; }
  .share-preview img { max-width: 260px; margin: 0 auto; }
}
/* Verdict et bouton « suivant » côte à côte, au-dessus de la liste des partis */
.after-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 18px; }
.after-head .lock, .after-head .verdict { margin: 0; flex: 1 1 220px; }
.results-title { margin: 32px 0 12px; }

/* Jeu : le sens de la question (pour / contre) est l'information clé */
.ask { font-family: var(--display); font-weight: 800; font-size: clamp(1.3rem, 3.6vw, 1.7rem); line-height: 1.3; margin: 10px 0 12px; }
.stance { display: inline-block; padding: 1px 12px 3px; border-radius: 8px; font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; color: var(--bg); }
.stance.pour { background: var(--good); }
.stance.contre { background: var(--bad); }
.game-q { margin: 0 0 10px; padding-left: 14px; border-left: 4px solid var(--line); font-size: clamp(1.1rem, 3vw, 1.4rem); }
.promo-ask { font-family: var(--display); font-weight: 800; margin: 8px 0 4px !important; }
.promo-ask .stance { font-size: 0.85em; }
.promo-q { font-weight: 500 !important; font-size: 0.98rem !important; }

/* Pages d'erreur (404.html ; 50x.html est autonome et reprend les mêmes variables) */
.error-page { max-width: 640px; padding-block: 48px; }
.error-code { font: 800 clamp(4.5rem, 18vw, 8rem)/0.9 var(--display); letter-spacing: -0.05em; color: var(--line); margin: 0 0 8px; }
.error-page h1 { margin-bottom: 14px; }
.error-card { margin: 26px 0; }
.error-card .ask { margin-bottom: 6px; }
.error-answer { margin: 0; font-size: 1.05rem; }
.error-actions .btn { text-decoration: none; }
