@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-opsz-normal.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces-latin-opsz-italic.woff2) format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Geist"; src: url(fonts/Geist-Variable.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --canvas: #f7f1e8; --paper: #fffaf2; --sand: #efe6d8; --sand-2: #e4d8c6;
  --ink: #1c1b1a; --ink-2: #4a4741; --ink-3: #57534d;
  --accent: #6b443d; --on-accent: #fffaf2; --accent-soft: #ead9cf;
  --trait: #e79a86;  /* pêche pastel, pour les dessins en direct */
  --dia: #b0563f;   /* Arieel */
  --dia-soft: rgba(176, 86, 63, .18);
  --dia-2: #5c6f5d; /* Stéphane */
  --dia-2-soft: rgba(92, 111, 93, .2);
  --danger: #a5301f;
  --serif: "Fraunces", Georgia, serif; --sans: "Geist", "Segoe UI Variable", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { background: var(--canvas); color: var(--ink); font: 400 17px/1.5 var(--sans); min-height: 100dvh; }
main { max-width: 460px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; gap: 20px; }
h1, h2, .q { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 44px; line-height: 1.02; font-variation-settings: "opsz" 144; }
h2 { font-size: 30px; line-height: 1.1; font-variation-settings: "opsz" 72; }
.q { font-size: 29px; line-height: 1.15; font-variation-settings: "opsz" 72; }
.en { font-family: var(--serif); font-style: italic; color: var(--ink-3); font-size: 17px; line-height: 1.35; display: block; margin-top: 6px; }
h1 .en { font-size: 22px; margin-top: 10px; }
.q .en, h2 .en { font-size: 18px; }
p { text-wrap: pretty; }
.note { font-size: 15px; color: var(--ink-2); }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-size: 15px; color: var(--ink-2); }
.top b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
button, .btn { font: 600 17px/1 var(--sans); border: 0; border-radius: 14px; min-height: 56px; padding: 0 22px; cursor: pointer; transition: transform .15s ease, background-color .2s ease; touch-action: manipulation; }
button:active { transform: scale(.98); }
@media (hover: hover) { .primary:not([disabled]):hover { background: #5a3832; } .scale button:hover { box-shadow: inset 0 0 0 2px var(--accent); } .ghost:hover { color: var(--ink); } .danger:hover { background: #f6e3de; } }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.primary { background: var(--accent); color: var(--on-accent); width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.primary small, .ghost small { font: italic 400 14px/1 var(--serif); opacity: .85; }
.primary[disabled] { background: var(--sand-2); color: var(--ink-3); cursor: not-allowed; }
.ghost { background: transparent; color: var(--ink-2); min-height: 44px; padding: 0 8px; }
.sheet { background: var(--paper); border-radius: 22px; padding: 20px; }

/* Consentement */
.consent { display: grid; gap: 14px; }
.consent li { list-style: none; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.consent ol { padding: 0; display: grid; gap: 16px; }
.consent .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font: 600 14px/28px var(--sans); text-align: center; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 16px; background: var(--sand); border-radius: 16px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--accent); margin-top: 2px; }

/* Étapes */
.steps { display: grid; gap: 10px; padding: 0; }
.steps li { list-style: none; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: var(--paper); }
.steps li.off { background: transparent; color: var(--ink-3); }
.steps .num { font: 400 30px/1 var(--serif); color: var(--accent); text-align: center; }
.steps li.off .num { color: var(--ink-3); }
.steps .t { font: 500 18px/1.25 var(--sans); }
.steps .t .en { font-size: 15px; margin-top: 2px; }
.tag { font: 500 13px/1 var(--sans); padding: 8px 10px; border-radius: 99px; background: var(--sand); color: var(--ink-2); white-space: nowrap; }
.tag.go { background: var(--accent); color: var(--on-accent); }

/* Question */
.bar { height: 6px; border-radius: 3px; background: var(--sand-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale button { min-height: 64px; padding: 0; background: var(--paper); color: var(--ink); font: 500 24px/1 var(--serif); border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--sand-2); }
.scale button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.ends { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--ink-2); line-height: 1.3; }
.ends span:last-child { text-align: right; }
.ends em { font: italic 13px/1.3 var(--serif); color: var(--ink-3); display: block; }
.live { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; background: var(--sand); }
.live svg { flex: none; }
.live p { font-size: 14px; color: var(--ink-2); line-height: 1.35; }

/* Triangle */
.tri-guide { fill: var(--sand); }
.tri-step { fill: none; stroke: var(--sand-2); stroke-width: 1.5; }
.tri-a { fill: var(--dia-soft); stroke: var(--dia); stroke-width: 2.5; stroke-linejoin: round; }
.tri-b { fill: var(--dia-2-soft); stroke: var(--dia-2); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 7 5; }
.tri-label { font: 600 13px var(--sans); fill: var(--ink-2); }
.tri-label tspan.en { font: italic 12px var(--serif); fill: var(--ink-3); }

/* Comparaison */
.legend { display: flex; gap: 18px; font-size: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 18px; height: 4px; border-radius: 2px; background: var(--dia); }
.legend i.b { background: repeating-linear-gradient(90deg, var(--dia-2) 0 7px, transparent 7px 11px); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.types div { border-radius: 16px; padding: 14px; background: var(--paper); }
.types b { display: block; font: 400 21px/1.15 var(--serif); margin-top: 4px; }
.types small { font-size: 14px; color: var(--ink-2); }
.types .en { font-size: 14px; margin-top: 2px; }
.items { display: grid; gap: 10px; padding: 0; }
.items li { list-style: none; background: var(--paper); border-radius: 16px; padding: 14px 16px; display: grid; gap: 10px; }
.items .it { font-size: 16px; line-height: 1.35; }
.items .it .en { font-size: 14px; margin-top: 2px; }
.dots { position: relative; height: 26px; }
.dots::before { content: ""; position: absolute; left: 8px; right: 8px; top: 12px; height: 2px; background: var(--sand-2); border-radius: 1px; }
.dots i { position: absolute; top: 4px; width: 18px; height: 18px; border-radius: 50%; transform: translateX(-50%); }
.dots i.a { background: var(--dia); }
.dots i.b { background: var(--canvas); box-shadow: inset 0 0 0 3px var(--dia-2); }
.dots i.same { width: 26px; height: 26px; top: 0; background: var(--dia); box-shadow: inset 0 0 0 4px var(--dia-2), inset 0 0 0 6px var(--paper); }
.disclaimer { font-size: 14px; color: var(--ink-2); background: var(--sand); padding: 12px 14px; border-radius: 14px; }

/* Attente */
.wait { text-align: left; display: grid; gap: 18px; align-content: center; flex: 1; }
.pulse { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.pulse i { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); animation: battement 2.4s ease-in-out infinite; }
@keyframes battement { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.25); } 24% { transform: scale(1); } 36% { transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .pulse i { animation: none; } button { transition: none; } }

/* Page de Stéphane */
.admin h1 { font-size: 36px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpis div { background: var(--paper); border-radius: 16px; padding: 14px; }
.kpis b { display: block; font: 400 30px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.kpis small { font-size: 14px; color: var(--ink-2); }
.toggles { padding: 0; display: grid; gap: 2px; border-radius: 18px; overflow: hidden; }
.toggles li { list-style: none; background: var(--paper); display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 16px; min-height: 64px; }
.toggles .t { font-size: 16px; font-weight: 500; line-height: 1.25; }
.toggles .t small { display: block; font-weight: 400; font-size: 14px; color: var(--ink-2); }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--sand-2); position: relative; cursor: pointer; transition: background-color .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .2s ease; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.scores { display: grid; gap: 12px; }
.score { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; font-size: 15px; }
.score .bars { display: grid; grid-template-columns: 1fr 28px; gap: 4px 8px; align-items: center; }
.score .bars i { display: block; height: 10px; border-radius: 5px; background: var(--dia); }
.score .bars i.b { background: var(--dia-2); }
.score .v { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); width: 100%; }
section { display: grid; gap: 12px; }
section > h3 { font: 600 16px/1.3 var(--sans); }
section > h3 .en { display: inline; font-size: 15px; font-weight: 400; margin-left: 6px; }

@media (min-width: 900px) {
  main { padding-top: 56px; }
}

/* Application */
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label { min-height: 64px; display: grid; place-items: center; background: var(--paper); color: var(--ink); font: 500 24px/1 var(--serif); border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--sand-2); cursor: pointer; transition: background-color .15s ease; }
.scale input:checked + label { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.scale input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { .scale label:hover { box-shadow: inset 0 0 0 2px var(--accent); } }
.steps a { color: inherit; text-decoration: none; display: contents; }
.steps li.go { cursor: pointer; }
.field { display: grid; gap: 6px; font-size: 15px; color: var(--ink-2); }
.field input { font: 400 17px var(--sans); min-height: 52px; padding: 0 14px; border-radius: 12px; border: 0; box-shadow: inset 0 0 0 1.5px var(--sand-2); background: var(--paper); color: var(--ink); }
.erreur { color: var(--danger); font-size: 15px; }
.lien { word-break: break-all; font-size: 14px; background: var(--sand); padding: 12px; border-radius: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.steps li { padding: 0; background: none; display: block; }
.steps .row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; background: var(--paper); width: 100%; text-align: left; font: inherit; color: inherit; min-height: 0; }
.steps li.off .row { background: transparent; color: var(--ink-3); }
.steps li.off .num { color: var(--ink-3); }

/* Clins : couche par-dessus tout, transparente au toucher */
#couche { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
#couche > * { position: absolute; pointer-events: none; }
/* Dessin en direct : couche à part, en « multiply » à 50 %. Le texte dessous s'assombrit dans la même proportion que le fond,
   donc garde son contraste (au moins 4,5:1, mesuré au pixel dans test/parcours.mjs). Un seul groupe : les traits croisés ne s'accumulent pas. */
#traits { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 49; mix-blend-mode: multiply; }
#traits polyline { fill: none; stroke: var(--trait); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; animation: trait-fondu 7s linear forwards; }
@keyframes trait-fondu { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.clin-fleche { width: 72px; height: 96px; transform: translate(-50%, -100%); animation: clin-pointe 3.5s ease-in-out forwards; transform-origin: 50% 100%; }
.clin-capybara { width: 150px; height: 113px; transform: translate(-50%, -50%); animation: clin-pop 3.5s ease forwards; }
.clin-pouce { width: 104px; height: 108px; transform: translate(-50%, -50%); }
.clin-pouce-haut { animation: clin-pouce-haut 3.5s ease forwards; }
.clin-pouce-bas { animation: clin-pouce-bas 3.5s ease forwards; }
@keyframes clin-pouce-haut { 0% { opacity: 0; rotate: -35deg; translate: 0 24px; } 18% { opacity: 1; rotate: 6deg; translate: 0 -8px; } 28% { rotate: 0deg; translate: 0 0; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes clin-pouce-bas { 0% { opacity: 0; rotate: 35deg; translate: 0 -24px; } 18% { opacity: 1; rotate: -6deg; translate: 0 8px; } 28% { rotate: 0deg; translate: 0 0; } 85% { opacity: 1; } 100% { opacity: 0; } }
.clin-coeur { width: 28px; height: 28px; transform: translate(-50%, -50%); animation: clin-monte 3s ease-out forwards; }
.clin-confetti { width: 8px; height: 14px; border-radius: 2px; animation: clin-tombe 3s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes clin-pointe { 0% { opacity: 0; translate: 0 -24px; } 10% { opacity: 1; translate: 0 0; } 20%, 40%, 60% { translate: 0 -12px; } 30%, 50%, 70% { translate: 0 0; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes clin-pop { 0% { opacity: 0; scale: .3; } 12% { opacity: 1; scale: 1.08; } 20% { scale: 1; } 30% { rotate: -6deg; } 40% { rotate: 6deg; } 50% { rotate: 0deg; } 85% { opacity: 1; } 100% { opacity: 0; scale: .9; } }
@keyframes clin-monte { 0% { opacity: 0; scale: .4; } 15% { opacity: 1; scale: 1; } 100% { opacity: 0; translate: var(--dx) -220px; scale: 1.2; } }
@keyframes clin-tombe { 0% { opacity: 1; translate: 0 0; rotate: 0deg; } 100% { opacity: 0; translate: var(--dx) var(--dy); rotate: var(--r); } }
@media (prefers-reduced-motion: reduce) {
  #couche > * { animation: clin-fondu 3s ease forwards !important; }
  @keyframes clin-fondu { 0%, 100% { opacity: 0; } 15%, 80% { opacity: 1; } }
}

/* Panneau des clins (Stéphane) */
.pad { display: block; position: relative; height: min(300px, 40vh); aspect-ratio: 390 / 844; margin: 0 auto; border-radius: 22px; background: var(--paper); box-shadow: inset 0 0 0 2px var(--sand-2); cursor: crosshair; touch-action: none; user-select: none; }
.pad > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pad > svg polyline { fill: none; stroke: var(--trait); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
/* 7 clins : deux rangées de 4 colonnes, pour des cibles d'au moins 44 px et des libellés entiers à 390 px. */
.sortes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sortes button { min-height: 52px; padding: 0 4px; background: var(--paper); color: var(--ink); font: 500 13px/1.2 var(--sans); box-shadow: inset 0 0 0 1.5px var(--sand-2); }
.sortes button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* Miroir de l'écran de l'autre, dans la zone des clins : reconstruit, inerte, atténué pour que les clins se voient. */
.pad { overflow: hidden; }
.miroir { position: absolute; top: 0; left: 0; transform-origin: 0 0; pointer-events: none; opacity: .6; }
.miroir-main { display: flex; flex-direction: column; gap: 20px; padding: 20px 20px 24px; background: var(--canvas); }
.pad > svg { z-index: 1; }

/* Écho chez l'envoyeur : ses clins s'affichent dans sa zone, avec les mêmes animations, à l'échelle du miroir. */
.echo { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.echo > * { position: absolute; pointer-events: none; }
.pad > svg polyline.fondu { animation: trait-fondu 7s linear forwards; }
@media (prefers-reduced-motion: reduce) { .echo > * { animation: clin-fondu 3s ease forwards !important; } }

/* Étape 2 : paire de phrases, en deux grandes cartes */
.choix { display: grid; gap: 10px; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label { display: block; padding: 16px 18px; border-radius: 16px; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--sand-2); font: 400 19px/1.3 var(--serif); cursor: pointer; transition: background-color .15s ease; }
.choix label .en { font-size: 15px; }
.choix input:checked + label { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.choix input:checked + label .en { color: var(--on-accent); opacity: .85; }
.choix input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) { .choix label:hover { box-shadow: inset 0 0 0 2px var(--accent); } }
/* Texte libre */
.texte { font: 400 17px/1.5 var(--sans); color: var(--ink); background: var(--paper); border: 0; border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--sand-2); padding: 14px 16px; resize: vertical; min-height: 150px; width: 100%; }
.texte:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Comparaison de l'étape 2 */
.langs { display: grid; gap: 8px; }
.lang { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 15px; }
.lang .bars { grid-column: 1 / -1; display: grid; gap: 3px; }
.lang .bars i { display: block; height: 8px; border-radius: 4px; background: var(--dia); }
.lang .bars i.b { background: var(--dia-2); }
.paires li { list-style: none; background: var(--paper); border-radius: 16px; padding: 12px 14px; display: grid; gap: 6px; }
.paires { padding: 0; display: grid; gap: 10px; }
.paires p { font-size: 15px; line-height: 1.35; display: flex; gap: 8px; align-items: baseline; }
.paires p .qui { margin-left: auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.paires p.pris { font-weight: 600; }
.cite { background: var(--paper); border-radius: 16px; padding: 14px 16px; white-space: pre-wrap; font: 400 17px/1.5 var(--serif); }

/* Étape 3 : devinettes et jugements */
.devines li { gap: 10px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duo p { display: grid; gap: 2px; font-size: 16px; line-height: 1.35; }
.duo small { font-size: 13px; color: var(--ink-2); }
.duo b { font: 400 18px/1.3 var(--serif); overflow-wrap: anywhere; }
.juger { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.juger input { position: absolute; opacity: 0; pointer-events: none; }
.juger label { display: grid; place-items: center; min-height: 48px; border-radius: 14px; background: var(--canvas); box-shadow: inset 0 0 0 1.5px var(--sand-2); font: 500 15px var(--sans); cursor: pointer; }
.juger input:checked + label { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.juger input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }
.verdict { font: 600 15px var(--sans); }
.verdict .en { display: inline; margin-left: 6px; font-size: 14px; font-weight: 400; }
.verdict.v1 { color: var(--dia-2); }
.verdict.v0 { color: var(--dia); }
.devines p.it { display: block; }
.field .en { display: inline; margin: 0 0 0 6px; font-size: 15px; }

/* Étape 5 : « en parler de vive voix », une réponse à part entière */
.vive { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--sand-2); min-height: 56px; padding: 12px 20px; display: grid; gap: 2px; text-align: left; font: 500 16px/1.25 var(--sans); }
.vive .en { margin: 0; font-size: 14px; }
.vive[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.vive[aria-pressed="true"] .en { color: var(--on-accent); opacity: .85; }
.texte:disabled { opacity: .45; }
.aron { gap: 8px; }
.cite.vive { font-style: italic; color: var(--ink-2); display: block; box-shadow: none; min-height: 0; }
.cite.vive .en { font-size: 14px; }

/* Mode essai : bandeau bien visible, collé en haut */
.bandeau-essai { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px -8px 0; padding: 10px 14px; border-radius: 14px; background: #f5d67a; color: #3d2b22; font-size: 15px; }
.bandeau-essai .ghost { color: #3d2b22; text-decoration: underline; min-height: 44px; }
.essais { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.essais .ghost { box-shadow: inset 0 0 0 1.5px var(--sand-2); border-radius: 14px; }
