/* Blocs à fusionner : même vert que le reste du site */
#features.bl-section { padding-top: 1em; }
.bl-outil { max-width: 74em; margin: 0 auto; text-align: left; display: flex; flex-direction: column; }
.bl-outil *:focus-visible { outline: 3px solid #f2b01e; outline-offset: 2px; }
.bl-outil:fullscreen { background: #fff; padding: 1em 1.5em; max-width: none; height: 100vh; box-sizing: border-box; overflow: auto; }
.bl-outil:-webkit-full-screen { background: #fff; padding: 1em 1.5em; max-width: none; height: 100vh; box-sizing: border-box; overflow: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Le calcul en grand */
.bl-calcul { min-height: 1.6em; text-align: center; font: 600 2.4em/1.5 'Fredoka', 'Nunito', sans-serif; color: #555; margin-bottom: .2em; }
.bl-calcul .bl-n { display: inline-block; min-width: 1.3em; padding: 0 .2em; border-radius: .25em; }
.bl-calcul .bl-op { margin: 0 .3em; color: #999; }
.bl-calcul .bl-res { color: #16855a; }
.bl-calcul .bl-vide { font-size: .5em; color: #aaa; font-family: 'Nunito', sans-serif; font-weight: 600; }
.bl-cache { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5em; height: 1.2em; margin: 0 .1em; border-radius: .25em; background: #eaf7f1; color: #16855a; cursor: pointer; vertical-align: middle; font-size: .9em; }
.bl-cache:hover { background: #d4efe3; }

/* La scène */
.bl-scene { position: relative; cursor: crosshair; height: clamp(18em, 62vh, 34em); border: 2px solid #e5e5e5; border-radius: 1.2em; background: #fff linear-gradient(#f3f3f3 1px, transparent 1px) 0 0 / 100% 2em; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
.bl-outil:fullscreen .bl-scene, .bl-outil:-webkit-full-screen .bl-scene { flex: 1 1 auto; height: auto; }

.bl-tour.cible .bl-pile { outline: 3px dashed #f2b01e; outline-offset: 5px; border-radius: 4px; }
@keyframes bl-arrive { from { transform: translateY(-14px); opacity: 0; } }
.bl-nb { font: 700 calc(var(--t, 40px) * .62)/1.2 'Fredoka', 'Nunito', sans-serif; color: #444; margin-bottom: .15em; min-height: 1.2em; min-width: 1.4em; text-align: center; }
.bl-nb.bl-cache { font-size: calc(var(--t, 40px) * .5); height: auto; padding: 0 .3em; }
.bl-pile { display: flex; flex-direction: column-reverse; }
.bl-cube { width: var(--t, 40px); height: var(--t, 40px); box-sizing: border-box; border: 2px solid rgba(0, 0, 0, .22); border-radius: calc(var(--t, 40px) * .14); margin-top: -2px; background: var(--c, #16855a); box-shadow: inset 0 calc(var(--t, 40px) * .12) 0 rgba(255, 255, 255, .28), inset 0 calc(var(--t, 40px) * -.1) 0 rgba(0, 0, 0, .12); }
/* Tours posées librement dans la scène */
.bl-sol { position: absolute; inset: 0; }
.bl-sol:after { content: ''; position: absolute; left: 1em; right: 1em; bottom: 4px; height: 3px; border-radius: 2px; background: #e3e3e3; }
.bl-tour { position: absolute; display: flex; flex-direction: column; align-items: center; cursor: grab; touch-action: none; }
.bl-tour.glisse { cursor: grabbing; z-index: 10; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .18)); }
.bl-tour.choisie .bl-pile { outline: 3px solid #5cc79a; outline-offset: 4px; border-radius: 4px; }
.bl-cube.pop { animation: bl-pop .4s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d, 0ms); }
@keyframes bl-pop { from { transform: scale(0); opacity: 0; } }
.bl-tour.tape .bl-pile { animation: bl-tape .25s ease-out; }
@keyframes bl-tape { 50% { transform: scale(1.06); } }
.bl-nb.compte { animation: bl-tape .3s ease-out 2; }
/* Le trait tracé au doigt (entourer ou couper) */
.bl-trace { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.bl-trace path { fill: none; stroke: #2f6f8f; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 9; opacity: .8; transition: opacity .4s, fill .2s; }
.bl-trace path.ferme { fill: rgba(92, 199, 154, .18); stroke: #16855a; stroke-dasharray: none; }
.bl-trace path.coupe { stroke: #c0392b; stroke-dasharray: none; }
.bl-trace path.fini { opacity: 0; }
.bl-cube.r5 { margin-bottom: calc(var(--t, 40px) * .22); }

.bl-corbeille { position: absolute; right: .8em; bottom: .8em; width: 3.2em; height: 3.2em; border-radius: 50%; border: 2px dashed #ddd; color: #bbb; display: flex; align-items: center; justify-content: center; font-size: 1.1em; transition: all .2s; }
.bl-corbeille.cible { border-color: #c0392b; color: #fff; background: #c0392b; transform: scale(1.15); }
.bl-message { position: absolute; left: 50%; top: .8em; transform: translateX(-50%); margin: 0; padding: .4em 1em; border-radius: 2em; background: #fdf2e1; color: #b76a06; font-weight: 700; font-size: .9em; opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; }
.bl-message.visible { opacity: 1; }
.bl-depart { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 1.05em; text-align: center; padding: 1em; pointer-events: none; }

.bl-historique { margin: .5em 0 0; min-height: 1.5em; text-align: center; color: #999; font-size: .9em; }
.bl-historique b { color: #666; margin: 0 .5em; font-weight: 600; white-space: nowrap; }

/* Réglages en dessous, en paysage */
.bl-reglages { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, 1fr); gap: 1em; margin-top: 1em; }
.bl-outil:fullscreen .bl-reglages, .bl-outil:-webkit-full-screen .bl-reglages { margin-top: .6em; }
.bl-panneau { background: #fff; border: 2px solid #e5e5e5; border-radius: 1.2em; padding: .8em 1em 1em; }
.bl-panneau h3 { margin: 0 0 .6em; font-size: .85em; color: #16855a; text-align: center; letter-spacing: .08em; text-transform: uppercase; }
.bl-ajouts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .45em; }
.bl-ajout { display: flex; flex-direction: column; align-items: center; gap: .2em; padding: .35em .2em .3em; border: 2px solid #e5e5e5; border-radius: .7em; background: #fff; cursor: pointer; font: 700 1.15em/1.1 'Fredoka', 'Nunito', sans-serif; color: #555; transition: border-color .2s; }
.bl-ajout:hover { border-color: #5cc79a; }
.bl-ajout i { display: flex; flex-direction: column-reverse; justify-content: flex-start; gap: 1px; height: 2.3em; }
.bl-ajout i b { display: block; width: .55em; height: .14em; border-radius: 1px; background: var(--c); }
.bl-max { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .45em; margin-top: .8em; font-size: .88em; color: #888; }
.bl-puce { padding: .25em .9em; border: 2px solid #e5e5e5; border-radius: 2em; background: #fff; color: #777; cursor: pointer; -webkit-user-select: none; user-select: none; }
.bl-puce:hover { border-color: #5cc79a; }
.bl-puce.actif { background: #16855a; border-color: #16855a; color: #fff; }

.bl-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5em; }
.bl-act { display: flex; align-items: center; gap: .55em; padding: .45em .8em; border: 2px solid #e5e5e5; border-radius: .8em; background: #fff; color: #555; cursor: pointer; font-size: .9em; line-height: 1.3; -webkit-user-select: none; user-select: none; transition: border-color .2s; }
.bl-act:hover { border-color: #5cc79a; }
.bl-act .icon { flex: none; width: 1.9em; height: 1.9em; border-radius: 50%; background: #eaf7f1; color: #16855a; display: flex; align-items: center; justify-content: center; }
.bl-act .icon:before { margin: 0; }
.bl-act.actif { border-color: #16855a; }
.bl-act.actif .icon { background: #16855a; color: #fff; }
.bl-act.off { opacity: .4; pointer-events: none; }

.bl-code { display: flex; gap: .5em; margin: 0; }
.bl-code input { flex: 1; min-width: 0; font: 600 1.1em/1 'Fredoka', 'Nunito', sans-serif !important; letter-spacing: .05em; padding: .5em .7em !important; border: 2px solid #e5e5e5 !important; border-radius: .6em !important; background: #fff !important; color: #16855a !important; box-shadow: none !important; }
.bl-code input:focus { border-color: #16855a !important; outline: none; }
.bl-code input.erreur { border-color: #c0392b !important; color: #c0392b !important; text-decoration: underline wavy #c0392b; }
.bl-valider { flex: none; padding: 0 1em !important; border-radius: .6em !important; background: #16855a !important; color: #fff !important; font-size: .85em !important; letter-spacing: 1px; line-height: 2.6 !important; height: auto !important; box-shadow: none !important; }
.bl-aide-code { margin: .6em 0 0; font-size: .8em; line-height: 1.5; color: #888; }
.bl-aide-code b { color: #16855a; white-space: nowrap; }

.bl-astuce { margin: 1em 0 0; text-align: center; font-size: .82em; color: #999; }
.bl-astuce .icon { color: #5cc79a; margin-right: .3em; }
.bl-outil:fullscreen .bl-astuce, .bl-outil:-webkit-full-screen .bl-astuce { display: none; }

@media screen and (max-width: 1100px) {
	.bl-reglages { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.bl-reglages .bl-panneau:last-child { grid-column: 1 / -1; }
}
@media screen and (max-width: 736px) {
	.bl-reglages { grid-template-columns: minmax(0, 1fr); }
	.bl-scene { height: 22em; }
	.bl-calcul { font-size: 1.8em; }
}
@media (prefers-reduced-motion: reduce) { .bl-act, .bl-message { transition: none; } .bl-cube.pop, .bl-tour.tape .bl-pile, .bl-nb.compte { animation: none; } }
