/* Fichly · White Belt Lean en 1 h — styles du déclic du chapitre 3 (agent DÉCLIC 3)
   « La chasse aux 8 gaspillages » (assets/declics/ch3.js). Tous les sélecteurs sous .declic-ch3
   (classes d3-…), jetons de couleur de fichly.css (clair/sombre), charte V2.
   Mobile d’abord (375 px, largeur utile ≈ 309 px) : scène puis panneau ; côte à côte dès 640 px
   de largeur utile. Zones tactiles ≥ 44 px, aucun défilement horizontal. */

.declic-ch3 .d3-root { container-type: inline-size; min-width: 0; }
.declic-ch3 .d3-layout { display: grid; gap: 14px; min-width: 0; }
.declic-ch3 .d3-stage, .declic-ch3 .d3-panel { min-width: 0; }

/* ---------- Compteur et liste des zones ---------- */
.declic-ch3 .d3-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 8px; }
.declic-ch3 .d3-count { margin: 0; font: 700 .82rem/1.3 var(--title); color: var(--soft); }
.declic-ch3 .d3-count b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.declic-ch3 .btn.small { min-height: 44px; }
.declic-ch3 .d3-listbtn { padding: 6px 10px; gap: 6px; font-size: .82rem; }
.declic-ch3 .d3-listbtn svg { width: 16px; height: 16px; }
.declic-ch3 .d3-listbtn[aria-expanded="true"] { border-color: var(--ink); background: var(--lane); }
.declic-ch3 .d3-zlist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.declic-ch3 .d3-zbtn {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; width: 100%; min-height: 44px;
  padding: 8px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
  font: 700 .88rem/1.35 var(--title); text-align: left; cursor: pointer;
}
.declic-ch3 .d3-zbtn:hover { border-color: var(--blue); }
.declic-ch3 .d3-zbtn[aria-current="true"] { border: 2px solid var(--focus); background: var(--brand-soft); }
.declic-ch3 .d3-zl { flex: 1 1 12em; min-width: 0; }
.declic-ch3 .d3-zs { display: inline-flex; align-items: center; gap: 4px; font: 700 .78rem/1.3 var(--title); color: var(--soft); }
.declic-ch3 .d3-zs svg { width: 14px; height: 14px; flex: none; }
.declic-ch3 .d3-zs.is-ok { color: var(--ink); }
.declic-ch3 .d3-zs.is-ko { color: var(--ink); }

/* ---------- Scène (SVG) ---------- */
.declic-ch3 .d3-scene { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--lane); }
.declic-ch3 .d3-svg {
  display: block; width: 100%; height: auto; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.declic-ch3 .d3-bg { fill: var(--lane); }
.declic-ch3 .d3-floor { fill: var(--line); }
.declic-ch3 .d3-o { fill: var(--card); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.declic-ch3 .d3-ink { fill: var(--ink); }
.declic-ch3 .d3-hub { fill: var(--lane); }
.declic-ch3 .d3-part, .declic-ch3 .d3-soft { fill: var(--line-strong); stroke: var(--ink); stroke-width: 1.6; }
.declic-ch3 .d3-lane { fill: var(--lane); stroke: var(--ink); stroke-width: 2; }
.declic-ch3 .d3-open { fill: var(--brand-soft); }
.declic-ch3 .d3-box { fill: var(--nvao); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.declic-ch3 .d3-red { fill: var(--nva); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.declic-ch3 .d3-green { fill: var(--va); stroke: var(--ink); stroke-width: 1.6; }
.declic-ch3 .d3-body { fill: var(--brand-fill); stroke: var(--ink); stroke-width: 2; }
.declic-ch3 .d3-skin { fill: var(--card); stroke: var(--ink); stroke-width: 2.2; }
.declic-ch3 .d3-leg { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; fill: none; }
.declic-ch3 .d3-arm-o { stroke: var(--ink); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.declic-ch3 .d3-arm { stroke: var(--brand-fill); stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.declic-ch3 .d3-st { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.declic-ch3 .d3-thick { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; fill: none; }
.declic-ch3 .d3-handle { stroke: var(--soft); stroke-width: 10; stroke-linecap: round; }
.declic-ch3 .d3-dash { stroke: var(--soft); stroke-width: 3.5; stroke-dasharray: 9 8; stroke-linecap: round; fill: none; }
.declic-ch3 .d3-arrowhead { fill: var(--line-strong); }
.declic-ch3 .d3-go { stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.declic-ch3 .d3-x { stroke: var(--bad); stroke-width: 2.8; stroke-linecap: round; fill: none; }
.declic-ch3 .d3-web { stroke: var(--soft); stroke-width: 1.3; fill: none; }
/* Écran du compteur : toujours sombre (lisible dans les deux thèmes) */
.declic-ch3 .d3-scr { fill: #231f20; stroke: var(--ink); stroke-width: 1.5; }
.declic-ch3 .d3-scrt { font: 700 23px var(--title); text-anchor: middle; }
.declic-ch3 .d3-scrt .bad { fill: #ffc5c1; }
.declic-ch3 .d3-scrt .ok { fill: #ffffff; }

/* Cases cliquables, zone choisie */
.declic-ch3 .d3-hit { fill: transparent; stroke: none; cursor: pointer; }
@media (hover: hover) { .declic-ch3 .d3-hit:hover { fill: var(--brand-soft); fill-opacity: .35; } }
.declic-ch3 .d3-selbox { fill: var(--brand-soft); fill-opacity: .2; stroke: var(--focus); stroke-width: 4; stroke-dasharray: 10 6; }
.declic-ch3 .d3-sel, .declic-ch3 .d3-marks, .declic-ch3 .d3-casc { pointer-events: none; }

/* Zones nommées : anneau + pastille (numéro de la famille ; coche verte pour une zone normale ;
   pastille grise quand la 1re réponse était fausse) */
.declic-ch3 .d3-ring { fill: var(--nva); fill-opacity: .1; stroke: var(--nva); stroke-width: 3.5; stroke-dasharray: 9 6; }
.declic-ch3 .d3-mark.is-va .d3-ring { fill: var(--va); fill-opacity: .14; stroke: var(--va); }
.declic-ch3 .d3-badge circle { fill: var(--brand-fill); stroke: var(--card); stroke-width: 3; }
.declic-ch3 .d3-badge text { fill: var(--on-brand); font: 700 19px var(--title); text-anchor: middle; dominant-baseline: central; }
.declic-ch3 .d3-mark.is-rev .d3-badge circle { fill: var(--line-strong); }
.declic-ch3 .d3-mark.is-rev .d3-badge text { fill: var(--card); }
.declic-ch3 .d3-mark.is-va .d3-badge circle { fill: var(--va); }
.declic-ch3 .d3-mark.is-va.is-rev .d3-badge circle { fill: var(--line-strong); }
.declic-ch3 .d3-badge-ok { fill: none; stroke: #231f20; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.declic-ch3 .d3-mark.is-rev .d3-badge-ok { stroke: var(--card); }
.declic-ch3 .d3-mark.is-new { transform-box: fill-box; transform-origin: center; animation: d3-pop .42s cubic-bezier(.2, 1.5, .4, 1) both; }

/* Flèches du bilan : la surproduction nourrit les autres gaspillages */
.declic-ch3 .d3-flux { animation: d3-fade .5s ease both; }
.declic-ch3 .d3-flux-halo { fill: var(--card); stroke: var(--card); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.declic-ch3 path.d3-flux-halo:first-child { fill: none; }
.declic-ch3 .d3-flux-trait { fill: none; stroke: var(--bad); stroke-width: 4.5; stroke-linecap: round; }
.declic-ch3 .d3-flux-tete { fill: var(--bad); }

@keyframes d3-pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes d3-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Panneau : question, correction, bilan ---------- */
.declic-ch3 .d3-kicker { margin: 0 0 2px; font: 700 .74rem/1.3 var(--title); letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.declic-ch3 .d3-zt { margin: 0 0 8px; font: 700 1.05rem/1.35 var(--title); color: var(--ink); }
.declic-ch3 .d3-zt:focus, .declic-ch3 .d3-bt:focus, .declic-ch3 .d3-fb:focus { outline: none; }
.declic-ch3 .d3-lead { margin: 0 0 10px; }
.declic-ch3 .d3-tip { margin: 8px 0 0; font-size: .92rem; line-height: 1.5; color: var(--ink); font-style: italic; }
.declic-ch3 .d3-note { margin: 10px 0 0; font-size: .86rem; line-height: 1.45; color: var(--soft); }
.declic-ch3 .d3-deja { margin: 10px 0 0; font: 700 .86rem/1.4 var(--title); color: var(--ink); }
.declic-ch3 .d3-q { margin: 0 0 10px; font-weight: 700; }
.declic-ch3 .d3-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Les 9 choix : 8 familles + « Rien d’anormal ici » */
.declic-ch3 .d3-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.declic-ch3 .d3-choice {
  display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 48px; padding: 7px 8px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
  font: 700 .8rem/1.25 var(--title); text-align: left; cursor: pointer; overflow-wrap: break-word;
  transition: border-color .15s ease, background .15s ease;
}
.declic-ch3 .d3-choice:hover { border-color: var(--blue); background: var(--lane); }
.declic-ch3 .d3-choice.is-rien { grid-column: 1 / -1; justify-content: center; text-align: center; border-style: dashed; }
.declic-ch3 .d3-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--brand-soft); color: var(--ink); font: 700 .76rem/1 var(--title);
}

/* Correction (s’appuie sur .q-feedback de fichly.css) */
.declic-ch3 .d3-fb { margin-top: 0; }
.declic-ch3 .d3-fb p { font-size: .95rem; line-height: 1.5; }
.declic-ch3 .d3-fb .d3-num { width: 22px; height: 22px; margin-right: 6px; vertical-align: -.2em; background: var(--brand-fill); color: var(--on-brand); font-size: .74rem; }
.declic-ch3 .d3-votre { font-size: .86rem !important; color: var(--soft); }

/* Bilan */
.declic-ch3 .d3-bt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 6px; font: 700 1.02rem/1.35 var(--title); color: var(--ink); }
.declic-ch3 .d3-score { font: 700 2rem/1 var(--title); color: var(--navy); font-variant-numeric: tabular-nums; }
.declic-ch3 .d3-bmsg { margin: 0; }
.declic-ch3 .d3-reprise { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 0; font: 700 .9rem/1.4 var(--title); color: var(--ink); }
.declic-ch3 .d3-reprise svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.declic-ch3 .d3-callout { margin: 14px 0 0; }
.declic-ch3 .d3-callout p { font-size: .95rem; line-height: 1.5; }
.declic-ch3 .d3-callout p + p { margin-top: 8px; }
.declic-ch3 .d3-fams-t { margin: 16px 0 6px; font: 700 .9rem/1.3 var(--title); color: var(--ink); }
.declic-ch3 .d3-fams { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.declic-ch3 .d3-fams li { display: flex; align-items: center; gap: 8px; min-width: 0; font: 700 .84rem/1.3 var(--title); }
.declic-ch3 .d3-fams li > span:last-child { min-width: 0; overflow-wrap: break-word; }
.declic-ch3 .d3-fams .tag { font-size: .66rem; padding: 3px 6px; margin-left: 2px; }

/* Très petit écran (≈ 320 px) : les choix sur une colonne, pour ne pas couper les mots */
@container (max-width: 280px) {
  .declic-ch3 .d3-choices, .declic-ch3 .d3-fams { grid-template-columns: minmax(0, 1fr); }
}

/* Téléphone : boutons pleine largeur */
@media (max-width: 560px) {
  .declic-ch3 .d3-actions .btn { width: 100%; }
}

/* Côte à côte quand la place le permet (largeur utile du cadre, pas celle de l’écran) */
@container (min-width: 640px) {
  .declic-ch3 .d3-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .declic-ch3 .d3-panel { padding-top: 52px; }
}
@supports not (container-type: inline-size) {
  @media (min-width: 760px) {
    .declic-ch3 .d3-layout { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
    .declic-ch3 .d3-panel { padding-top: 52px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .declic-ch3 .d3-mark.is-new, .declic-ch3 .d3-flux { animation: none; }
  .declic-ch3 .d3-choice { transition: none; }
}

/* ---------- Charte V2 (CHARTE-V2.md) : le dessin garde un fond blanc ; pas d’opacité ;
   numéros dans des pastilles ; les réponses gardent leur mot ou leur picto ---------- */
.declic-ch3 .d3-zbtn { border: 1px solid var(--line-ui); background: var(--white); }
.declic-ch3 .d3-zbtn:hover { border-color: var(--bf); }
.declic-ch3 .d3-zbtn[aria-current="true"] { border: 2px solid var(--bf); background: var(--bf-c); }
.declic-ch3 .d3-zs svg { box-sizing: content-box; padding: 2px; border-radius: 50%; }
.declic-ch3 .d3-zs.is-ok svg { background: var(--vm); }
.declic-ch3 .d3-zs.is-ko svg { background: var(--jm); }
.declic-ch3 .d3-scene { border-radius: var(--radius); }
/* Écran du compteur : un afficheur, toujours sombre (dessin d’une machine) */
.declic-ch3 .d3-scr { fill: #231f20; }
.declic-ch3 .d3-scrt .bad { fill: #ffc5c1; }
.declic-ch3 .d3-scrt .ok { fill: #f9f8f8; }
@media (hover: hover) { .declic-ch3 .d3-hit:hover { fill: var(--bf-c); fill-opacity: 1; mix-blend-mode: multiply; } }
.declic-ch3 .d3-selbox { fill: none; stroke: var(--bf); }
.declic-ch3 .d3-ring { fill: none; stroke: var(--rf); }
.declic-ch3 .d3-mark.is-va .d3-ring { fill: none; stroke: var(--vf); }
.declic-ch3 .d3-badge circle { fill: #3c4399; stroke: var(--white); }
.declic-ch3 .d3-badge text { fill: #ffffff; font-weight: 700; }
.declic-ch3 .d3-mark.is-rev .d3-badge circle, .declic-ch3 .d3-mark.is-va.is-rev .d3-badge circle { fill: #8a8485; }
.declic-ch3 .d3-mark.is-rev .d3-badge text { fill: #ffffff; }
.declic-ch3 .d3-mark.is-va .d3-badge circle { fill: #80ae66; }
.declic-ch3 .d3-badge-ok { stroke: #231f20; }
.declic-ch3 .d3-mark.is-rev .d3-badge-ok { stroke: #ffffff; }
.declic-ch3 .d3-flux-halo { fill: var(--white); stroke: var(--white); }
.declic-ch3 .d3-choice { border: 1px solid var(--line-ui); background: var(--white); font-weight: 700; }
.declic-ch3 .d3-choice:hover { border-color: var(--bf); background: var(--bf-c); }
.declic-ch3 .d3-num { background: var(--bf-m); color: var(--ink); }
.declic-ch3 .d3-reprise svg { box-sizing: content-box; width: 14px; height: 14px; padding: 2px; border-radius: 50%; background: var(--vm); }
.declic-ch3 .d3-fams .tag { color: #231f20; }
.declic-ch3 .d3-arrowhead { fill: var(--ink); }
