/* Fichly · White Belt Lean en 1 h — styles du déclic du chapitre 4 (agent DÉCLIC 4)
   « Les 5S, marche après marche » : l’escalier des 5S, puis 5 postes avant / après.
   Tous les sélecteurs sous .declic-ch4 (classes d4-…), jetons de couleur de fichly.css
   (clair/sombre), charte V2, zones tactiles ≥ 44 px, sans défilement horizontal à 375 px. */

.declic-ch4 .d4 { display: grid; gap: 14px; min-width: 0; }
.declic-ch4 [hidden] { display: none !important; }

/* Les deux temps */
.declic-ch4 .d4-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.declic-ch4 .d4-phases { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.declic-ch4 .d4-phases li { display: inline-flex; align-items: center; padding: 6px 11px; border-radius: var(--pill); background: var(--lane); color: var(--soft); font: 700 .76rem/1.2 var(--title); }
.declic-ch4 .d4-phases li.is-current { background: var(--module); color: var(--on-module); }
.declic-ch4 .d4-phases li.is-done { background: var(--ok-bg); color: var(--ink); }
.declic-ch4 .d4-prev { margin: 0; font-size: .82rem; color: var(--soft); }

/* Mise en page : une colonne sur téléphone, deux sur grand écran */
.declic-ch4 .d4-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.declic-ch4 .d4-col { min-width: 0; }
@media (min-width: 820px) {
  .declic-ch4 .d4-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
}

.declic-ch4 .d4-ask { margin: 0 0 4px; font: 700 1.05rem/1.35 var(--title); color: var(--ink); }
.declic-ch4 .d4-help { margin: 0 0 12px; font-size: .88rem; line-height: 1.45; color: var(--soft); }
.declic-ch4 [data-stairs] { margin-top: 10px; }

/* L’escalier (même dessin que la fiche du module 4 : la marche 1 en haut, la plus courte) */
.declic-ch4 .d4-stairs { display: grid; gap: 10px; }
.declic-ch4 .d4-grp { display: grid; gap: 6px; }
.declic-ch4 .d4-grp-t { margin: 0; display: flex; align-items: center; gap: 8px; font: 700 .74rem/1.3 var(--title); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.declic-ch4 .d4-grp-t::before { content: ""; flex: none; width: 18px; height: 4px; border-radius: var(--pill); background: var(--brand); }
.declic-ch4 .d4-grpB .d4-grp-t::before { background: var(--va); }
.declic-ch4 .d4-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.declic-ch4 .d4-steps > li { width: calc(62% + var(--i) * 9.5%); min-width: 0; }

.declic-ch4 .d4-slot {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; column-gap: 10px;
  width: 100%; min-height: 50px; margin: 0; padding: 7px 10px; border-radius: var(--radius-sm);
  border: 2px dashed var(--line); background: var(--card); color: var(--soft);
  font: inherit; text-align: left;
}
.declic-ch4 .d4-slot.is-next { border-style: solid; border-color: var(--blue); }
.declic-ch4 .d4-slot.is-on { border: 0; border: 1px solid var(--brand); padding: 7px 10px 7px 9px; background: var(--brand-soft); color: var(--ink); }
.declic-ch4 .d4-grpB .d4-slot.is-on { border-color: var(--va); background: var(--ok-bg); }
.declic-ch4 .d4-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--lane); color: var(--soft); font: 700 .88rem/1 var(--title); }
.declic-ch4 .d4-slot.is-next .d4-num { background: var(--brand-fill); color: var(--on-brand); }
.declic-ch4 .d4-slot.is-on .d4-num { background: var(--brand-fill); color: var(--on-brand); }
.declic-ch4 .d4-grpB .d4-slot.is-on .d4-num { background: var(--va); color: var(--on-fill); }
.declic-ch4 .d4-txt { min-width: 0; }
.declic-ch4 .d4-lbl { display: block; }
.declic-ch4 .d4-lbl b { font: 700 1rem/1.25 var(--title); color: var(--ink); }
.declic-ch4 .d4-lbl i { font-style: normal; font: 700 .84rem/1.25 var(--title); color: var(--ink); margin-left: 4px; }
.declic-ch4 .d4-slot em { display: block; font-style: normal; font-size: .8rem; line-height: 1.3; color: var(--ink); }
.declic-ch4 .d4-empty { font: 700 .84rem/1.2 var(--title); color: var(--ink); }
.declic-ch4 .d4-slot.is-new { animation: d4-pop .32s ease-out; }
@keyframes d4-pop { from { transform: scale(.94); opacity: .35; } to { transform: none; opacity: 1; } }

/* Téléphone : escalier plus compact, pour que les étapes à toucher (sous l’escalier) arrivent plus haut.
   Au 1er temps les marches ne sont pas des boutons (div) ; au 2e temps (boutons), 44 px au moins. */
@media (max-width: 560px) {
  .declic-ch4 .d4-stairs { gap: 6px; }
  .declic-ch4 .d4-slot { min-height: 44px; }
  .declic-ch4 div.d4-slot { min-height: 40px; }
}

/* 2e temps : les marches sont des boutons */
.declic-ch4 .d4-pick { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .declic-ch4 .d4-pick:not([aria-disabled="true"]):hover { box-shadow: inset 0 0 0 2px var(--blue); } }
.declic-ch4 .d4-pick[aria-disabled="true"] { cursor: default; }
/* États après la réponse (plus précis que .d4-grpB .d4-slot.is-on) : bonne marche en vert, marche touchée à tort en rouge */
.declic-ch4 .d4-steps .d4-pick.is-answer { background: var(--ok-bg); box-shadow: inset 0 0 0 2px var(--va); }
.declic-ch4 .d4-steps .d4-pick.is-wrong { background: var(--bad-bg); box-shadow: inset 0 0 0 2px var(--nva); }
.declic-ch4 .d4-mark { display: grid; place-items: center; width: 24px; height: 24px; }
.declic-ch4 .d4-mark:empty { display: none; }
.declic-ch4 .d4-mark svg { width: 20px; height: 20px; }
.declic-ch4 .d4-pick.is-answer .d4-mark { color: var(--ink); }
.declic-ch4 .d4-pick.is-wrong .d4-mark { color: var(--ink); }

/* 1er temps : les 5 étapes à placer */
.declic-ch4 .d4-pool-t { margin: 0 0 8px; font: 700 .74rem/1.3 var(--title); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.declic-ch4 .d4-pool { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.declic-ch4 .d4-chip {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-width: 0; min-height: 56px; margin: 0; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background-color .15s ease;
}
.declic-ch4 .d4-chip b { font: 700 1rem/1.2 var(--title); overflow-wrap: anywhere; }
.declic-ch4 .d4-chip span { font: 700 .84rem/1.2 var(--title); color: var(--ink); }
@media (hover: hover) { .declic-ch4 .d4-chip:hover { border-color: var(--blue); } }
.declic-ch4 .d4-chip.is-wrong { border-color: var(--nva); background: var(--bad-bg); }
.declic-ch4 .d4-chip.is-shake { animation: d4-shake .36s; }
@keyframes d4-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.declic-ch4 .q-feedback p + p { margin-top: 6px; }
.declic-ch4 .d4-next { margin-top: 12px; }
.declic-ch4 .d4-next:empty { display: none; }
@media (max-width: 560px) { .declic-ch4 .d4-next .btn { width: 100%; } }

/* 2e temps : le poste, avant et après */
.declic-ch4 .d4-card { display: grid; gap: 10px; }
.declic-ch4 .d4-k { margin: 0; font: 700 .76rem/1.3 var(--title); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
/* Titres qui reçoivent le focus par script (tabindex=-1, non interactifs) : pas de cadre */
.declic-ch4 .d4-k:focus, .declic-ch4 .d4-bilan-t:focus { outline: none; }
.declic-ch4 .d4-ba {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr);
  grid-template-areas: "ia ar ib" "ca . cb"; column-gap: 5px; row-gap: 8px; align-items: start;
}
.declic-ch4 .d4-ia { grid-area: ia; }
.declic-ch4 .d4-ib { grid-area: ib; }
.declic-ch4 .d4-ca { grid-area: ca; }
.declic-ch4 .d4-cb { grid-area: cb; }
.declic-ch4 .d4-arrow { grid-area: ar; align-self: center; display: grid; place-items: center; width: 20px; height: 20px; color: var(--soft); }
.declic-ch4 .d4-arrow svg { width: 18px; height: 18px; }
.declic-ch4 .d4-img { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--lane); }
.declic-ch4 .d4-ib { border-color: var(--va); box-shadow: 0 0 0 1px var(--va); }
.declic-ch4 .d4-cap { margin: 0; min-width: 0; font-size: .84rem; line-height: 1.4; color: var(--ink); }
.declic-ch4 .d4-cap b { display: block; margin-bottom: 2px; font: 700 .72rem/1.3 var(--title); letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.declic-ch4 .d4-cb b { color: var(--ink); }
@media (min-width: 480px) { .declic-ch4 .d4-cap { font-size: .9rem; } }

/* Dessins SVG (couleurs par jetons, clair et sombre) */
.declic-ch4 .d4-sv { display: block; width: 100%; height: auto; }
.declic-ch4 .d4-sv-wall { fill: var(--lane); }
.declic-ch4 .d4-sv-floor { fill: var(--line); }
.declic-ch4 .d4-sv-edge { fill: none; stroke: var(--soft); stroke-width: .8; opacity: .5; }
.declic-ch4 .d4-sv-bench { fill: var(--f-brun); }
.declic-ch4 .d4-sv-leg { fill: var(--line-strong); }
.declic-ch4 .d4-sv-board { fill: var(--card); stroke: var(--soft); stroke-width: .8; }
.declic-ch4 .d4-sv-cle { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; }
.declic-ch4 .d4-sv-hdl { fill: none; stroke: var(--f-brun); stroke-width: 3; stroke-linecap: round; }
.declic-ch4 .d4-sv-head { fill: var(--ink); }
.declic-ch4 .d4-sv-shaft { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.declic-ch4 .d4-sv-grip { fill: var(--f-bleu-clair); stroke: var(--ink); stroke-width: .6; }
/* Silhouette peinte du tableau d’ombres : même forme que l’outil, en gris ; l’outil la recouvre à sa place */
.declic-ch4 .d4-sv-sil { opacity: .4; }
.declic-ch4 .d4-sv-sil .d4-sv-cle, .declic-ch4 .d4-sv-sil .d4-sv-hdl, .declic-ch4 .d4-sv-sil .d4-sv-shaft { stroke: var(--soft); }
.declic-ch4 .d4-sv-sil .d4-sv-head, .declic-ch4 .d4-sv-sil .d4-sv-grip { fill: var(--line-strong); stroke: none; }
.declic-ch4 .d4-sv-lbl { fill: var(--card); stroke: var(--ink); stroke-width: .7; }
.declic-ch4 .d4-sv-carton { fill: var(--f-jaune); stroke: var(--ink); stroke-width: .7; }
.declic-ch4 .d4-sv-tape { fill: none; stroke: var(--ink); stroke-width: .7; opacity: .6; }
.declic-ch4 .d4-sv-crate { fill: var(--card); stroke: var(--ink); stroke-width: .9; }
.declic-ch4 .d4-sv-tag { fill: var(--nva); stroke: var(--ink); stroke-width: .5; }
.declic-ch4 .d4-sv-hole { fill: var(--card); }
.declic-ch4 .d4-sv-stain { fill: var(--line-strong); opacity: .45; }
.declic-ch4 .d4-sv-chip { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; opacity: .7; }
.declic-ch4 .d4-sv-oil { fill: var(--ink); }
.declic-ch4 .d4-sv-ring { fill: none; stroke: var(--nva); stroke-width: 1.8; stroke-dasharray: 3 2; }
.declic-ch4 .d4-sv-mark { fill: none; stroke: var(--f-jaune); stroke-width: 2.6; stroke-dasharray: 6 3; }
.declic-ch4 .d4-sv-frame { fill: var(--card); stroke: var(--ink); stroke-width: 1; }
.declic-ch4 .d4-sv-ph { fill: none; stroke: var(--soft); stroke-width: 1.2; stroke-linecap: round; }
.declic-ch4 .d4-sv-okc { fill: var(--va); }
.declic-ch4 .d4-sv-okm { fill: none; stroke: var(--on-fill); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.declic-ch4 .d4-sv-clip { fill: var(--line-strong); }
.declic-ch4 .d4-sv-tick { fill: none; stroke: var(--ok); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.declic-ch4 .d4-sv-cup { fill: var(--card); stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.declic-ch4 .d4-sv-person { fill: var(--brand); }
.declic-ch4 .d4-sv-legs { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; }

/* Bilan */
.declic-ch4 .d4-bilan { display: grid; gap: 16px; }
.declic-ch4 .d4-res { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--f-jaune); }
.declic-ch4 .d4-res.is-ok { background: var(--ok-bg); border-color: var(--va); }
.declic-ch4 .d4-score { flex: none; margin: 0; font: 700 1.1rem/1 var(--title); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.declic-ch4 .d4-score b { font-size: 2.3rem; font-weight: 700; }
.declic-ch4 .d4-res-txt { min-width: 0; }
.declic-ch4 .d4-bilan-t { margin: 0 0 2px; font-size: 1.1rem; }
.declic-ch4 .d4-res-d { margin: 0; font: 700 .84rem/1.4 var(--title); color: var(--ink); }
.declic-ch4 .d4-res-m { margin: 4px 0 0; font-size: .92rem; line-height: 1.45; }
.declic-ch4 .d4-col-fin { display: grid; gap: 14px; }
.declic-ch4 .d4-col-fin .callout { margin: 0; }
.declic-ch4 .d4-chrono { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.declic-ch4 .d4-chrono figcaption { margin: 0 0 10px; font: 700 .95rem/1.35 var(--title); color: var(--ink); }
.declic-ch4 .d4-chrono ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.declic-ch4 .d4-chrono li { display: grid; grid-template-columns: 5.4em minmax(0, 1fr) 3.2em; align-items: center; gap: 8px; font-size: .9rem; }
.declic-ch4 .d4-chrono li > span:first-child { font-weight: 700; }
.declic-ch4 .d4-bar { height: 14px; border-radius: var(--radius-sm); background: var(--lane); overflow: hidden; }
.declic-ch4 .d4-bar i { display: block; height: 100%; border-radius: var(--radius-sm); }
.declic-ch4 .d4-chrono li:nth-child(1) i { background: var(--nva); }
.declic-ch4 .d4-chrono li:nth-child(2) i { background: var(--nvao); }
.declic-ch4 .d4-chrono li:nth-child(3) i { background: var(--va); }
.declic-ch4 .d4-chrono b { text-align: right; font: 700 .95rem/1 var(--title); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .declic-ch4 .d4-slot.is-new, .declic-ch4 .d4-chip.is-shake { animation: none; }
  .declic-ch4 .d4-chip { transition: none; }
}

/* ---------- Charte V2 (CHARTE-V2.md) : trois états (forte = en cours, moyenne = fait, contour = à venir),
   pas d’opacité, la bonne et la mauvaise marche gardent leur coche ou leur croix ---------- */
.declic-ch4 .d4-phases li { background: var(--white); border: 1px solid var(--line-ui); color: var(--ink); padding: 4px 12px; min-height: 32px; }
.declic-ch4 .d4-phases li.is-current { background: var(--module); border-color: var(--module); color: var(--on-module); }
.declic-ch4 .d4-phases li.is-done { background: var(--vm); border-color: var(--vf); color: var(--ink); }
.declic-ch4 .d4-grp-t::before { width: 24px; border-radius: var(--pill); background: var(--bf); }
.declic-ch4 .d4-slot { border: 2px dashed var(--line-ui); color: var(--ink); }
.declic-ch4 .d4-slot.is-next { border: 2px solid var(--bf); }
.declic-ch4 .d4-slot.is-on { border: 1px solid var(--bf); padding: 8px 10px; background: var(--bf-c); }
.declic-ch4 .d4-grpB .d4-slot.is-on { border-color: var(--vf); background: var(--vc); }
.declic-ch4 .d4-num { background: var(--white); border: 1px solid var(--line-ui); color: var(--ink); }
.declic-ch4 .d4-slot.is-next .d4-num, .declic-ch4 .d4-slot.is-on .d4-num { background: #3c4399; border-color: #3c4399; color: #ffffff; }
.declic-ch4 .d4-grpB .d4-slot.is-on .d4-num { background: var(--vm); border-color: var(--vf); color: var(--ink); }
@media (hover: hover) { .declic-ch4 .d4-pick:not([aria-disabled="true"]):hover { box-shadow: 0 0 0 3px var(--bf-m); } }
.declic-ch4 .d4-steps .d4-pick.is-answer { background: var(--vc); box-shadow: inset 0 0 0 2px var(--vf); }
.declic-ch4 .d4-steps .d4-pick.is-wrong { background: var(--rc); box-shadow: inset 0 0 0 2px var(--rf); }
.declic-ch4 .d4-mark { border-radius: 50%; }
.declic-ch4 .d4-pick.is-answer .d4-mark { background: var(--vm); }
.declic-ch4 .d4-pick.is-wrong .d4-mark { background: var(--rm); }
.declic-ch4 .d4-mark svg { width: 16px; height: 16px; }
.declic-ch4 .d4-chip { border: 1px solid var(--line-ui); background: var(--white); }
@media (hover: hover) { .declic-ch4 .d4-chip:hover { border-color: var(--bf); box-shadow: 0 0 0 2px var(--bf-m); } }
.declic-ch4 .d4-chip.is-wrong { border-color: var(--rf); background: var(--rc); }
.declic-ch4 .d4-img { background: var(--white); border-radius: var(--radius-sm); }
.declic-ch4 .d4-ib { border-color: var(--vf); box-shadow: 0 0 0 1px var(--vf); }
/* Dessins : aplats sans opacité (gris chaud) ; la silhouette du tableau d’ombres en gris clair */
.declic-ch4 .d4-sv-wall { fill: var(--white); }
.declic-ch4 .d4-sv-edge { stroke: var(--line-ui); opacity: 1; }
.declic-ch4 .d4-sv-sil { opacity: 1; }
.declic-ch4 .d4-sv-sil .d4-sv-cle, .declic-ch4 .d4-sv-sil .d4-sv-hdl, .declic-ch4 .d4-sv-sil .d4-sv-shaft { stroke: var(--line-strong); }
.declic-ch4 .d4-sv-sil .d4-sv-head, .declic-ch4 .d4-sv-sil .d4-sv-grip { fill: var(--line-strong); }
.declic-ch4 .d4-sv-tape, .declic-ch4 .d4-sv-chip { opacity: 1; stroke: var(--line-ui); }
.declic-ch4 .d4-sv-stain { opacity: 1; fill: var(--line-strong); }
.declic-ch4 .d4-sv-tick { stroke: #231f20; }
.declic-ch4 .d4-sv-person { fill: var(--bf); }
.declic-ch4 .d4-sv-legs { stroke: var(--bf); }
.declic-ch4 .d4-res { border: 1px solid var(--jf); background: var(--jc); }
.declic-ch4 .d4-res.is-ok { border-color: var(--vf); background: var(--vc); }
.declic-ch4 .d4-chrono { border-color: var(--line-strong); }
.declic-ch4 .d4-bar { border-radius: var(--pill); background: var(--line); }
.declic-ch4 .d4-bar i { border-radius: var(--pill); }
