/* Page « Crée ta pièce » : une question à la fois, puis le pack et le vêtement révélé */
body.creer {
  min-height: 100vh; min-height: 100dvh;
  background: radial-gradient(90% 60% at 50% 0%, #1d1d1d 0, #0b0b0b 65%) fixed, #0b0b0b;
  color: var(--paper);
}
.creer a:not(.btn) { color: inherit; }
.creer :focus-visible { outline-color: var(--paper); }

.creer-header {
  position: relative; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) var(--gutter) 0;
}
.creer-brand img { width: 120px; }
.creer-back { font-size: 14px; text-decoration: none; color: rgb(244 243 240 / 0.7); }
.creer-back:hover { color: var(--paper); }

/* ---------- Le parcours ---------- */
.funnel {
  position: relative; z-index: 10;
  max-width: 760px; margin: 0 auto;
  padding: clamp(28px, 7vh, 72px) var(--gutter) 200px;
  text-align: center;
}
.progress { display: flex; align-items: center; gap: 14px; max-width: 320px; margin: 0 auto clamp(28px, 6vh, 56px); font-size: 13px; letter-spacing: .12em; color: rgb(244 243 240 / 0.6); }
.progress-bar { flex: 1; height: 2px; background: rgb(244 243 240 / 0.15); border-radius: 2px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 20%; background: var(--paper); transition: width 600ms var(--retake-ease); }

.step { animation: step-in 600ms var(--retake-ease) both; }
@keyframes step-in { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.step-kicker { margin: 0 0 10px; font-family: var(--hand); font-weight: 700; font-size: 26px; color: rgb(244 243 240 / 0.75); }
.step-q { margin: 0 0 clamp(24px, 4vh, 40px); font-size: clamp(34px, 6vw, 64px); font-weight: 500; line-height: 1; letter-spacing: -0.04em; }
.step-note { margin: 16px auto 0; max-width: 460px; font-size: 14px; color: rgb(244 243 240 / 0.6); }
.step-error { margin: 14px 0 0; color: #ff8a80; font-weight: 500; }
.step-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: clamp(24px, 5vh, 44px); }

.creer .big-input {
  width: 100%; max-width: 560px;
  background: transparent; border: 0; border-bottom: 2px solid rgb(244 243 240 / 0.3);
  color: var(--paper); font: inherit; font-size: clamp(30px, 5.5vw, 56px); letter-spacing: -0.03em;
  text-align: center; padding: 8px 0 12px; border-radius: 0;
}
.creer .big-input::placeholder { color: rgb(244 243 240 / 0.25); }
.creer .big-input:focus { background: transparent; outline: none; border-color: var(--paper); }

/* Dépôt d'image */
.drop {
  position: relative; display: grid; place-items: center;
  width: min(420px, 100%); aspect-ratio: 1; margin: 0 auto;
  border-radius: 28px; cursor: pointer;
  background: rgb(244 243 240 / 0.04);
  border: 1.5px dashed rgb(244 243 240 / 0.35);
  transition: border-color 200ms, background 200ms;
}
.drop:hover, .drop.is-over { border-color: var(--paper); background: rgb(244 243 240 / 0.08); }
.drop:focus-within { outline: 2px solid var(--paper); outline-offset: 4px; }
.drop-empty { display: grid; gap: 8px; padding: 24px; color: rgb(244 243 240 / 0.7); font-size: 15px; }
.drop-empty strong { color: var(--paper); font-size: 22px; font-weight: 500; }
.drop-star { font-size: 44px; line-height: 1; }
.drop-preview { width: 86%; height: 86%; object-fit: contain; border-radius: 12px; background: #f4f3f0; }
.drop.has-image { border-style: solid; }
.drop.has-image .drop-empty { display: none; }

.mode { display: inline-flex; gap: 4px; margin-top: 18px; padding: 4px; border-radius: 999px; background: rgb(244 243 240 / 0.08); }
.mode-btn { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; border-radius: 999px; border: 0; background: transparent; color: rgb(244 243 240 / 0.75); cursor: pointer; }
.mode-btn.is-on { background: var(--paper); color: var(--ink); }

/* Choix */
.tiles { display: flex; gap: 14px; justify-content: center; }
.tile, .swatch, .chip-big { position: relative; cursor: pointer; }
.tile input, .swatch input, .chip-big input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tile span {
  display: grid; justify-items: center; gap: 10px;
  width: min(200px, 40vw); padding: 22px 12px 18px; border-radius: 22px;
  border: 1.5px solid rgb(244 243 240 / 0.2); background: rgb(244 243 240 / 0.04);
  font-size: 18px; font-weight: 500; transition: border-color 200ms, background 200ms, transform 200ms;
}
.tile svg { width: 70%; fill: none; stroke: var(--paper); stroke-width: 2.2; stroke-linejoin: round; }
.tile input:checked + span { border-color: var(--paper); background: rgb(244 243 240 / 0.12); transform: translateY(-3px); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px auto 0; max-width: 560px; }
.swatch span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 8px; border-radius: 999px; border: 1.5px solid rgb(244 243 240 / 0.2); font-size: 15px; }
.swatch i { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgb(244 243 240 / 0.5); }
.swatch input:checked + span { border-color: var(--paper); background: rgb(244 243 240 / 0.12); }
.chips-big { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip-big span { display: inline-block; min-width: 72px; padding: 14px 22px; border-radius: 999px; border: 1.5px solid rgb(244 243 240 / 0.25); font-size: 18px; font-weight: 500; }
.chip-big input:checked + span { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.tile input:focus-visible + span, .swatch input:focus-visible + span, .chip-big input:focus-visible + span { outline: 2px solid var(--paper); outline-offset: 3px; }

.btn-pack { box-shadow: 0 0 0 0 rgb(244 243 240 / 0.6); animation: appel 1.8s ease-out infinite; }
@keyframes appel { 70% { box-shadow: 0 0 0 16px rgb(244 243 240 / 0); } 100% { box-shadow: 0 0 0 0 rgb(244 243 240 / 0); } }
.btn-text { font: inherit; font-size: 15px; background: none; border: 0; color: rgb(244 243 240 / 0.7); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 12px; }

/* Prix */
.tile-prix { font-size: 14px; font-weight: 400; color: rgb(244 243 240 / 0.7); }
.tile input:checked + span .tile-prix { color: var(--paper); }
.prix-recap { max-width: 360px; margin: 26px auto 0; padding: 16px 20px; border-radius: 18px; background: rgb(244 243 240 / 0.06); border: 1px solid rgb(244 243 240 / 0.15); text-align: left; font-size: 15px; }
.prix-recap .ligne { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; color: rgb(244 243 240 / 0.8); }
.prix-recap .total { margin-top: 8px; padding-top: 10px; border-top: 1px solid rgb(244 243 240 / 0.2); color: var(--paper); font-size: 20px; font-weight: 700; }
.prix-recap .note { margin: 8px 0 0; font-size: 13px; color: rgb(244 243 240 / 0.6); }
.reveal-prix { font-style: normal; font-size: 16px; font-weight: 500; color: rgb(244 243 240 / 0.8); }

/* Une image par endroit */
.step-note-top { margin: -14px auto 18px; }
.zone-images { margin: 26px auto 0; max-width: 520px; text-align: left; }
.zone-images-q { margin: 0 0 10px; font-weight: 500; text-align: center; }
.zone-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-top: 1px solid rgb(244 243 240 / 0.12); }
.zone-row strong { min-width: 74px; font-weight: 500; }
.zone-row .mode { margin: 0; }
.zone-file { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 7px 14px; border-radius: 999px; border: 1px dashed rgb(244 243 240 / 0.45); }
.zone-file:focus-within { outline: 2px solid var(--paper); outline-offset: 2px; }
.zone-file canvas { width: 28px; height: 28px; border-radius: 6px; background: #f4f3f0; }

/* Placement du dessin */
.vues { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgb(244 243 240 / 0.08); margin-bottom: 14px; }
.vues button { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 18px; border-radius: 999px; border: 0; background: transparent; color: rgb(244 243 240 / 0.75); cursor: pointer; }
.vues button[aria-selected="true"] { background: var(--paper); color: var(--ink); }
.placement { width: min(420px, 86vw, 52vh); margin: 0 auto; border-radius: 24px; background: radial-gradient(closest-side, rgb(244 243 240 / 0.16), transparent); }
.placement canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.placement canvas:active { cursor: grabbing; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.presets button { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 16px; border-radius: 999px; border: 1.5px solid rgb(244 243 240 / 0.25); background: transparent; color: var(--paper); cursor: pointer; }
.presets button.is-on { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.taille-dessin { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; font-size: 14px; color: rgb(244 243 240 / 0.75); }
.taille-dessin input { width: min(240px, 50vw); accent-color: var(--paper); }

/* Étoiles chrome en bas, comme dans un tunnel de jeu */
.creer-3d { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1; width: 100%; height: 34vh; pointer-events: none; }

/* ---------- Le pack ---------- */
.pack-stage {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  display: grid; place-items: center;
  background: radial-gradient(70% 55% at 50% 50%, #262626 0, #050505 70%);
}
.rays {
  position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax;
  background: repeating-conic-gradient(from 0deg, rgb(244 243 240 / 0.16) 0deg 4deg, transparent 4deg 16deg);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 70%);
          mask: radial-gradient(closest-side, #000 10%, transparent 70%);
  opacity: 0; animation: tourne 18s linear infinite;
  transition: opacity 600ms ease;
}
.pack-stage.is-charging .rays, .pack-stage.is-reveal .rays { opacity: 1; }
@keyframes tourne { to { transform: rotate(360deg); } }

.pack {
  position: relative; display: grid; place-items: center; align-content: center; gap: 14px;
  width: min(260px, 62vw); aspect-ratio: 26 / 38; border-radius: 22px;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.18), transparent 40%),
    linear-gradient(160deg, #2a2a2a, #0d0d0d 55%, #262626);
  border: 2px solid #bdbdbd;
  box-shadow: 0 0 0 1px #000, 0 30px 80px rgb(0 0 0 / 0.7), 0 0 60px rgb(244 243 240 / 0.15), inset 0 0 30px rgb(255 255 255 / 0.06);
  animation: flotte-pack 3s ease-in-out infinite alternate;
}
.pack img { width: 82%; filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.6)); }
.pack-line { font-size: 46px; font-weight: 700; letter-spacing: .3em; margin-right: -.3em; background: linear-gradient(180deg, #fff, #9a9a9a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pack-sub { font-size: 11px; letter-spacing: .2em; color: rgb(244 243 240 / 0.7); }
@keyframes flotte-pack { from { transform: translateY(-6px) rotate(-1deg); } to { transform: translateY(6px) rotate(1deg); } }
.pack-stage.is-charging .pack { animation: tremble 1.7s cubic-bezier(.4, 0, .9, .4) forwards; }
@keyframes tremble {
  0% { transform: none; box-shadow: 0 0 60px rgb(244 243 240 / 0.15); }
  20% { transform: translate(-2px, 1px) rotate(-1deg); }
  40% { transform: translate(3px, -2px) rotate(1.5deg) scale(1.02); }
  60% { transform: translate(-5px, 3px) rotate(-2.5deg) scale(1.05); }
  80% { transform: translate(7px, -4px) rotate(3.5deg) scale(1.08); box-shadow: 0 0 120px rgb(255 255 255 / 0.6); }
  100% { transform: scale(1.18); box-shadow: 0 0 200px rgb(255 255 255 / 0.95); }
}
.pack-stage.is-walkout .pack, .pack-stage.is-reveal .pack { display: none; }

.white-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.white-flash.is-on { animation: eclair 700ms ease-out; }
@keyframes eclair { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

/* Les révélations successives, comme un walkout */
.walkout { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.beat { position: absolute; display: grid; justify-items: center; gap: 10px; text-align: center; animation: beat 1000ms var(--retake-ease) both; }
.beat-small { font-size: 14px; letter-spacing: .3em; color: rgb(244 243 240 / 0.7); }
.beat svg { width: clamp(110px, 22vw, 180px); fill: none; stroke: var(--paper); stroke-width: 2; }
.beat-sw { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--paper); }
@keyframes beat {
  0% { opacity: 0; transform: scale(1.6); filter: blur(12px); }
  25% { opacity: 1; transform: scale(1); filter: blur(0); }
  80% { opacity: 1; transform: scale(.96); }
  100% { opacity: 0; transform: scale(.9); filter: blur(6px); }
}

/* Le vêtement révélé */
.reveal-zone { position: relative; z-index: 5; display: grid; justify-items: center; gap: 14px; padding: 16px; max-height: 100%; overflow-y: auto; }
.reveal-3d { position: relative; perspective: 1200px; width: min(540px, 88vw, calc(100dvh - 290px)); }
.reveal-3d::before {
  content: ""; position: absolute; inset: -8%; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgb(244 243 240 / 0.30), rgb(244 243 240 / 0.08) 60%, transparent);
}
.reveal-3d::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -2%; height: 12%; z-index: -1;
  background: radial-gradient(closest-side, rgb(244 243 240 / 0.35), transparent); filter: blur(6px);
}
.reveal-inner {
  position: relative; aspect-ratio: 1; transform-style: preserve-3d;
  transform: rotateY(-110deg) scale(.5); opacity: 0;
  transition: transform 1100ms cubic-bezier(.2, .9, .25, 1.15), opacity 400ms ease;
}
.pack-stage.is-reveal .reveal-inner { transform: rotateY(calc(var(--flip, 0deg) + var(--ry, 0deg))) rotateX(var(--rx, 0deg)) scale(1); opacity: 1; }
.pack-stage.is-reveal .reveal-inner.is-tilting { transition: transform 120ms linear; }
.reveal-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.reveal-face-b { transform: rotateY(180deg); }
.reveal-face canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 50px rgb(244 243 240 / 0.22)); }
.pack-stage.is-reveal .reveal-inner.is-flipping { transition: transform 900ms cubic-bezier(.5, 0, .2, 1); }
.retourner { padding: 4px 12px; text-decoration: none; border: 1px solid rgb(244 243 240 / 0.3); border-radius: 999px; font-size: 14px; }
.reveal-holo {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: overlay; opacity: .8;
  background: linear-gradient(115deg, transparent 20%, rgb(255 255 255 / 0.7) calc(var(--hx, 50%) - 8%), rgb(190 220 255 / 0.45) var(--hx, 50%), rgb(255 210 235 / 0.4) calc(var(--hx, 50%) + 6%), transparent 80%);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
}
.reveal-name { margin: 0; display: grid; gap: 2px; text-align: center; opacity: 0; transform: translateY(8px); transition: opacity 500ms 700ms, transform 500ms 700ms; }
.reveal-name span { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: rgb(244 243 240 / 0.6); }
.reveal-name strong { font-size: clamp(30px, 6vw, 44px); letter-spacing: -0.02em; line-height: 1.05; }
.pack-stage.is-reveal .reveal-name { opacity: 1; transform: none; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; opacity: 0; transform: translateY(10px); transition: opacity 500ms 900ms, transform 500ms 900ms; }
.pack-stage.is-reveal .reveal-actions { opacity: 1; transform: none; }
.beat-name { font-size: clamp(44px, 11vw, 130px); font-weight: 700; letter-spacing: -0.03em; line-height: .95; max-width: 92vw; overflow-wrap: anywhere; background: linear-gradient(180deg, #ffffff 20%, #a9a9a9 60%, #f2f2f2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.commande { display: grid; justify-items: center; gap: 12px; width: min(460px, 100%); }
.commande-msg { margin: 0; width: 100%; white-space: pre-wrap; text-align: left; font: 14px/1.5 var(--font); background: rgb(244 243 240 / 0.08); border-radius: 14px; padding: 14px; }
.commande-status { margin: 0; font-size: 14px; min-height: 1.4em; }

.passer {
  position: absolute; z-index: 10; right: var(--gutter); bottom: calc(20px + env(safe-area-inset-bottom));
  font: inherit; font-size: 15px; color: rgb(244 243 240 / 0.7); background: none; border: 0; cursor: pointer; padding: 10px;
}
.pack-stage.is-reveal .passer { display: none; }

@media (max-width: 700px) {
  .creer-brand img { width: 96px; }
  .creer-3d { height: 24vh; }
  /* sur téléphone, les étoiles laissent la place aux réglages */
  .is-reglage .creer-3d { opacity: 0; transition: opacity 400ms; }
  .funnel { padding-bottom: 160px; }
  .drop { width: min(300px, 82%); }
  .step-q { margin-bottom: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .step, .beat, .pack, .rays, .btn-pack, .white-flash.is-on { animation: none !important; }
  .reveal-inner { transition-duration: 1ms; }
}

.creer-legal { margin-top: 56px !important; color: rgb(244 243 240 / 0.55); }
.step-note a { color: inherit; text-underline-offset: 3px; }
