/* L'Atelier (appli client) : chaleureux, bois et cuivre, pense d'abord pour le telephone. */

@font-face { font-family: "Great Vibes"; src: url("fonts/great-vibes.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Kaushan Script"; src: url("fonts/kaushan-script.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Anton"; src: url("fonts/anton.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Pacifico"; src: url("fonts/pacifico.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Lobster"; src: url("fonts/lobster.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Dancing Script"; src: url("fonts/dancing-script.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Satisfy"; src: url("fonts/satisfy.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "UnifrakturMaguntia"; src: url("fonts/unifraktur.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Uncial Antiqua"; src: url("fonts/uncial-antiqua.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Rye"; src: url("fonts/rye.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/cinzel.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Allerta Stencil"; src: url("fonts/allerta-stencil.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Fredoka"; src: url("fonts/fredoka.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: url("fonts/permanent-marker.woff2") format("woff2"); font-display: swap; }

:root {
  --bg: #f6efe4;
  --card: #fffcf7;
  --ink: #2b1d13;
  --muted: #7b6553;
  --line: #e6d8c4;
  --accent: #b5532b;
  --accent-dark: #8f3e1d;
  --accent-soft: #f6e0d2;
  --ok: #3f7d4e;
  --wood-a: #e7c895;
  --wood-b: #d3a66d;
  --burn: #4a2a14;
  --contour: #1d1a17;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 35, 15, .06), 0 8px 24px rgba(60, 35, 15, .08);
  --title: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body.at {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
a { color: var(--accent-dark); }
h1, h2, h3 { font-family: var(--title); font-weight: 600; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
h3.sub { margin: 22px 0 10px; font-size: 1.02rem; color: var(--muted); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- En-tete et etapes ---------- */

.at-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; max-width: 760px; margin: 0 auto;
}
.at-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.at-logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--wood-a), var(--wood-b));
  box-shadow: inset 0 0 0 3px var(--contour);
  position: relative;
}
.at-logo-mark::after { content: ""; position: absolute; left: 6px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 2px var(--contour); }
.at-logo-text { display: flex; flex-direction: column; line-height: 1.05; }
.at-logo-text strong { font-family: var(--title); font-size: 1.15rem; font-weight: 600; }
.at-logo-text small { color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.at-mine { font-weight: 600; text-decoration: none; padding: 8px 12px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font-size: .92rem; }

.at-steps { max-width: 760px; margin: 0 auto; padding: 4px 16px 0; }
.at-steps ol { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.at-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); }
.at-steps li span {
  width: 100%; height: 6px; border-radius: 3px; background: var(--line); font-size: 0; overflow: hidden;
}
.at-steps li em { font-style: normal; }
.at-steps li.done span, .at-steps li.current span { background: var(--accent); }
.at-steps li.current em { color: var(--ink); font-weight: 600; }

.at-main { max-width: 760px; margin: 0 auto; padding: 18px 16px 24px; }
.at-view { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .at-view { animation: none; } * { transition: none !important; } }

.at-alert, .at-error { background: #fbe3dc; color: #7a2410; border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.at-foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 10px 16px 24px; }

/* ---------- Boutons ---------- */

.btn-main {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 6px 16px rgba(181, 83, 43, .3);
  transition: transform .12s, background .12s;
}
.btn-main:hover { background: var(--accent-dark); }
.btn-main:active { transform: scale(.98); }
.btn-main:disabled { background: #c9b8a8; box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none;
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.wide { display: flex; margin: 16px auto 0; max-width: 360px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }

/* Barre du bas (collante sur telephone) */
.at-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 239, 228, .94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.at-bar .btn-main { flex: 1; }
.btn-back {
  width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  font-size: 1.8rem; line-height: 1; color: var(--ink); flex: none;
}
@media (min-width: 760px) {
  .at-bar { position: static; max-width: 760px; margin: 0 auto; background: none; border: 0; backdrop-filter: none; padding: 0 16px 16px; }
  body.at { padding-bottom: 0; }
}

/* ---------- Accueil ---------- */

.hero { text-align: center; padding: 8px 0 12px; }
.eyebrow { color: var(--accent-dark); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { font-size: clamp(1.9rem, 7vw, 2.8rem); margin-bottom: 12px; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 34em; margin: 0 auto 20px; }
.hero .btn-main { min-width: 240px; margin-top: 8px; }
.hero-points { list-style: none; padding: 0; margin: 22px 0 0; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hero-points li { background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: .88rem; box-shadow: var(--shadow); }

/* ---------- Porte-cles en bois (apercu en direct) ---------- */

/*
 * Apercu en direct du porte-cles. Structure : .kc > .kc-body (le support) > .kc-tab (patte d'anneau) + .kc-sil (prenom + dessin).
 * Tous les supports ont un cadre noir epais (--fw) et une patte d'anneau A L'EXTERIEUR, jamais de trou dans le bois.
 */
.kc { --fw: 11px; position: relative; display: flex; justify-content: center; align-items: center; margin: 30px auto 34px; width: min(100%, 420px); min-height: 150px; }
.kc-hero { transform: rotate(-4deg); }
.kc-body { position: relative; display: flex; align-items: center; justify-content: center; }
.kc-tab { /* patte : languette noire percee, collee au bord exterieur */
  position: absolute; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle, var(--bg) 0 7px, var(--contour) 8px);
}
.kc-sil { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 2%; }
.kc-sil.place-left { flex-direction: row-reverse; }
.kc-sil.place-above { flex-direction: column-reverse; gap: 0; }
.kc-sil.place-below { flex-direction: column; gap: 0; }
.kc-name {
  color: var(--burn); font-size: clamp(2rem, 10vw, 3.2rem); line-height: 1.15; white-space: nowrap; min-width: 0;
  text-shadow: 0 1px 0 rgba(255, 240, 210, .45), 0 -1px 0 rgba(60, 25, 5, .25); overflow: hidden; max-width: 100%;
}
.kc-art { flex: none; display: flex; width: 32%; }
.kc-art img { width: 100%; height: auto; filter: sepia(1) saturate(2.5) hue-rotate(-12deg) brightness(.55); opacity: .92; }
.kc-art img:not([src]), .kc-art img[src=""] { display: none; }
.kc-sil.place-above .kc-art, .kc-sil.place-below .kc-art { width: 24%; }
.kc-sil.place-above .kc-name, .kc-sil.place-below .kc-name { font-size: clamp(1.3rem, 7vw, 2.2rem); }

/* Plaques : bois veine dans un cadre noir */
.kc.shape-rectangle .kc-body, .kc.shape-rond .kc-body, .kc.shape-medaille .kc-body {
  background:
    repeating-linear-gradient(176deg, rgba(120, 70, 30, .07) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(183deg, rgba(255, 255, 255, .12) 0 1px, transparent 1px 13px),
    radial-gradient(120% 90% at 30% 30%, var(--wood-a), var(--wood-b));
  box-shadow: 0 0 0 var(--fw) var(--contour), 0 16px 30px rgba(50, 25, 5, .28);
}
/* Cotes reelles (generateur 3D) : rectangle 60 x 36 mm, rayon 6, cadre 2,5 ; rond 38 mm cadre 2 ; medaille 40 mm rebord 4 ; ecusson 40,2 x 43,9 mm cadre 2 */
.kc.shape-rectangle { --fw: 14px; }
.kc.shape-rectangle .kc-body { width: calc(100% - 50px); margin-left: 40px; aspect-ratio: 60 / 36; border-radius: 10% / 16.7%; padding: 6% 7%; }
.kc.shape-rectangle .kc-sil { width: 100%; }
.kc.shape-rectangle .kc-art { width: 38%; }
.kc.shape-rectangle .kc-tab, .kc.shape-contour .kc-tab { left: calc(-1 * var(--fw) - 30px); top: 50%; transform: translateY(-50%); }

.kc.shape-rond .kc-body, .kc.shape-medaille .kc-body { width: min(62vw, 250px); aspect-ratio: 1; border-radius: 50%; padding: 10%; margin-top: 64px; }
.kc.shape-rond { --fw: 13px; }
.kc.shape-medaille { --fw: 13px; }
/* Medaille : meme piece que le rond, mais SANS insert bois : on voit le fond noir, gravure claire. */
.kc.shape-medaille .kc-body { background: radial-gradient(120% 90% at 30% 30%, #3a3531, #24201d) !important; }
.kc.shape-medaille .kc-name { color: #e8dcc6; text-shadow: none; }
.kc.shape-medaille .kc-art img { filter: invert(1) sepia(.4) brightness(.92); opacity: .9; }
.kc.shape-rond .kc-sil, .kc.shape-medaille .kc-sil, .kc.shape-ecusson .kc-sil { width: 100%; }
.kc.shape-rond .kc-name, .kc.shape-medaille .kc-name, .kc.shape-ecusson .kc-name { font-size: clamp(1.5rem, 8.5vw, 2.4rem); }
.kc.shape-rond .kc-art, .kc.shape-medaille .kc-art, .kc.shape-ecusson .kc-art { width: 48%; }
.kc.shape-rond .kc-sil:not(.place-above):not(.place-below), .kc.shape-medaille .kc-sil:not(.place-above):not(.place-below), .kc.shape-ecusson .kc-sil:not(.place-above):not(.place-below) { flex-wrap: wrap; }
.kc.shape-ecusson .kc-tab { left: 50%; top: calc(-1 * var(--fw) - 30px); transform: translateX(-50%); }
/* Rond et medaille : patte a fente de sangle (18 mm de large, 7 mm de saillie, fente 13 x 3 mm) */
.kc.shape-rond .kc-tab, .kc.shape-medaille .kc-tab {
  left: 50%; transform: translateX(-50%); width: 47%; height: auto; aspect-ratio: 18 / 9; top: calc(-1 * var(--fw) - 17%); border-radius: 8px 8px 0 0;
  background: var(--contour); z-index: 0;
}
.kc.shape-rond .kc-tab::after, .kc.shape-medaille .kc-tab::after { content: ""; position: absolute; left: 14%; right: 14%; top: 22%; height: 33%; border-radius: 5px; background: var(--bg); }

/* Ecusson : blason. Le cadre noir (::before) et le bois (::after) sont decoupes ; la patte reste visible au-dessus. */
.kc.shape-ecusson .kc-body { width: min(58vw, 236px); aspect-ratio: .916; padding: 14% 12% 30%; margin-top: 48px; filter: drop-shadow(0 14px 18px rgba(50, 25, 5, .28)); }
.kc.shape-ecusson .kc-body::before, .kc.shape-ecusson .kc-body::after { content: ""; position: absolute; clip-path: polygon(50% 0%, 56.78% 0.25%, 61.6% 0.7%, 69.13% 1.82%, 74.98% 3.07%, 80.76% 4.66%, 86.77% 6.64%, 92.25% 8.75%, 98.77% 11.65%, 99.58% 19.08%, 99.95% 25.1%, 100% 29.14%, 99.88% 34.69%, 99.28% 41.39%, 98.39% 46.87%, 96.92% 52.94%, 95.1% 58.42%, 94.03% 61.06%, 92.74% 63.83%, 91.68% 65.94%, 89.85% 69.11%, 87.34% 72.87%, 84.07% 77.03%, 80.04% 81.32%, 76.12% 84.85%, 72.17% 87.96%, 66.47% 91.78%, 60.31% 95.28%, 55.74% 97.53%, 50% 99.96%, 44.26% 97.53%, 39.7% 95.28%, 33.54% 91.78%, 27.84% 87.96%, 23.88% 84.85%, 19.96% 81.32%, 15.93% 77.03%, 12.66% 72.87%, 10.15% 69.11%, 8.33% 65.94%, 7.26% 63.83%, 5.97% 61.06%, 4.91% 58.42%, 3.08% 52.94%, 1.61% 46.87%, 0.72% 41.39%, 0.12% 34.69%, 0% 29.14%, 0.05% 25.1%, 0.42% 19.08%, 1.24% 11.65%, 7.76% 8.75%, 13.23% 6.64%, 19.24% 4.66%, 25.02% 3.07%, 30.88% 1.82%, 38.41% 0.7%, 43.22% 0.25%); }
.kc.shape-ecusson .kc-body::before { inset: 0; background: var(--contour); }
.kc.shape-ecusson .kc-tab { top: -27px; }
.kc.shape-ecusson .kc-body::after { inset: 12px; background: repeating-linear-gradient(176deg, rgba(120, 70, 30, .07) 0 2px, transparent 2px 9px), radial-gradient(120% 90% at 30% 30%, var(--wood-a), var(--wood-b)); }

/* Contour du dessin : le bois puis le cadre noir suivent la silhouette (ombres portees sans flou empilees) */
.kc.shape-contour .kc-body { margin-left: 34px; }
.kc.shape-contour .kc-sil { filter: url(#kc-contour) drop-shadow(0 8px 10px rgba(50, 25, 5, .3)); }  /* filtre SVG dans atelier.php */
.kc.shape-contour { --fw: 0px; }
.kc.shape-contour .kc-tab { left: -36px; }
.kc.shape-contour .kc-art { width: min(26vw, 120px); margin-left: -7%; }  /* le dessin touche le prenom : une seule silhouette */
.kc.shape-contour .kc-sil.place-left .kc-art { margin: 0 -7% 0 0; }
.kc.shape-contour .kc-sil.place-above .kc-art, .kc.shape-contour .kc-sil.place-below .kc-art { width: min(20vw, 92px); margin: -2% 0; }
.kc.shape-contour .kc-name { text-shadow: none; }

/* Ecritures (une classe par police) */
.f-calligraphie { font-family: "Great Vibes", cursive; }
.f-brush { font-family: "Kaushan Script", cursive; }
.f-majuscules { font-family: "Anton", sans-serif; text-transform: uppercase; }
.f-ronde { font-family: "Pacifico", cursive; }
.f-retro { font-family: "Lobster", cursive; }
.f-manuscrite { font-family: "Dancing Script", cursive; font-weight: 700; }
.f-signature { font-family: "Satisfy", cursive; }
.f-gothique { font-family: "UnifrakturMaguntia", serif; }
.f-celtique { font-family: "Uncial Antiqua", serif; }
.f-western { font-family: "Rye", serif; }
.f-romaine { font-family: "Cinzel", serif; text-transform: uppercase; }
.f-pochoir { font-family: "Allerta Stencil", sans-serif; }
.f-enfant { font-family: "Fredoka", sans-serif; }
.f-feutre { font-family: "Permanent Marker", cursive; }

/* ---------- Champs ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > span { font-weight: 600; font-size: .95rem; }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; font-size: 1.05rem;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field input[readonly] { background: #f3ece2; color: var(--muted); }
#f-name { font-size: 1.4rem; text-align: center; font-weight: 600; }
.field-help { color: var(--muted); font-size: .88rem; }
.field-help.bad { color: #a3341a; }
.field-row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; }
.stepper { display: flex; border: 2px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.stepper button { width: 44px; border: 0; background: none; font-size: 1.4rem; color: var(--accent-dark); }
.stepper input { border: 0 !important; text-align: center; padding: 0 !important; min-height: 48px !important; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; font-size: .95rem; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 1px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.switch { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 48px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch-ui::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Dessins ---------- */

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 12px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--card); font-weight: 600; font-size: .93rem;
}
.cats button[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 6px 10px;
  border-radius: var(--radius); border: 2px solid transparent; background: var(--card); box-shadow: var(--shadow);
  font-size: .82rem; font-weight: 600; line-height: 1.2; text-align: center; position: relative;
}
.tile .tile-img {
  width: 100%; aspect-ratio: 1; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #f1dcb6, #ddb683);
}
.tile img { width: 86%; height: 86%; object-fit: contain; filter: sepia(1) saturate(2.5) hue-rotate(-12deg) brightness(.5); }
.tile .tile-none { font-size: 2rem; color: var(--burn); opacity: .5; }
.tile[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tile[aria-checked="true"]::after {
  content: "✓"; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; display: flex; align-items: center; justify-content: center;
}

/* ---------- Ecritures et positions ---------- */

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: var(--card); padding: 5px; border-radius: 16px; box-shadow: var(--shadow); }
.seg button { min-height: 44px; border: 0; border-radius: 12px; background: none; font-weight: 600; font-size: .86rem; color: var(--muted); padding: 4px; }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; }
.fonts { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 560px) { .fonts { grid-template-columns: 1fr 1fr; } }
.fontcard {
  display: grid; grid-template-columns: 1fr; gap: 2px; text-align: left; padding: 12px 16px;
  border-radius: var(--radius); border: 2px solid transparent; background: var(--card); box-shadow: var(--shadow);
}
.fontcard .fc-name { font-size: 1.9rem; line-height: 1.25; color: var(--burn); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontcard .fc-label { font-weight: 700; font-size: .9rem; }
.fontcard .fc-tip { color: var(--muted); font-size: .82rem; }
.fontcard[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Creation ---------- */

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 0 16px; }
.card.center { text-align: center; }
.card .btn-main { width: 100%; }
.big-icon { width: 64px; height: 64px; border-radius: 50%; margin: 4px auto 12px; display: flex; align-items: center; justify-content: center; font-size: 1.9rem; background: var(--accent-soft); color: var(--accent-dark); }
.big-icon.ok { background: #dcefe0; color: var(--ok); }
.dev { background: #fff6d6; border-radius: 10px; padding: 10px; font-size: .85rem; word-break: break-all; }
.recap { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.recap span { background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: .88rem; box-shadow: var(--shadow); }
.recap strong { font-weight: 700; }

.prog-title { font-family: var(--title); font-size: 1.2rem; margin-bottom: 10px; }
.prog { height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.prog-bar {
  height: 100%; width: 0; border-radius: 7px; transition: width .6s linear;
  background: repeating-linear-gradient(45deg, var(--accent) 0 12px, #c96a40 12px 24px);
  background-size: 34px 34px; animation: stripes 1s linear infinite;
}
@keyframes stripes { to { background-position: 34px 0; } }
.prog-step { color: var(--muted); font-size: .92rem; margin: 10px 0 12px; }

.results { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .results { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .results { grid-template-columns: repeat(3, 1fr); } }
.result {
  position: relative; padding: 0; border: 3px solid transparent; border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow); text-align: left;
}
.result img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--bg); -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.result .num {
  position: absolute; top: 10px; left: 10px; background: var(--ink); color: #fff; border-radius: 999px;
  padding: 4px 12px; font-weight: 700; font-size: .9rem;
}
.result .pick { display: block; padding: 10px 14px; font-weight: 600; }
.result[aria-checked="true"] { border-color: var(--accent); }
.result[aria-checked="true"] .num { background: var(--accent); }
.result[aria-checked="true"] .pick::before { content: "✓ "; color: var(--accent); }
.result.loading { aspect-ratio: 3 / 2; display: flex; align-items: center; justify-content: center; color: var(--muted); background: repeating-linear-gradient(176deg, #efe2cc 0 3px, #e8d6b9 3px 10px); }

/* ---------- Envoi, merci, partage ---------- */

.chosen { display: flex; gap: 12px; align-items: center; margin: 0 0 16px; }
.chosen img { width: 120px; border-radius: 12px; box-shadow: var(--shadow); pointer-events: none; }
.chosen p { margin: 0; font-size: .95rem; }
.share-url { display: flex; gap: 8px; margin: 10px 0; }
.share-url input { flex: 1; min-width: 0; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: .9rem; }
.share-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; color: var(--accent-dark); text-decoration: underline; padding: 8px 0; font-weight: 600; }

/* ---------- Mes designs ---------- */

.mine { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .mine { grid-template-columns: 1fr 1fr; } }
.mine-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.mine-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--bg); pointer-events: none; }
.mine-card .mine-body { padding: 12px 14px 14px; }
.mine-card h3 { margin: 0 0 4px; }
.mine-card .tag { display: inline-block; background: var(--accent-soft); color: var(--accent-dark); border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; margin: 4px 0 8px; }
.mine-card .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.mine-card .btn-ghost { min-height: 40px; font-size: .9rem; }
.mine-share { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.mine-share h3 { font-size: 1rem; margin-bottom: 4px; }

/* Page publique de partage (design.php) */
.share-page { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; text-align: center; }
.share-page img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); pointer-events: none; -webkit-user-drag: none; }
.share-page h1 { margin-top: 18px; }

/* Etape Ecriture : le porte-cles reste visible pendant qu'on fait defiler les ecritures */
#v-ecriture .kc { position: sticky; top: 10px; z-index: 5; }

/* ---------- Forme du porte-cles : choix ---------- */

.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .shapes { grid-template-columns: repeat(5, 1fr); } }
.shape {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 10px; text-align: center;
  border-radius: var(--radius); border: 2px solid transparent; background: var(--card); box-shadow: var(--shadow);
}
.shape strong { font-size: .85rem; line-height: 1.2; }
.shape small { color: var(--muted); font-size: .72rem; line-height: 1.25; }
.shape[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.shape-pic { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #efe3cf; }
.shape-pic img { width: 100%; height: 100%; object-fit: cover; }
.shape-draw { display: block; position: relative; background: linear-gradient(135deg, var(--wood-a), var(--wood-b)); box-shadow: 0 0 0 4px var(--contour); }
.shape-draw::before { /* patte d anneau exterieure */
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle, #efe3cf 0 2px, var(--contour) 3px);
}
.shape-draw-rectangle { width: 62%; height: 40%; border-radius: 9px; margin-left: 10%; }
.shape-draw-rectangle::before { left: -14px; top: 50%; transform: translateY(-50%); }
.shape-draw-rond, .shape-draw-medaille { width: 46%; aspect-ratio: 1; border-radius: 50%; margin-top: 8%; }
.shape-draw-medaille { box-shadow: 0 0 0 7px var(--contour); }
.shape-draw-rond::before, .shape-draw-medaille::before { left: 50%; top: -15px; transform: translateX(-50%); }
.shape-draw-ecusson { width: 44%; aspect-ratio: .86; background: var(--contour); box-shadow: none; margin-top: 8%;
  clip-path: polygon(0 0, 100% 0, 100% 40%, 89% 72%, 50% 100%, 11% 72%, 0 40%); }
.shape-draw-contour { background: none; box-shadow: none; font: 1.35rem/1 "Lobster", cursive; color: var(--burn); filter: url(#kc-contour-mini); }
.shape-draw-contour::before { display: none; }

.kc-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Agrandir une proposition (plein ecran, pincement a deux doigts ou double appui) */
.result-wrap { position: relative; }
.zoom-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(43, 29, 19, .78); color: #fff; font-size: 1.3rem; line-height: 1;
}
.zoom { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #f6efe4; }
.zoom-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-family: var(--title); font-size: 1.1rem; }
.zoom-close { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 1.6rem; line-height: 1; }
.zoom-scroll { flex: 1; overflow: auto; touch-action: pinch-zoom pan-x pan-y; display: flex; }
.zoom-scroll img { margin: auto; width: 100%; max-width: 900px; height: auto; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; cursor: zoom-in; }
.zoom-scroll img.big { width: 250%; max-width: none; cursor: zoom-out; }
.zoom-help { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); margin: 0; }
body.no-scroll { overflow: hidden; }
