/* L'outil : mobile d'abord. États pilotés par [data-etat] sur .outil */
.outil { padding: clamp(20px, 4vw, 44px) 0 40px; min-height: 60vh; }
.outil > div { display: none; }
.outil[data-etat="demarrage"] .outil-vide, .outil[data-etat="vide"] .outil-vide { display: block; }
.outil[data-etat="calcul"] .outil-calcul { display: block; }
.outil[data-etat="atelier"] .outil-atelier { display: block; }
.outil[data-etat="demarrage"] .outil-vide { opacity: .001; }

.vide-grille { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
@media (max-width: 900px) { .vide-grille { grid-template-columns: 1fr; } }
.depot { padding: clamp(20px, 4vw, 34px); text-align: center; border: 2px dashed var(--filet-fort); box-shadow: none; transition: border-color .2s, background .2s; }
.depot.survol, .outil.glisse .depot { border-color: var(--chroma); background: color-mix(in srgb, var(--chroma) 7%, var(--surface)); }
.depot-modes { display: inline-flex; gap: 6px; padding: 4px; border-radius: 999px; background: var(--papier); border: 1px solid var(--filet); margin-bottom: 18px; }
.depot-modes .puce { border: 0; }
.depot-icone { color: var(--encre-pale); display: block; margin: 0 auto 8px; }
.depot-titre { font: 400 1.7rem/1.1 var(--titre); margin: 0 0 6px; }
.depot-aide { color: var(--encre-douce); font-size: .92rem; margin: 0 0 18px; }
.depot-boutons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.depot-boutons label { cursor: pointer; }
.depot-boutons label:focus-within { outline: 3px solid var(--chroma); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .camera { display: none; } }
.exemples { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; font-size: .9rem; color: var(--encre-douce); flex-wrap: wrap; }
.exemples button { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; width: 48px; height: 48px; cursor: pointer; background: none; }
.exemples button:hover { border-color: var(--chroma); }
.exemples img { width: 100%; height: 100%; object-fit: cover; display: block; }

.recents { margin-top: 44px; }
.recents h2 { font-size: 1.6rem; margin: 0; }
.aide-recents { color: var(--encre-douce); font-size: .95rem; margin: 4px 0 16px; }
.recents ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.recent { position: relative; }
.recent-ouvrir { width: 100%; border: 1px solid var(--filet); border-radius: 14px; padding: 10px; cursor: pointer; display: grid; gap: 4px; text-align: left; color: var(--encre); font: inherit; }
.recent-ouvrir img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.recent-ouvrir span { font-size: .88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface); border-radius: 6px; padding: 2px 6px; }
.recent-ouvrir small { font-size: .78rem; color: var(--encre-douce); background: var(--surface); border-radius: 6px; padding: 0 6px; justify-self: start; }
.recent-oublier { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--filet); background: var(--surface); color: var(--encre-douce); cursor: pointer; font-size: 1.1rem; line-height: 1; }

/* Calcul */
.calcul-carte { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 28px; padding: 22px; align-items: center; max-width: 820px; margin: 0 auto; }
@media (max-width: 700px) { .calcul-carte { grid-template-columns: 1fr; } }
.calcul-image { position: relative; border-radius: 12px; overflow: hidden; background: var(--papier); aspect-ratio: 4/5; }
.calcul-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.balayage { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--chroma) 45%, transparent), transparent); border-bottom: 2px solid var(--chroma); animation: balayage 1.8s ease-in-out infinite; }
@keyframes balayage { to { top: 100%; } }
@media (prefers-reduced-motion: reduce) { .balayage { animation: none; top: auto; bottom: 0; height: 4px; } }
.calcul-texte p[data-progres-texte] { font: 400 1.5rem/1.2 var(--titre); margin: 0 0 14px; }
.progres { --p: 0%; height: 8px; border-radius: 999px; background: var(--filet); overflow: hidden; }
.progres span { display: block; height: 100%; width: var(--p); background: var(--chroma); transition: width .3s ease; }
.calcul-note { color: var(--encre-douce); font-size: .92rem; margin-top: 14px; }

/* Atelier */
.atelier-haut { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: .9rem; color: var(--encre-douce); }
.sauve { opacity: 0; transition: opacity .3s; }
.sauve.vu { opacity: 1; }
.lot-progres { margin-left: auto; font-weight: 600; color: var(--encre); }
.lot ul { list-style: none; display: flex; gap: 8px; padding: 0 0 12px; margin: 0; overflow-x: auto; }
.lot button { width: 60px; height: 60px; border-radius: 10px; border: 2px solid var(--filet); padding: 2px; cursor: pointer; background: var(--surface); }
.lot button[aria-current="true"] { border-color: var(--chroma); }
.lot img { width: 100%; height: 100%; object-fit: contain; }
.atelier { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .atelier { grid-template-columns: 1fr; gap: 14px; } }
.scene-cadre { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.scene { position: relative; border-radius: 14px; overflow: hidden; box-shadow: var(--ombre); touch-action: none; max-width: 100%; }
.scene:not(.sans-fond) { background: none; }
.scene canvas { display: block; width: 100%; height: 100%; }
.outil-atelier .onglets ~ .volet { min-height: 0; }
.curseur { position: absolute; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .6); transform: translate(-50%, -50%); pointer-events: none; }
.curseur[data-mode="restaurer"] { border-color: var(--chroma); }
.scene-infos { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 10px; font-size: .88rem; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.puce.petite { min-height: 32px; font-size: .84rem; touch-action: none; user-select: none; -webkit-user-select: none; }

.panneau { padding: 0; overflow: hidden; position: sticky; top: 80px; }
@media (max-width: 900px) { .panneau { position: static; } }
.onglets { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--filet); }
.onglets button { border: 0; background: none; padding: 14px 4px; font: 600 .92rem var(--texte); color: var(--encre-douce); cursor: pointer; border-bottom: 2px solid transparent; }
.onglets button[aria-selected="true"] { color: var(--encre); border-bottom-color: var(--encre); }
.volet { padding: 18px; display: grid; gap: 14px; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lib { font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; color: var(--encre-pale); font-weight: 600; margin: 0; }
.aide { font-size: .9rem; color: var(--encre-douce); margin: 0; }
.bloc { display: grid; gap: 10px; }
.nuancier { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nuancier button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--filet-fort); cursor: pointer; }
.nuancier input[type=color] { width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }
.champ-ligne { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.champ-ligne input { width: 110px; min-height: 38px; border-radius: 10px; border: 1.5px solid var(--filet-fort); background: var(--surface); color: var(--encre); padding: 6px 10px; font: 500 .95rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.curseur-ligne { display: grid; gap: 6px; font-size: .9rem; }
.curseur-ligne input[type=range] { width: 100%; accent-color: var(--encre); }
.interrupteur { display: flex; align-items: center; gap: 10px; font-size: .95rem; cursor: pointer; }
.interrupteur input { width: 20px; height: 20px; accent-color: var(--encre); }
.flou-pastille { background: radial-gradient(circle at 30% 30%, #b9c7d6, #6d7d6b 60%, #37403a); filter: blur(.5px); }

.achat { border-top: 1px solid var(--filet); padding: 16px 18px 18px; display: grid; gap: 10px; background: var(--surface-2); }
.statut-hd { margin: 0; font-size: .92rem; color: var(--encre-douce); }
.statut-hd b { color: var(--encre); }
.achat-secondaire { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; font-size: .85rem; color: var(--encre-douce); }
[aria-busy="true"] { opacity: .7; cursor: progress; }
@media (max-width: 900px) {
  /* Le bouton d'achat reste sous le pouce, en bas de l'écran. */
  .achat { position: sticky; bottom: 0; z-index: 5; box-shadow: 0 -10px 24px -18px rgb(0 0 0 / .5); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

/* Mur de paiement */
.mur { border: 0; padding: 0; border-radius: 22px; width: min(620px, 100vw - 20px); max-height: 94vh; background: var(--surface); color: var(--encre); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .55); margin: auto; overflow-x: hidden; }
.mur::backdrop { background: rgb(12 12 14 / .55); backdrop-filter: blur(3px); }
.mur form { padding: 24px; display: grid; gap: 16px; position: relative; }
.mur.petit { width: min(460px, 100vw - 20px); }
.mur .fermer { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--papier); color: var(--encre); font-size: 1.5rem; cursor: pointer; }
.mur h2 { font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 4px; padding-right: 40px; }
.mur-tete { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.mur-vignette { border-radius: 12px; overflow: hidden; border: 1px solid var(--filet); background: var(--papier); display: grid; place-items: center; aspect-ratio: 1; }
.mur-vignette canvas { max-width: 100%; max-height: 100%; display: block; }
.mur-dim { margin: 0; color: var(--encre-douce); font-size: .9rem; }
.offres { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .offres { grid-template-columns: 1fr; } .mur-tete { grid-template-columns: 80px 1fr; } }
.offre { position: relative; border: 1.5px solid var(--filet-fort); border-radius: 14px; padding: 14px 14px 12px; cursor: pointer; display: grid; gap: 2px; }
.offre input { position: absolute; opacity: 0; }
.offre:focus-within { outline: 3px solid var(--chroma); outline-offset: 2px; }
.offre.choisie { border-color: var(--encre); box-shadow: inset 0 0 0 1px var(--encre); background: var(--surface-2); }
.offre[hidden] { display: none; }
.o-nom { font-weight: 600; font-size: .95rem; }
.o-prix { font: 400 1.7rem/1.1 var(--titre); }
.o-prix small { font: 400 .85rem var(--texte); color: var(--encre-douce); }
.o-sous { font-size: .8rem; color: var(--encre-douce); }
.offre-vedette { border-color: var(--encre); }
.offre-vedette .ruban { top: -11px; left: 12px; font-size: .66rem; padding: 5px 9px; }
.code-promo summary { cursor: pointer; font-size: .9rem; color: var(--encre-douce); }
.code-ligne { display: flex; gap: 8px; margin-top: 8px; }
.code-ligne input { flex: 1; min-height: 42px; border-radius: 10px; border: 1.5px solid var(--filet-fort); background: var(--surface); color: var(--encre); padding: 6px 12px; font: 500 1rem ui-monospace, Menlo, monospace; text-transform: uppercase; }
.code-ok { color: var(--chroma-texte); font-size: .9rem; margin: 6px 0 0; }
.mention-abo { font-size: .85rem; color: var(--encre-douce); margin: 0; }
.mur-pied { font-size: .82rem; color: var(--encre-douce); margin: 0; text-align: center; }

/* Messages flottants */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .3s; background: var(--encre); color: var(--papier); padding: 12px 18px; border-radius: 14px; z-index: 100; max-width: min(520px, 92vw); font-size: .95rem; box-shadow: var(--ombre); }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.alerte { background: #8E2A21; color: #fff; }
.toast.succes { background: var(--chroma); color: var(--sur-chroma); }
@media (max-width: 900px) { .toast { bottom: 150px; } }
