/* Méthode de Singapour — L'Atelier de Pi.
   Un seul gabarit pour tous les outils : tuiles de choix, puis une fiche
   (en-tête : modes à gauche, réglages à droite / zone de travail / pied : actions à gauche, image et plein écran à droite).
   Chaque outil a sa couleur de crayon (--c) et sa teinte claire (--cl). */
#features.sg-section { padding-top: 1em; }
.sg-outil { max-width: 76em; margin: 0 auto; text-align: left; --c: #2e8b57; --cl: #dff1e6; }
.sg-outil [data-c="g"] { --c: #2e8b57; --cl: #dff1e6; }
.sg-outil [data-c="y"] { --c: #b88400; --cl: #fbefc9; }
.sg-outil [data-c="b"] { --c: #2f63b3; --cl: #dde7f6; }
.sg-outil [data-c="o"] { --c: #d0661c; --cl: #fbe3d2; }
.sg-outil [data-c="v"] { --c: #6a4fc2; --cl: #e8e2f7; }
.sg-outil *:focus-visible { outline: 3px solid #d99a00; outline-offset: 2px; }
.sg-outil [hidden] { display: none !important; }
#features .sg-outil p { text-align: left; }
.sg-outil .icon:before { margin: 0; }

/* ----- Tuiles : choix de l'outil ----- */
.sg-nav { display: grid; grid-template-columns: repeat(5, minmax(min-content, 1fr)); gap: .6em; margin: 0 0 .9em; scroll-margin-top: 1em; }
.sg-tuile { display: flex; align-items: center; gap: .5em; min-width: 0; padding: .45em .55em; background: #fff; border: 2px solid #dcdcdc; border-radius: 12px; cursor: pointer; -webkit-user-select: none; user-select: none; transition: transform .15s; }
.sg-tuile:hover { transform: translateY(-2px); }
.sg-tuile-ico { flex: none; width: 2.1em; height: 2.1em; border-radius: 9px; background: var(--cl); color: var(--c); display: flex; align-items: center; justify-content: center; font-size: .95em; }
.sg-tuile-t { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sg-tuile-t b { font: 600 .9em/1.2 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; }
.sg-tuile-t small { font-size: .68em; color: #878787; }
.sg-tuile.actif { border-color: var(--c); background: var(--cl); }
.sg-tuile.actif .sg-tuile-ico { background: #fff; }
.sg-tuile.actif .sg-tuile-t small { color: #5a5a5a; }

/* ----- La fiche ----- */
.sg-fiche { display: flex; flex-direction: column; gap: .85em; min-width: 0; background: #fff; border: 2px solid var(--c); border-radius: 14px; padding: .9em 1.1em 1em; }
.sg-tete { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6em 1.2em; padding-bottom: .85em; border-bottom: 1px dashed #d4d4d4; }
.sg-sous { display: flex; flex-wrap: wrap; gap: .4em; }
.sg-sous .sg-puce { font: 600 .98em/1.2 'Fredoka', 'Nunito', sans-serif; padding: .5em .95em; }
.sg-regl { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5em .8em; margin-left: auto; }
.sg-corps { display: flex; flex-direction: column; gap: .75em; min-width: 0; }
.sg-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5em; padding-top: .85em; border-top: 1px dashed #d4d4d4; }
.sg-pied-g, .sg-pied-d { display: flex; flex-wrap: wrap; gap: .5em; }
.sg-pied-d { margin-left: auto; }

/* ----- Puces (choix) et boutons ----- */
.sg-puce { display: inline-flex; align-items: center; gap: .4em; padding: .42em .8em; border: 2px solid #dcdcdc; border-radius: 10px; background: #fff; color: #555; cursor: pointer; font: 600 .92em/1.2 'Nunito', sans-serif; white-space: nowrap; -webkit-user-select: none; user-select: none; }
.sg-puce.actif { border-color: var(--c); background: var(--cl); color: #1f2a24; }
.sg-puce.actif .icon { color: var(--c); }
.sg-bt { display: inline-flex; align-items: center; gap: .5em; padding: .38em .9em .38em .45em; border: 2px solid #dcdcdc; border-radius: 10px; background: #fff; color: #444; cursor: pointer; font: 600 .93em/1.2 'Nunito', sans-serif; white-space: nowrap; -webkit-user-select: none; user-select: none; }
.sg-bt .icon { flex: none; width: 1.85em; height: 1.85em; border-radius: 50%; background: var(--cl); color: var(--c); display: flex; align-items: center; justify-content: center; font-size: .92em; }
.sg-bt-p { border-color: var(--c); color: #1f2a24; }
.sg-bt-p .icon { background: var(--c); color: #fff; }
/* Image, Plein écran : même contour crayonné que les autres boutons, un peu plus petits */
.sg-bt-u { font-size: .86em; color: #555; }
.sg-bt:hover, .sg-puce:hover { filter: brightness(.97); }
.sg-pm2 { flex: none; width: 2em; height: 2em; border-radius: 50%; background: #fff; border: 2px solid var(--c); color: var(--c); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; cursor: pointer; -webkit-user-select: none; user-select: none; }
.sg-pm2:hover { background: var(--cl); }

/* ----- Réglages : une étiquette au-dessus, le champ en dessous ----- */
.sg-champ, .sg-choix { display: block; margin: 0; min-width: 0; }
.sg-champ > span, .sg-choix > span { display: block; margin: 0 0 .25em; font: 600 .76em/1.2 'Nunito', sans-serif; color: #878787; white-space: nowrap; }
.sg-champ { flex: 0 1 auto; width: 11em; }
.sg-champ.sg-court { width: 8em; }
.sg-champ input, .sg-champ select { font: 600 .95em/1.2 'Nunito', sans-serif; width: 100%; height: auto; padding: .45em .65em; border: 2px solid #dcdcdc; border-radius: 10px; background: #fff; color: #2b2b2b; box-sizing: border-box; }
.sg-champ.sg-court input { text-align: center; font-family: 'Fredoka', 'Nunito', sans-serif; font-size: 1.05em; }
.sg-champ input:focus, .sg-champ select:focus { outline: none; border-color: var(--c); }
.sg-choix-c { display: flex; flex-wrap: wrap; align-items: center; gap: .35em; }
.sg-n { font: 600 1.35em/1 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; min-width: 1.6em; text-align: center; }
.sg-case { display: inline-flex; align-items: center; gap: .45em; margin: 0; padding: .5em 0; font: 600 .92em/1.2 'Nunito', sans-serif; color: #555; cursor: pointer; }
.sg-outil .sg-case input[type=checkbox] { -webkit-appearance: checkbox; appearance: auto; display: inline-block; float: none; position: static; opacity: 1; z-index: auto; width: 1.15em; height: 1.15em; accent-color: var(--c); margin: 0; }
.sg-outil .sg-case:before { display: none !important; }
.sg-outil input[type=range] { -webkit-appearance: auto; appearance: auto; display: block; width: 100%; height: 2.1em; padding: 0; border: 0; background: none; box-shadow: none; margin: 0; accent-color: var(--c); }
.sg-glis b { color: var(--c); font: 600 1.2em 'Fredoka', 'Nunito', sans-serif; }
.sg-score { display: inline-flex; align-items: center; gap: .35em; white-space: nowrap; font: 600 1.05em/1.2 'Fredoka', 'Nunito', sans-serif; color: #7a5600; background: #fbefc9; border-radius: 10px; padding: .45em .8em; }
.sg-saisie { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5em .8em; }

/* ----- Zone de travail ----- */
.sg-consigne { display: flex; align-items: flex-start; gap: .55em; margin: 0 !important; font: 600 1em/1.4 'Nunito', sans-serif; color: #3a3a3a; }
.sg-consigne .icon { flex: none; color: var(--c); line-height: 1.4; }
.sg-consigne b { color: var(--c); font-weight: 800; }
.sg-zone { width: 100%; }
.sg-svg { display: block; width: 100%; height: auto; max-height: 58vh; }
.sg-svg rect, .sg-svg circle, .sg-svg path, .sg-svg polygon { filter: url(#sg-crayon); }
.sg-svg text { font-family: 'Fredoka', 'Nunito', sans-serif; }
.sg-et { transition: opacity .45s ease; }
.sg-cache { opacity: 0 !important; }
.sg-ecriture, .sg-comp, .sg-jt-nombre { margin: 0; text-align: center; font: 600 1.9em/1.25 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; letter-spacing: .02em; }
.sg-ecriture:empty { display: none; }
.sg-sym { display: inline-block; min-width: 1.4em; color: var(--c); }
.sg-calc { display: flex; flex-wrap: wrap; gap: .4em; }
.sg-calc .sg-rep { flex: 1 1 100%; }
.sg-calc:empty { display: none; }
.sg-calc .sg-cache { display: none; }
.sg-calc-l { font: 600 1.05em/1.4 'Nunito', sans-serif; color: #2b2b2b; background: #f5f5f2; border-radius: 10px; padding: .45em .8em; }
.sg-calc-l .icon { color: var(--c); margin-right: .4em; }
.sg-rep { font: 600 1.15em/1.4 'Fredoka', 'Nunito', sans-serif; color: #1d6b41; background: #dff1e6; border: 2px solid #2e8b57; border-radius: 10px; padding: .45em .8em; }
.sg-rep .icon { margin-right: .35em; }
.sg-repondre { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .7em; }
.sg-repondre input { font: 600 1.2em/1.2 'Fredoka', 'Nunito', sans-serif !important; text-align: center; }
.sg-champ input.sg-faux, .sg-champ input.pb-faux { border-color: #d0661c; animation: sg-secoue .3s; }
.sg-champ input.pb-bon { border-color: #2e8b57; background: #dff1e6; }
@keyframes sg-secoue { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
/* messages : réussite, erreur, information */
.sg-retour, .sg-jt-aide, .sg-erreur { margin: 0 !important; font: 600 1em/1.4 'Nunito', sans-serif; border-radius: 10px; padding: .5em .9em; text-align: left; }
.sg-retour:empty { display: none; }
.sg-retour .icon, .sg-jt-aide .icon, .sg-erreur .icon { margin-right: .35em; }
.sg-retour.sg-ok { background: #dff1e6; color: #1d6b41; }
.sg-retour.sg-ko, .sg-erreur { background: #fbe3d2; color: #94410f; }
.sg-retour.sg-info, .sg-jt-aide { background: #fbefc9; color: #7a5600; }
/* étapes */
.sg-etape { display: flex; align-items: center; gap: .6em; font: 600 1.05em/1.3 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; }
.sg-num { flex: none; background: var(--c); color: #fff; border-radius: 2em; padding: .2em .75em; font-size: .9em; }

/* ----- Problèmes ----- */
.pb-fil { display: flex; flex-wrap: wrap; gap: .35em; }
.pb-fil-e { display: inline-flex; align-items: center; gap: .4em; font: 600 .86em/1.2 'Nunito', sans-serif; color: #8a8a8a; background: #f7f7f5; border-radius: 2em; padding: .28em .85em .28em .3em; }
.pb-fil-e b { display: inline-flex; width: 1.6em; height: 1.6em; border-radius: 50%; align-items: center; justify-content: center; background: #fff; font-size: .95em; }
.pb-fil-e.fait { color: #1d6b41; background: #dff1e6; }
.pb-fil-e.actif { color: #fff; background: #2e8b57; }
.pb-fil-e.actif b { color: #2e8b57; }
.sg-enonce-grand { margin: 0; font: 600 1.15em/1.5 'Nunito', sans-serif; color: #2b2b2b; background: #fdf4d6; border-left: 5px solid #d99a00; border-radius: 10px; padding: .6em 1em; }
.sg-nb-e { color: #1d6b41; background: #fff; border-radius: 6px; padding: 0 .3em; font-weight: 800; }
.sg-question { display: block; margin-top: .45em; padding-top: .45em; border-top: 2px dashed rgba(217,154,0,.35); color: #1d6b41; font-weight: 800; text-decoration: underline; text-decoration-color: rgba(46,139,87,.45); text-decoration-thickness: 2px; text-underline-offset: .25em; }
.sg-question:before { content: '\f059'; font: 900 1em 'Font Awesome 5 Free'; color: #2e8b57; margin-right: .45em; display: inline-block; text-decoration: none; }
.pb-struct { display: flex; flex-wrap: wrap; gap: .6em 1.6em; }
.pb-unite { margin-left: .4em; font: 600 1em 'Nunito', sans-serif; color: #555; min-width: 2.6em; }
.pb-jetons { display: flex; flex-wrap: wrap; gap: .5em; }
.pb-jeton { font: 600 1.2em/1.2 'Fredoka', 'Nunito', sans-serif; color: #1d6b41; background: #fff; border: 2px solid #2e8b57; border-radius: 10px; padding: .3em .8em; cursor: pointer; -webkit-user-select: none; user-select: none; transition: transform .15s; }
.pb-jeton:hover { transform: translateY(-2px); }
.pb-jeton.choisi { background: #dff1e6; transform: scale(1.1); box-shadow: 0 0 0 3px rgba(46,139,87,.25); }
.pb-jeton-q { color: #7a5600; border-color: #d99a00; }
.pb-jeton-q.choisi { background: #fbefc9; box-shadow: 0 0 0 3px rgba(217,154,0,.3); }
.pb-case { cursor: pointer; }
.pb-case:focus { outline: none; }
.pb-cible rect { animation: pb-pulse 1s infinite alternate; }
@keyframes pb-pulse { from { opacity: 1; } to { opacity: .55; } }
/* atelier libre */
.sg-at-svg { touch-action: none; }
.sg-at-seg { cursor: pointer; }
.sg-poignee { cursor: ew-resize; }
.sg-poignee:hover rect { fill: #fbefc9; }
#at-panneau:empty { display: none; }
.sg-at-p { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; }
.sg-at-bloc { background: #f5f5f2; border-radius: 10px; padding: .7em .9em; display: flex; flex-direction: column; gap: .6em; }
.sg-at-bloc h4 { margin: 0; font: 600 .98em/1.2 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; text-transform: none; letter-spacing: 0; }
.sg-ligne-c, .sg-bts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5em .7em; margin: 0; }
.sg-at-coul { display: flex; gap: .35em; padding-bottom: .15em; }
.sg-at-coul span { width: 2em; height: 2em; border-radius: 8px; border: 3px solid; cursor: pointer; }
.sg-at-coul span.actif { box-shadow: 0 0 0 3px #2b2b2b; }

/* ----- Décompositions ----- */
.sg-decs { display: flex; flex-wrap: wrap; justify-content: center; gap: .35em; }
.sg-dec { padding: .22em .6em; border-radius: 8px; background: #f7f7f5; color: #555; font: 600 .9em/1.2 'Fredoka', 'Nunito', sans-serif; cursor: pointer; }
.sg-dec:hover { background: var(--cl); }
.sg-dec.actif { background: var(--c); color: #fff; }
.sg-pt { transition: transform .7s cubic-bezier(.5, 0, .3, 1.25), opacity .5s; }
.sg-jet { cursor: pointer; }
.sg-jet:hover circle:first-child { stroke: #2b2b2b; }

/* ----- Jetons de numération ----- */
.sg-tableau { display: grid; gap: 0; border: 2px solid #2b2b2b; border-radius: 14px; overflow: hidden; background: #fff; }
.sg-col { display: flex; flex-direction: column; border-left: 2px solid #d4d4d4; min-width: 0; }
.sg-col:first-child { border-left: 0; }
.sg-col.sg-virg { border-right: 4px solid #c23b5c; }
.sg-col-t { color: #fff; text-align: center; padding: .4em .2em .35em; line-height: 1.1; }
.sg-col-t b { color: #fff; display: block; font: 600 1.25em 'Fredoka', 'Nunito', sans-serif; }
.sg-col-t small { display: block; font-size: .7em; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-col-pm { display: flex; align-items: center; justify-content: center; gap: .4em; padding: .4em 0; border-bottom: 1px dashed #d4d4d4; }
.sg-col-pm b { min-width: 1.6em; text-align: center; font: 600 1.15em 'Fredoka', 'Nunito', sans-serif; color: #2b2b2b; }
.sg-col-pm [role=button] { width: 1.9em; height: 1.9em; border-radius: 50%; border: 2px solid var(--c); color: var(--c); display: flex; align-items: center; justify-content: center; font-weight: 800; cursor: pointer; -webkit-user-select: none; user-select: none; background: #fff; }
.sg-col-pm [role=button]:hover { background: var(--cl); }
.sg-col-j { flex: 1; min-height: 11.5em; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 5px; padding: .6em .3em; }
.sg-jeton { width: 42px; height: 42px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 2px 4px rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; animation: sg-pop .35s ease-out; }
.sg-jeton span { color: #fff; font: 700 var(--t, 15px)/1 'Fredoka', 'Nunito', sans-serif; text-shadow: 0 1px 0 rgba(0,0,0,.25); white-space: nowrap; }
.sg-jeton.neuf { outline: 3px dashed #2b2b2b; outline-offset: 2px; }
.sg-vol { position: fixed; z-index: 9999; margin: 0; pointer-events: none; transition: left .65s cubic-bezier(.5,0,.3,1), top .65s cubic-bezier(.5,0,.3,1), opacity .65s, transform .65s; animation: none; }
@keyframes sg-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sg-col-act { display: flex; flex-direction: column; align-items: center; gap: .3em; padding: .4em .2em .6em; min-height: 2.3em; }
.sg-mini { font: 600 .82em 'Fredoka', 'Nunito', sans-serif; padding: .25em .7em; border-radius: 2em; border: 2px solid #dcdcdc; background: #fff; color: #555; cursor: pointer; white-space: nowrap; }
.sg-mini-p { background: #d99a00; border-color: #d99a00; color: #fff; animation: sg-attire 1.6s ease-in-out infinite; }
@keyframes sg-attire { 50% { box-shadow: 0 0 0 6px rgba(217,154,0,.25); } }
.sg-jt-bas { display: flex; flex-direction: column; align-items: center; gap: .35em; }
.sg-jt-dec { color: #555; font: 600 1em/1.3 'Nunito', sans-serif; }

/* ----- Droite numérique ----- */
.sg-saut .sg-arc { stroke-dasharray: 100; stroke-dashoffset: 0; }
.sg-anime .sg-saut .sg-arc { animation: sg-trace .8s ease-in-out both; animation-delay: var(--d); }
.sg-anime .sg-saut .sg-etiq, .sg-anime .sg-pt-d { animation: sg-apparait .35s ease-out both; animation-delay: calc(var(--d) + .55s); }
.sg-anime .sg-pt-d:first-of-type { animation-delay: 0s; }
@keyframes sg-trace { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes sg-apparait { from { opacity: 0; } to { opacity: 1; } }

/* ----- Fractions ----- */
.sg-case-f { cursor: pointer; }
.sg-case-f:hover rect { filter: url(#sg-crayon) brightness(.94); }

.sg-rgpd { text-align: center !important; color: #999; font-size: .85em; margin: 1em 0 0 !important; }

/* ----- Plein écran (projection) ----- */
.sg-vue:fullscreen { background: #fff; padding: 2vh 2vw; overflow: auto; font-size: 1.15em; box-sizing: border-box; }
.sg-vue:-webkit-full-screen { background: #fff; padding: 2vh 2vw; overflow: auto; font-size: 1.15em; box-sizing: border-box; }
.sg-vue:fullscreen .sg-fiche { min-height: 100%; box-sizing: border-box; }
.sg-vue:fullscreen .sg-corps { flex: 1; }
.sg-vue:fullscreen .sg-svg { max-height: calc(100vh - 21em); }
.sg-vue:fullscreen .sg-col-j { min-height: 40vh; }

@media screen and (max-width: 980px) { .sg-nav { grid-template-columns: repeat(3, 1fr); } .sg-regl { margin-left: 0; } }
@media screen and (max-width: 600px) {
	.sg-nav { grid-template-columns: 1fr 1fr; }
	.sg-tuile-t small { display: none; }
	.sg-fiche { padding: .7em .7em .8em; }
	.sg-jeton { width: 30px; height: 30px; }
	.sg-jeton span { font-size: calc(var(--t, 15px) * .72); }
	.sg-col-t small { display: none; }
	.sg-ecriture, .sg-comp, .sg-jt-nombre { font-size: 1.3em; }
	.sg-at-p { grid-template-columns: 1fr; }
	.sg-bt { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .sg-et, .sg-pt, .sg-jeton, .sg-anime .sg-saut .sg-arc, .sg-anime .sg-saut .sg-etiq, .sg-anime .sg-pt-d, .pb-cible rect { transition: none; animation: none; } }
@media print { #header, #banner, #footer, .sg-nav, .sg-tete, .sg-pied, .sg-rgpd { display: none !important; } .sg-fiche { border: 0; } }
.sg-champ.sg-nb { width: 8em; }
