/* ===== Fenêtre de connexion / inscription animée (relief doux, carte qui se retourne) ===== */
.modal:has(.authx) {
  --ax-bg: #161b26;
  --ax-hi: #212a3b;
  --ax-lo: #0a0d13;
  --ax-red: 225, 29, 72;
  --ax-out: 8px 8px 18px var(--ax-lo), -8px -8px 18px var(--ax-hi);
  --ax-outS: 4px 4px 9px var(--ax-lo), -4px -4px 9px var(--ax-hi);
  --ax-in: inset 4px 4px 9px var(--ax-lo), inset -4px -4px 9px var(--ax-hi);
  background: var(--ax-bg); border: 0; overflow: hidden; overflow-y: auto; max-height: calc(100dvh - 24px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(var(--ax-red), .12);
  width: min(440px, calc(100% - 24px)); padding: 1.6rem 1.4rem 1.4rem;
}
.authx { position: relative; padding-top: .6rem; gap: .9rem; perspective: 1400px; }
.authx > .note { position: relative; z-index: 1; }

/* Bulles en relief qui flottent derrière la carte */
.ax-bubble { position: absolute; border-radius: 50%; background: var(--ax-bg); box-shadow: var(--ax-out); pointer-events: none; animation: axFloat 9s ease-in-out infinite; }
.ax-b1 { width: 120px; height: 120px; top: -40px; left: -60px; }
.ax-b2 { width: 46px; height: 46px; bottom: 14%; right: -16px; animation-duration: 7s; animation-delay: -3s; }
.ax-b3 { width: 90px; height: 90px; bottom: -36px; left: 12%; animation-duration: 11s; animation-delay: -5s; }
@keyframes axFloat { 50% { transform: translate(10px, -18px); } }

/* La carte : les deux faces sont empilées, la plus haute donne la taille */
.ax-card { position: relative; z-index: 1; display: grid; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.7, -.2, .3, 1.2); }
.ax-card.is-flipped { transform: rotateY(180deg); }
.ax-face { grid-area: 1 / 1; display: grid; gap: .85rem; align-content: start; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ax-face--signup { transform: rotateY(180deg); }

/* Les éléments de la face visible arrivent l'un après l'autre */
.ax-face > *, .ax-form > *:not(.hp-field) { opacity: 0; transform: translateY(12px); }
.ax-face.is-shown > *, .ax-face.is-shown .ax-form > *:not(.hp-field) { animation: axRise .5s var(--ease-out, ease) forwards; }
.ax-face.is-shown > :nth-child(2) { animation-delay: .04s; }
.ax-face.is-shown > :nth-child(3) { animation-delay: .08s; }
.ax-face.is-shown > :nth-child(4) { animation-delay: .12s; }
.ax-face.is-shown > :nth-child(5) { animation-delay: .16s; }
.ax-face.is-shown .ax-form > :nth-child(2) { animation-delay: .2s; }
.ax-face.is-shown .ax-form > :nth-child(3) { animation-delay: .25s; }
.ax-face.is-shown .ax-form > :nth-child(4) { animation-delay: .3s; }
.ax-face.is-shown .ax-form > :nth-child(5) { animation-delay: .35s; }
.ax-face.is-shown .ax-form > :nth-child(6) { animation-delay: .4s; }
.ax-face.is-shown .ax-form > :nth-child(7) { animation-delay: .45s; }
.ax-face.is-shown > :last-child { animation-delay: .5s; }
@keyframes axRise { to { opacity: 1; transform: none; } }

.ax-avatar { width: 62px; height: 62px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--ax-outS); }
.ax-face.is-shown > .ax-avatar { animation: axRise .5s var(--ease-out, ease) forwards, axPulse 2.6s ease-in-out .6s infinite; }
.ax-avatar svg { width: 25px; height: 25px; fill: rgb(var(--ax-red)); filter: drop-shadow(0 0 6px rgba(var(--ax-red), .6)); }
@keyframes axPulse { 50% { box-shadow: var(--ax-outS), 0 0 22px rgba(var(--ax-red), .3); } }
.authx h2 { margin: 0; text-align: center; font-size: 1.5rem; }
.ax-sub { margin-top: -.6rem; text-align: center; color: var(--muted); font-size: .85rem; }
.authx .gbtn { box-shadow: var(--ax-outS); border: 0; }

/* Champs creusés */
.ax-form { gap: .8rem; }
.ax-form .form__row2 { gap: .7rem; }
.ax-field { position: relative; display: block !important; }
.ax-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.authx .ax-field input { width: 100%; border: 0; outline: 0; background: var(--ax-bg); color: var(--text); font-size: 16px;
  border-radius: 13px; padding: .85rem 2.8rem .85rem 1rem; box-shadow: var(--ax-outS); transition: box-shadow .3s; }
.authx .ax-field input::placeholder { color: var(--muted); }
.authx .ax-field input:focus { box-shadow: var(--ax-in), 0 0 0 1px rgba(var(--ax-red), .4); outline: 0; }
.authx .ax-field input:user-invalid { box-shadow: var(--ax-in), 0 0 0 1px #ff6b81; }
.ax-field small { display: block; margin-top: .35rem; font-size: .78rem; }
.ax-eye { position: absolute; right: .55rem; top: 1.45rem; translate: 0 -50%; width: 36px; height: 36px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; }
.ax-eye svg { width: 18px; height: 18px; fill: var(--muted); transition: fill .2s; }
.ax-eye.is-on svg { fill: rgb(var(--ax-red)); }
.ax-opts { display: flex; justify-content: flex-end; margin: -.3rem .2rem 0; font-size: .82rem; }
.ax-opts .linkbtn { color: rgb(255, 120, 140); }

/* Bouton : le dégradé rouge se remplit pendant l'envoi */
.authx .ax-btn { position: relative; overflow: hidden; isolation: isolate; width: 100%; border: 0; border-radius: 13px; padding: .95rem;
  background: var(--ax-bg); color: rgb(255, 110, 130); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: .82rem;
  box-shadow: var(--ax-outS); transition: box-shadow .25s, color .3s .15s, scale .15s; }
.authx .ax-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #8f0d19, rgb(var(--ax-red)), #ff7a3c);
  transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.6, 0, .2, 1); }
.authx .ax-btn:active { scale: .97; }
.authx .ax-btn.is-loading { color: #fff; box-shadow: var(--ax-in); }
.authx .ax-btn.is-loading::before { transform: scaleX(1); }
.authx .ax-btn.is-loading span::after { content: ""; display: inline-block; width: 11px; height: 11px; margin-left: 9px; vertical-align: -1px;
  border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: axSpin .7s linear infinite; }
.authx .ax-btn:disabled { cursor: wait; filter: none; }
@keyframes axSpin { to { rotate: 360deg; } }

/* Passage connexion / inscription */
.ax-switch { display: flex; align-items: center; justify-content: center; gap: .8rem; color: var(--muted); font-size: .85rem; padding-top: .2rem; }
.ax-round { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ax-bg); box-shadow: var(--ax-outS);
  display: grid; place-items: center; transition: box-shadow .2s, scale .2s; }
.ax-round:active { box-shadow: var(--ax-in); scale: .92; }
.ax-round svg { width: 18px; height: 18px; fill: none; stroke: rgb(var(--ax-red)); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ax-ripple { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 2px solid rgba(var(--ax-red), .6); translate: -50% -50%;
  pointer-events: none; animation: axRing .7s ease-out forwards; }
@keyframes axRing { from { width: 0; height: 0; opacity: 1; } to { width: 150px; height: 150px; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ax-card { transition: none; }
  .ax-bubble, .ax-avatar, .ax-ripple { animation: none !important; }
  .ax-face > *, .ax-form > *:not(.hp-field) { opacity: 1; transform: none; animation: none !important; }
}
