/* ---------- Studio : le visiteur peint son propre fond ----------
   Formulaire à gauche (style, description, mots, couleur, écran), scène à droite : l'appareil choisi,
   l'horloge de l'écran verrouillé posée dessus, et les quatre étapes du circuit (recette, peinture, relecture, prêt). */
.studio { background: var(--paper); position: relative; overflow: hidden; }
.studio .kicker { --k: var(--lilac); }
.st-grid { margin-top: 52px; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 40px; align-items: start; }

.st-card { background: var(--paper); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; display: grid; gap: 24px; min-width: 0; }
.st-group { display: grid; gap: 10px; min-width: 0; border: 0; margin: 0; padding: 0; }
.st-group[hidden] { display: none; }
.st-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; font-weight: 900; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); width: 100%; }
.st-label em { font-style: normal; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--ink-faint); margin-left: 6px; }
.st-n { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 9px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 12.5px; letter-spacing: 0; vertical-align: 1px; }
.st-count { font-size: 12.5px; font-weight: 800; letter-spacing: 0; text-transform: none; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.st-styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.st-style { position: relative; display: grid; align-content: start; border: 2.5px solid var(--ink); border-radius: 16px; overflow: hidden; background: var(--paper); cursor: pointer; transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease; }
.st-style input { position: absolute; opacity: 0; pointer-events: none; }
.st-style img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-bottom: 2.5px solid var(--ink); background: var(--paper-2); }
.st-style span { display: grid; gap: 2px; padding: 9px 11px 11px; font-size: 12.5px; line-height: 1.35; font-weight: 700; color: var(--ink-soft); }
.st-style strong { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--ink); }
.st-style:hover { transform: translate(-1px, -2px); }
.st-style:has(input:checked) { background: var(--mustard-soft); box-shadow: 4px 4px 0 var(--ink); transform: translate(-2px, -2px); }
.st-style:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: 3px; }

.st-input { width: 100%; padding: 12px 16px; border: var(--border) solid var(--ink); border-radius: 16px; background: var(--paper); font: inherit; font-weight: 700; color: var(--ink); line-height: 1.45; }
textarea.st-input { resize: vertical; min-height: 88px; }
.st-input::placeholder { color: var(--ink-faint); }
.st-input:focus { outline: 3px solid var(--sky); outline-offset: 2px; }
.st-input[aria-invalid="true"] { border-color: var(--coral); background: var(--coral-soft); }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.st-hint { font-size: 13.5px; font-weight: 700; color: var(--ink-faint); }
.st-dice { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--lilac-soft); font: inherit; font-weight: 900; font-size: 13.5px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform 0.14s ease, box-shadow 0.14s ease; }
.st-dice:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.st-dice:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.st-dice:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.st-dice svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }

.st-colors { display: flex; flex-wrap: wrap; gap: 12px; }
.st-swatch { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--c); cursor: pointer; transition: transform 0.14s ease; }
.st-swatch:hover { transform: scale(1.08); }
.st-swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.st-swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--ink); }
.st-swatch:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: 6px; }

.st-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.st-format { position: relative; display: grid; gap: 1px; padding: 10px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); cursor: pointer; min-width: 0; }
.st-format input { position: absolute; opacity: 0; pointer-events: none; }
.st-format strong { font-size: 15px; font-weight: 900; }
.st-format small { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.st-format:has(input:checked) { background: var(--sky-soft); box-shadow: 3px 3px 0 var(--ink); }
.st-format:has(input:focus-visible) { outline: 3px solid var(--sky); outline-offset: 3px; }

.st-submit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.st-submit .btn[disabled] { opacity: 0.55; cursor: progress; transform: none; box-shadow: 5px 5px 0 var(--ink); }
.st-quota { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.st-upsell { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; border: 2.5px dashed var(--ink); border-radius: 16px; background: var(--lilac-soft); }
.st-upsell[hidden] { display: none; }
.st-msg { min-height: 0; font-weight: 800; font-size: 14.5px; color: var(--ink-soft); }
.st-msg:empty { display: none; }
.st-msg.err { color: #b8392b; }
.st-prompt summary { cursor: pointer; width: fit-content; font-weight: 800; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.st-prompt summary:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
.st-prompt p { margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--ink-faint); }
.st-fine { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); line-height: 1.45; }
.st-prompt pre { margin: 10px 0 0; padding: 14px 16px; max-height: 240px; overflow: auto; border-radius: 14px; background: var(--night); color: var(--paper); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Scène */
.st-stage { position: sticky; top: 96px; display: grid; gap: 26px; justify-items: center; min-width: 0; }
.st-device { position: relative; width: 100%; padding: 10px; border-radius: 26px; background: var(--ink); box-shadow: 12px 12px 0 var(--lilac); transition: width 0.4s ease, border-radius 0.4s ease; }
.st-device.phone { width: min(100%, 290px); padding: 9px; border-radius: 46px; }
.st-view { position: relative; overflow: hidden; container-type: inline-size; aspect-ratio: var(--ar, 1.6); border-radius: 17px; background: var(--paper-2); }
.st-device.phone .st-view { border-radius: 38px; }
.st-view > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.5s ease, filter 0.6s ease, transform 0.6s ease; }
.st-view.working > img { filter: blur(7px) saturate(0.6); opacity: 0.5; transform: scale(1.04); }
.st-view.checking > img { filter: saturate(0.85); opacity: 0.8; }

.st-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 2cqw; padding: 0.7cqw 2cqw; font-size: max(9px, 1.45cqw); font-weight: 800; color: var(--ink); background: rgba(255, 249, 238, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.st-bar span { display: inline-flex; align-items: center; gap: 1.4cqw; }
.st-bar i { width: 1.5cqw; height: 1.5cqw; min-width: 7px; min-height: 7px; border-radius: 50%; background: var(--ink); }
.st-lock, .st-island { display: none; }
.st-device.phone .st-bar { display: none; }
.st-device.phone .st-lock { position: absolute; top: 10%; left: 0; right: 0; display: grid; justify-items: center; color: #fff; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35); pointer-events: none; }
.st-lock small { font-size: 5.4cqw; font-weight: 800; }
.st-lock b { font-family: var(--font-display); font-weight: 600; font-size: 21cqw; line-height: 1; letter-spacing: -0.01em; }
.st-device.phone .st-island { display: block; position: absolute; top: 2.6%; left: 50%; width: 32%; height: 3.5%; border-radius: 999px; background: #000; transform: translateX(-50%); }

/* Étiquette posée sur le bord de l'appareil, pour ne jamais cacher la peinture */
.st-chip { position: absolute; z-index: 2; left: 26px; bottom: -15px; padding: 4px 12px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); font-size: 12.5px; font-weight: 900; white-space: nowrap; }
.st-chip:empty { display: none; }
.st-device.phone .st-chip { left: 50%; transform: translateX(-50%); }

.st-veil { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; }
.st-veil[hidden] { display: none; }
.st-veil-card { display: inline-flex; align-items: center; gap: 12px; padding: 11px 18px; border: 2.5px solid var(--ink); border-radius: 18px; background: var(--paper); box-shadow: 4px 4px 0 var(--ink); font-weight: 900; font-size: 15px; font-variant-numeric: tabular-nums; text-align: left; }
.st-dots { display: inline-flex; gap: 5px; }
.st-dots i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ink); background: var(--coral); animation: st-hop 1s ease-in-out infinite; }
.st-dots i:nth-child(2) { background: var(--mustard); animation-delay: 0.15s; }
.st-dots i:nth-child(3) { background: var(--sky); animation-delay: 0.3s; }
@keyframes st-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

.st-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0 0; padding: 0; list-style: none; counter-reset: st; }
.st-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 7px; border: 2.5px solid var(--ink-faint); border-radius: 999px; background: var(--paper); color: var(--ink-faint); font-weight: 900; font-size: 13.5px; transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease; }
.st-steps li[hidden] { display: none; }
.st-steps li::before { counter-increment: st; content: counter(st); display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: var(--ink-faint); color: var(--paper); font-size: 11.5px; }
.st-steps li.active { border-color: var(--ink); background: var(--mustard); color: var(--ink); }
.st-steps li.active::before { background: var(--ink); }
.st-steps li.done { border-color: var(--ink); background: var(--mint-soft); color: var(--ink); }
.st-steps li.done::before { content: "✓"; background: var(--green-text); }
.st-status { max-width: 48ch; min-height: 3em; text-align: center; font-weight: 800; font-size: 15px; color: var(--ink-soft); text-wrap: balance; }
.st-status.err { color: #b8392b; }

.st-actions { display: grid; gap: 14px; width: 100%; max-width: 520px; }
.st-actions[hidden] { display: none; }
.st-actions-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.st-adjust { display: flex; gap: 10px; }
.st-adjust .st-input { flex: 1; min-width: 0; padding: 10px 16px; border-radius: 999px; font-size: 15px; }
.st-adjust .btn { flex: none; }

@media (max-width: 980px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .st-stage { position: static; }
}
@media (max-width: 560px) {
  .st-card { padding: 18px; gap: 22px; }
  .st-styles { grid-template-columns: minmax(0, 1fr); }
  .st-style { grid-template-columns: 112px minmax(0, 1fr); align-items: center; }
  .st-style img { height: 100%; border-bottom: 0; border-right: 2.5px solid var(--ink); }
  .st-formats { gap: 8px; }
  .st-format { padding: 9px 10px; }
  .st-format small { display: none; }
  .st-device { box-shadow: 8px 8px 0 var(--lilac); }
  .st-adjust { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .st-dots i { animation: none; }
  .st-view > img, .st-device, .st-style { transition: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
