/* ==========================================================================
   Test de positionnement « swipe » (js/test-positionnement.js)
   ========================================================================== */

.tp{ max-width:560px; margin-inline:auto; }
.tp [hidden]{ display:none !important; }

/* ---------- Intro ---------- */
.tp-intro{ text-align:center; }
.tp-intro__regles, .tp-demo{ -webkit-user-select:none; user-select:none; }
.tp-intro__regles{ display:flex; flex-wrap:wrap; justify-content:center; gap:.6rem; margin:1.5rem 0 1.75rem; padding:0; list-style:none; }
.tp-intro__regles li{
  background:var(--c-lavender); color:var(--c-navy); font-weight:600; font-size:.92rem;
  padding:.45rem .9rem; border-radius:var(--radius-ctrl);
}
.tp-demo{ position:relative; width:180px; height:120px; margin:0 auto 1.75rem; }
.tp-demo__carte{
  position:absolute; inset:0; border-radius:var(--radius); background:var(--c-surface);
  border:2px solid var(--c-border); box-shadow:var(--shadow-card);
  display:grid; place-items:center; font-weight:700; color:var(--c-navy);
  animation:tp-demo 3.2s ease-in-out infinite;
}
.tp-demo__fleche{
  position:absolute; top:50%; transform:translateY(-50%); width:40px; height:40px; border-radius:50%;
  display:grid; place-items:center; border:2px solid currentColor; background:var(--c-surface);
}
.tp-demo__fleche--faux{ right:calc(100% + .9rem); color:#D9822B; }
.tp-demo__fleche--vrai{ left:calc(100% + .9rem); color:var(--c-green-dark); }
@keyframes tp-demo{
  0%,15%,50%,65%,100%{ transform:none; }
  30%{ transform:translateX(38px) rotate(7deg); }
  80%{ transform:translateX(-38px) rotate(-7deg); }
}

/* ---------- Progression ---------- */
.tp-haut{ display:flex; justify-content:space-between; align-items:center; gap:1rem; font-size:.9rem; font-weight:600; color:var(--c-navy); }
.tp-serie{
  display:inline-flex; align-items:center; gap:.35rem; color:var(--c-navy);
  background:var(--c-green); padding:.2rem .7rem; border-radius:8px; font-size:.8rem;
  animation:tp-pop .35s ease-out;
}
.tp-barre{ height:8px; border-radius:4px; background:var(--c-lavender); margin:.6rem 0 1.25rem; overflow:hidden; }
.tp-barre span{
  display:block; height:100%; width:var(--tp-avance,0%); border-radius:inherit;
  background:linear-gradient(90deg,var(--c-blue),var(--c-green)); transition:width .4s ease;
}

/* ---------- Pile de cartes ---------- */
.tp-deck{ position:relative; height:330px; touch-action:pan-y; }
.tp-card{
  --tp-vrai:0; --tp-faux:0;
  position:absolute; inset:0; padding:1.5rem 1.5rem 1.75rem;
  display:flex; flex-direction:column; justify-content:center; gap:.6rem;
  background:var(--c-surface); border:2px solid var(--c-border); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-soft); user-select:none; -webkit-user-select:none;
  transition:transform .3s cubic-bezier(.2,.8,.3,1.2), opacity .3s ease, border-color .2s;
}
.tp-card--active{ cursor:grab; touch-action:none; outline:none; }
.tp-card--active:focus-visible{ box-shadow:0 0 0 3px var(--c-blue), var(--shadow-soft); }
.tp-card--glisse{ transition:none; cursor:grabbing; }
.tp-card--dessous{ transform:scale(.94) translateY(14px); opacity:.6; }
.tp-card--entree{ animation:tp-entree .35s ease-out; }
.tp-card--envol{ transition:transform .38s ease-in, opacity .38s ease-in; }
.tp-card__domaine{
  align-self:flex-start; font-size:.78rem; font-weight:600; color:var(--c-blue);
  background:var(--c-lavender); padding:.25rem .7rem; border-radius:8px;
}
.tp-card__numero{ margin:0; font-family:var(--font-hand); font-size:1.6rem; color:var(--c-green-dark); line-height:1; }
.tp-card__texte{ margin:0; font-size:clamp(1.1rem,3.6vw,1.3rem); font-weight:600; color:var(--c-navy); line-height:1.45; }
.tp-card__tampon{
  position:absolute; top:1rem; width:56px; height:56px; border:3px solid currentColor; border-radius:50%;
  display:grid; place-items:center; font-size:2rem; pointer-events:none; background:var(--c-surface);
}
.tp-card__tampon--vrai{ left:1rem; color:var(--c-green-dark); opacity:var(--tp-vrai); transform:rotate(-12deg) scale(calc(.6 + var(--tp-vrai) * .4)); }
.tp-card__tampon--faux{ right:1rem; color:#D9822B; opacity:var(--tp-faux); transform:rotate(12deg) scale(calc(.6 + var(--tp-faux) * .4)); }

/* ---------- Boutons Faux (croix) / Vrai (coche), de chaque côté de la carte ---------- */
.tp-jeu{ display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:clamp(.5rem,2.5vw,1.25rem); }
.tp-choix{
  width:clamp(52px,14vw,68px); height:clamp(52px,14vw,68px); border-radius:50%; border:2.5px solid;
  display:grid; place-items:center; padding:0; cursor:pointer; background:var(--c-surface);
  box-shadow:var(--shadow-card); transition:transform .15s, background .15s, color .15s, opacity .2s;
}
.tp-choix:hover{ transform:scale(1.08); }
.tp-choix:active{ transform:scale(.92); }
.tp-choix:focus-visible{ outline:3px solid var(--c-blue); outline-offset:3px; }
/* pendant le retour : boutons retirés, le retour prend toute la largeur */
.tp-choix:disabled{ display:none; }
.tp-jeu:has(.tp-choix:disabled){ grid-template-columns:minmax(0,1fr); }
.tp-choix--faux{ color:#D9822B; border-color:#D9822B; }
.tp-choix--faux:hover{ background:#D9822B; color:#fff; }
.tp-choix--vrai{ color:var(--c-green-dark); border-color:var(--c-green); }
.tp-choix--vrai:hover{ background:var(--c-green); color:#0B1B3E; }
/* Pas de sélection de texte pendant le jeu (le glisser à la souris surlignait la page) */
.tp [data-tp-ecran="jeu"]{ -webkit-user-select:none; user-select:none; }

/* ---------- Retour après réponse ---------- */
.tp-retour{
  position:absolute; inset:0; padding:1.5rem; text-align:center;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:.4rem;
  border-radius:var(--radius-lg); border:2px solid; background:var(--c-surface); box-shadow:var(--shadow-soft);
  animation:tp-pop .35s cubic-bezier(.2,.8,.3,1.3);
}
.tp-retour--juste{ border-color:var(--c-green); }
.tp-retour--rate{ border-color:#D9822B; }
.tp-retour--secoue{ animation:tp-pop .35s cubic-bezier(.2,.8,.3,1.3), tp-secoue .45s .3s ease-in-out; }
.tp-retour__badge{ width:52px; height:52px; border-radius:50%; display:grid; place-items:center; color:#fff; }
.tp-retour--juste .tp-retour__badge{ background:var(--c-green-dark); }
.tp-retour--rate .tp-retour__badge{ background:#D9822B; }
.tp-retour__titre{ margin:.2rem 0 0; font-size:1.35rem; font-weight:800; color:var(--c-navy); }
.tp-retour__reponse{ margin:0; color:var(--c-navy); }
.tp-retour__bonne{ display:inline-flex; align-items:center; gap:.3rem; padding:.1rem .6rem .1rem .45rem; border-radius:8px; border:2px solid; }
.tp-retour__bonne--vrai{ color:var(--c-green-dark); border-color:var(--c-green); }
.tp-retour__bonne--faux{ color:#B5651D; border-color:#D9822B; }
.tp-retour__explication{ margin:.2rem 0 .8rem; font-size:.95rem; line-height:1.5; max-width:30rem; }
.tp-eclat{
  position:absolute; top:3.1rem; left:50%; width:8px; height:8px; border-radius:2px; pointer-events:none;
  animation:tp-eclat .8s ease-out forwards;
}

/* ---------- Résultat ---------- */
.tp-resultat{ text-align:center; outline:none; }
.tp-anneau{
  --tp-part:0; position:relative; width:170px; height:170px; margin:0 auto 1rem;
  border-radius:50%; display:grid; place-items:center;
  background:conic-gradient(var(--c-green) calc(var(--tp-part) * 360deg), var(--c-lavender) 0);
  transition:--tp-part 1.1s ease-out;
}
.tp-anneau::before{ content:""; position:absolute; inset:14px; border-radius:50%; background:var(--c-bg); }
.tp-anneau__valeur{ position:relative; font-weight:800; font-size:2.6rem; color:var(--c-navy); line-height:1; }
.tp-anneau__valeur small{ font-size:1rem; font-weight:600; opacity:.7; }
@property --tp-part{ syntax:'<number>'; inherits:false; initial-value:0; }
.tp-profil{ font-family:var(--font-hand); font-size:2.2rem; color:var(--c-green-dark); margin:0; line-height:1.1; }
.tp-message{ max-width:34rem; margin:.5rem auto 1.75rem; }
.tp-domaines{ list-style:none; padding:0; margin:0 auto 2rem; text-align:left; display:grid; gap:.9rem; }
.tp-domaine__tete{ display:flex; justify-content:space-between; font-weight:600; color:var(--c-navy); font-size:.92rem; margin-bottom:.3rem; }
.tp-domaine__jauge{ height:10px; border-radius:4px; background:var(--c-lavender); overflow:hidden; }
.tp-domaine__jauge span{
  display:block; height:100%; width:var(--tp-jauge,0%); border-radius:inherit;
  background:linear-gradient(90deg,var(--c-blue),var(--c-green)); animation:tp-jauge 1s ease-out;
}
.tp-apprendre{
  text-align:left; background:var(--c-lavender); border-radius:var(--radius-lg); padding:1.4rem 1.5rem; margin-bottom:1.75rem;
}
.tp-apprendre h2{ font-size:1.15rem; margin:0 0 .75rem; }
.tp-apprendre ul{ margin:0; padding-left:1.1rem; display:grid; gap:.5rem; }
.tp-fin__note{ font-size:.88rem; max-width:32rem; margin:0 auto 1rem; opacity:.85; }
.tp-fin__actions{ display:flex; flex-wrap:wrap; justify-content:center; gap:.75rem; }

/* ---------- Animations ---------- */
@keyframes tp-entree{ from{ transform:scale(.94) translateY(14px); opacity:.6; } }
@keyframes tp-pop{ 0%{ transform:scale(.85); opacity:0; } 100%{ transform:none; opacity:1; } }
@keyframes tp-secoue{ 20%,60%{ transform:translateX(-7px); } 40%,80%{ transform:translateX(7px); } }
@keyframes tp-eclat{ to{ transform:translate(var(--x),var(--y)) rotate(200deg); opacity:0; } }
@keyframes tp-jauge{ from{ width:0; } }

@media (prefers-reduced-motion: reduce){
  .tp-demo__carte, .tp-card--entree, .tp-retour, .tp-retour--secoue, .tp-serie, .tp-domaine__jauge span{ animation:none; }
  .tp-card, .tp-card--envol, .tp-anneau, .tp-barre span{ transition:none; }
}

@media (max-width:420px){
  .tp-deck{ height:380px; }
  .tp-card{ padding:1.25rem 1rem 1.5rem; }
  .tp-card__texte{ font-size:1.05rem; }
}

/* Mode sombre : orange un peu plus clair pour le contraste */
[data-theme="dark"] .tp-choix--faux{ color:#F0A35E; border-color:#F0A35E; }
[data-theme="dark"] .tp-choix--faux:hover{ background:#F0A35E; color:#0B1B3E; }
[data-theme="dark"] .tp-retour__bonne--faux{ color:#F0A35E; border-color:#F0A35E; }
[data-theme="dark"] .tp-card__tampon--faux, [data-theme="dark"] .tp-demo__fleche--faux{ color:#F0A35E; }
