/* Bloc fiche-defi : le défi du métier en 30 secondes */
.fiche-defi { background: var(--u-soft); }
.fiche-defi__grille { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: var(--space-xl); align-items: start; }
.fiche-defi__intro { position: sticky; top: calc(var(--header-h) + 90px); }
.fiche-defi__h2 { font-size: var(--step-4); line-height: 1; margin-top: var(--space-s); }
.fiche-defi__regle { margin-top: var(--space-m); font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); max-width: 36ch; }
.fiche-defi__infos { margin-top: var(--space-m); display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; }
.fiche-defi__infos li { padding: 0.35rem 0.8rem; border-radius: var(--radius-pill); background: var(--bg-raised); font-size: var(--step--1); box-shadow: inset 0 0 0 1px var(--line); }

/* Le plateau de jeu */
.fiche-defi__jeu {
  position: relative; isolation: isolate; min-height: 520px;
  padding: var(--space-m) var(--space-l) var(--space-l); border-radius: 20px;
  background: var(--bg-raised); box-shadow: var(--shadow-3), inset 0 0 0 1px var(--line);
}
.fiche-defi__hud { display: flex; align-items: center; gap: 1rem; padding-bottom: var(--space-s); border-bottom: 1px dashed var(--line-strong); }
.fiche-defi__chrono { position: relative; flex: none; width: 64px; height: 64px; display: grid; place-items: center; }
.fiche-defi__chrono svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.fiche-defi__chrono circle { fill: none; stroke-width: 5; }
.fiche-defi__chrono-fond { stroke: var(--bg-sunken); }
.fiche-defi__chrono-arc { stroke: var(--u); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke 0.3s linear; }
.fiche-defi__chrono-s { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; }
.fiche-defi__chrono.is-urgent .fiche-defi__chrono-arc { stroke: var(--pink); }
.fiche-defi__chrono.is-urgent .fiche-defi__chrono-s { color: #C02148; animation: defi-pouls 1s ease-in-out infinite; }
@keyframes defi-pouls { 50% { transform: scale(1.18); } }
.fiche-defi__consigne { font-family: var(--font-display); font-weight: 750; font-size: var(--step-2); line-height: 1.05; }
.fiche-defi__plateau { padding-block: var(--space-m); transition: filter var(--dur-slow) var(--ease-out), opacity var(--dur-slow); }
.fiche-defi__jeu[data-etat='pret'] .fiche-defi__plateau { filter: blur(5px) saturate(0.6); opacity: 0.55; }
.fiche-defi__pied { display: flex; justify-content: flex-end; }
.fiche-defi__jeu[data-type='situation'] .fiche-defi__pied { display: none; }
.fiche-defi__jeu[data-etat='fini'] .fiche-defi__pied { display: none; }

/* Départ */
.fiche-defi__depart { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; border-radius: inherit; }
.fiche-defi__depart[hidden] { display: none; }
.fiche-defi__jeu:not([data-etat='pret']) .fiche-defi__depart { pointer-events: none; }
.fiche-defi__lancer {
  position: relative; display: grid; justify-items: center; gap: 0.3rem; padding: 2rem 2.8rem 1.8rem;
  border-radius: 20px; background: var(--navy); color: #fff; box-shadow: var(--shadow-3);
  transition: transform var(--dur-normal) var(--ease-spring), box-shadow var(--dur-normal);
}
.fiche-defi__lancer:hover { transform: translateY(-4px) rotate(-1.5deg); box-shadow: var(--shadow-3), 0 0 0 8px color-mix(in oklab, var(--u) 40%, transparent); }
.fiche-defi__lancer:active { transform: scale(0.97); }
.fiche-defi__lancer:focus-visible { outline: 3px solid var(--yellow); outline-offset: 6px; }
.fiche-defi__lancer-petale { width: 70px; height: 26px; border-radius: 12px; background: var(--u); margin-bottom: 0.8rem; animation: defi-petale 2.4s var(--ease-in-out) infinite; }
@keyframes defi-petale { 50% { transform: scaleX(1.15); } }
.fiche-defi__lancer-texte { font-family: var(--font-display); font-weight: 800; font-size: var(--step-3); line-height: 1; }
.fiche-defi__lancer-sous { font-size: var(--step--1); color: rgb(255 255 255 / 0.75); }

.defi-aide { margin-top: var(--space-s); font-size: var(--step--1); color: var(--ink-soft); }
.defi-aide kbd, .defi-tri__zone-titre kbd {
  display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 0.3em; border-radius: 6px;
  background: var(--bg-sunken); box-shadow: inset 0 -2px 0 var(--line-strong); font: 700 0.8em var(--font-body); color: var(--ink);
}

/* --- Ordre --- */
.defi-ordre { display: grid; gap: 0.5rem; list-style: none; padding: 0; position: relative; }
.defi-ordre__item {
  position: relative; display: grid; grid-template-columns: 2.2rem 1.1rem 1fr auto; align-items: center; gap: 0.7rem;
  padding: 0.75rem 0.7rem 0.75rem 0.8rem; border-radius: 20px; background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line); cursor: grab; touch-action: none; user-select: none;
  transition: box-shadow var(--dur-fast) linear, background-color var(--dur-fast) linear;
}
.defi-ordre__item:hover { box-shadow: inset 0 0 0 2px var(--u); background: #fff; }
.defi-ordre__item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.defi-ordre__item.is-drag { z-index: 5; cursor: grabbing; background: #fff; box-shadow: var(--shadow-3), inset 0 0 0 2px var(--u); }
.defi-ordre__rang { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--u-fond); color: var(--u-ink); font-family: var(--font-display); font-weight: 800; }
.defi-ordre__poignee { display: grid; gap: 3px; }
.defi-ordre__poignee i { display: block; width: 14px; height: 2px; border-radius: 2px; background: var(--line-strong); }
.defi-ordre__texte { font-weight: 560; line-height: 1.35; }
.defi-ordre__fleches { display: flex; gap: 0.2rem; }
.defi-ordre__fleches button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: background-color var(--dur-fast), color var(--dur-fast); }
.defi-ordre__fleches button:hover { background: var(--navy); color: #fff; }
.defi-ico { width: 16px; height: 16px; }
.defi-ico--haut { transform: rotate(180deg); }
.defi-ordre__correction { grid-column: 3 / -1; font-size: var(--step--1); font-weight: 650; }
.defi-ordre__correction:empty { display: none; }
.defi-ordre__item.is-bon { box-shadow: inset 0 0 0 2px #2E7A51; background: color-mix(in oklab, var(--green) 18%, #fff); }
.defi-ordre__item.is-bon .defi-ordre__correction { color: #2E7A51; }
.defi-ordre__item.is-faux { box-shadow: inset 0 0 0 2px #C02148; background: color-mix(in oklab, var(--pink) 10%, #fff); }
.defi-ordre__item.is-faux .defi-ordre__correction { color: #C02148; }
.fiche-defi__jeu[data-etat='fini'] .defi-ordre__fleches { visibility: hidden; }
.fiche-defi__jeu[data-etat='fini'] .defi-ordre__item { cursor: default; }

/* --- Tri --- */
.defi-tri__pioche { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0.6rem; min-height: 64px; border-radius: 18px; background: var(--bg-sunken); }
.defi-tri__pioche:empty::after { content: 'Toutes les cartes sont rangées. Valide !'; margin: auto; color: var(--ink-soft); font-weight: 600; font-size: var(--step--1); }
.defi-tri__carte {
  position: relative; display: inline-flex; flex-direction: column; gap: 0.2rem; max-width: 100%;
  padding: 0.55rem 0.85rem; border-radius: 12px; background: #fff; box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--line);
  font-size: var(--step--1); font-weight: 600; line-height: 1.3; cursor: grab; touch-action: none; user-select: none;
  transition: box-shadow var(--dur-fast) linear, transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.defi-tri__carte:hover { box-shadow: var(--shadow-2), inset 0 0 0 2px var(--u); transform: translateY(-2px); }
.defi-tri__carte[aria-pressed='true'] { background: var(--navy); color: #fff; box-shadow: var(--shadow-2), 0 0 0 3px var(--yellow); }
.defi-tri__carte.is-origine { opacity: 0.3; }
.defi-tri__carte--vol { cursor: grabbing; transform: rotate(-3deg) scale(1.05); box-shadow: var(--shadow-3), inset 0 0 0 2px var(--u); }
.defi-tri__correction { font-size: 0.85em; font-weight: 700; color: #C02148; }
.defi-tri__correction:empty { display: none; }
.defi-tri__carte.is-bon { box-shadow: inset 0 0 0 2px #2E7A51; background: color-mix(in oklab, var(--green) 20%, #fff); color: var(--ink); }
.defi-tri__carte.is-faux { box-shadow: inset 0 0 0 2px #C02148; background: color-mix(in oklab, var(--pink) 10%, #fff); color: var(--ink); }
.defi-tri__zones { margin-top: var(--space-s); display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 0.7rem; }
.defi-tri__zone {
  display: flex; flex-direction: column; gap: 0.5rem; min-height: 190px; padding: 0.8rem; border-radius: 20px;
  background: color-mix(in oklab, var(--u) 8%, #fff); box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--u) 35%, transparent);
  transition: box-shadow var(--dur-fast) linear, background-color var(--dur-fast) linear;
}
.defi-tri__zone[data-teinte='1'] { background: color-mix(in oklab, var(--navy) 5%, #fff); box-shadow: inset 0 0 0 2px var(--line-strong); }
.defi-tri__zone[data-teinte='2'] { background: color-mix(in oklab, var(--yellow) 12%, #fff); }
.defi-tri__zone.is-survol, .a-une-carte .defi-tri__zone:hover { box-shadow: inset 0 0 0 3px var(--u), var(--shadow-2); background: color-mix(in oklab, var(--u) 16%, #fff); }
.defi-tri__zone-titre { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display); font-weight: 750; font-size: var(--step-1); line-height: 1.05; }
.defi-tri__liste { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; list-style: none; padding: 0; flex: 1; }
.defi-tri__deposer { align-self: flex-start; padding: 0.3rem 0.8rem; border-radius: var(--radius-pill); font-size: var(--step--2); font-weight: 650; background: var(--navy); color: #fff; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast); }
.a-une-carte .defi-tri__deposer { opacity: 1; pointer-events: auto; }

/* --- Situation --- */
.defi-situation__scene {
  font-size: var(--step-1); line-height: 1.45; padding: 1rem 1.2rem; border-radius: 20px;
  background: var(--u-soft); box-shadow: inset 5px 0 0 var(--u);
}
.defi-situation__choix { margin-top: var(--space-m); display: grid; gap: 0.6rem; }
.defi-situation__option {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.2rem 0.9rem; align-items: center; text-align: left;
  padding: 0.9rem 1rem; border-radius: 20px; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line-strong);
  font-weight: 560; line-height: 1.4;
  transition: box-shadow var(--dur-fast) linear, transform var(--dur-normal) var(--ease-out), background-color var(--dur-fast);
}
.defi-situation__option:hover { box-shadow: inset 0 0 0 2.5px var(--u), var(--shadow-2); transform: translateX(6px); background: #fff; }
.defi-situation__lettre { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--navy); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.defi-situation__retour { grid-column: 2; font-size: var(--step--1); font-weight: 500; }
.defi-situation__retour:empty { display: none; }
.defi-situation__option.is-bon { box-shadow: inset 0 0 0 2.5px #2E7A51; background: color-mix(in oklab, var(--green) 20%, #fff); transform: none; }
.defi-situation__option.is-bon .defi-situation__lettre { background: #2E7A51; }
.defi-situation__option.is-faux { box-shadow: inset 0 0 0 2.5px #C02148; background: color-mix(in oklab, var(--pink) 10%, #fff); transform: none; }
.defi-situation__option.is-faux .defi-situation__lettre { background: #C02148; }
.defi-situation__option[aria-disabled='true']:not(.is-bon):not(.is-faux) { opacity: 0.55; }

/* --- Calcul --- */
.defi-calcul__donnees { display: grid; gap: 0.4rem; list-style: none; padding: 1rem 1.2rem; border-radius: 12px; background: #FFFDF5; box-shadow: inset 0 0 0 1px var(--line); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.95rem; position: relative; }
.defi-calcul__donnees li::before { content: '› '; color: var(--u-text); font-weight: 700; }
.defi-calcul__question { display: block; margin-top: var(--space-m); font-family: var(--font-display); font-weight: 750; font-size: var(--step-2); line-height: 1.1; }
.defi-calcul__saisie { margin-top: 0.8rem; display: inline-flex; align-items: center; gap: 0.6rem; }
.defi-calcul__input {
  width: 9ch; height: 76px; padding: 0 0.6rem; border: 0; border-radius: 20px; text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; background: var(--paper); box-shadow: inset 0 0 0 2.5px var(--line-strong);
}
.defi-calcul__input:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--u), 0 0 0 6px color-mix(in oklab, var(--u) 25%, transparent); }
.defi-calcul__input.is-bon { box-shadow: inset 0 0 0 3px #2E7A51; background: color-mix(in oklab, var(--green) 20%, #fff); }
.defi-calcul__input.is-faux { box-shadow: inset 0 0 0 3px #C02148; background: color-mix(in oklab, var(--pink) 10%, #fff); }
.defi-calcul__unite { font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--ink-soft); }
.defi-calcul__retour { margin-top: 0.6rem; font-weight: 650; }

/* Résultat et badge */
.fiche-defi__resultat {
  margin-top: var(--space-m); display: grid; grid-template-columns: 140px 1fr; gap: var(--space-l); align-items: start;
  padding: var(--space-m); border-radius: 20px; background: var(--navy); color: #fff;
}
.fiche-defi__resultat[hidden] { display: none; }
.fiche-defi__resultat:focus { outline: none; }
.fiche-defi__resultat :focus-visible { outline-color: var(--yellow); }
.fiche-defi__badge { position: relative; width: 140px; height: 140px; display: grid; place-items: center; border-radius: 20px; background: var(--u); box-shadow: 0 10px 20px rgb(0 0 0 / 0.3); }
.fiche-defi__resultat[data-niveau='parfait'] .fiche-defi__badge { background: var(--yellow); }
.fiche-defi__badge-svg { display: none; }
.fiche-defi__badge-petale { fill: var(--u); stroke: #fff; stroke-width: 3; filter: drop-shadow(0 10px 20px rgb(0 0 0 / 0.35)); }
.fiche-defi__resultat[data-niveau='parfait'] .fiche-defi__badge-petale { fill: var(--yellow); }
.fiche-defi__badge-score { position: relative; font-family: var(--font-display); font-weight: 800; font-size: 2.7rem; color: var(--navy); transform: none; }
.fiche-defi__resultat[data-niveau] .fiche-defi__badge-score { color: var(--u-ink); }
.fiche-defi__resultat[data-niveau='parfait'] .fiche-defi__badge-score { color: var(--navy); }
.fiche-defi__eclat { position: absolute; left: 50%; top: 50%; width: 22px; height: 8px; margin: -4px 0 0 -11px; border-radius: 12px; pointer-events: none; }
.fiche-defi__bilan-titre { font-family: var(--font-display); font-weight: 800; font-size: var(--step-3); line-height: 0.98; }
.fiche-defi__bilan-sous { margin-top: 0.5rem; color: rgb(255 255 255 / 0.8); }
.fiche-defi__retours { margin-top: var(--space-m); padding: 1rem 1.1rem; border-radius: 16px; background: rgb(255 255 255 / 0.07); font-size: var(--step--1); line-height: 1.55; }
.fiche-defi__retours-titre { font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); font-size: var(--step--2); color: var(--yellow); margin-bottom: 0.4rem; }
.fiche-defi__ordre-juste { padding-left: 1.3em; display: grid; gap: 0.2rem; }
.fiche-defi__tri-juste { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; }
.fiche-defi__tri-juste p { font-weight: 700; }
.fiche-defi__tri-juste ul { padding-left: 1.1em; }
.fiche-defi__note { margin-top: 0.5rem; color: rgb(255 255 255 / 0.75); }
.fiche-defi__bilan-actions { margin-top: var(--space-m); }
.fiche-defi__bilan-actions .btn--ghost { color: #fff; }

@media (max-width: 960px) {
  .fiche-defi__grille { grid-template-columns: 1fr; }
  .fiche-defi__intro { position: static; }
  .fiche-defi__resultat { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .fiche-defi__lancer-petale, .fiche-defi__chrono.is-urgent .fiche-defi__chrono-s { animation: none; }
}
