/* Pantallas de acceso. Layout: panel ilustrado (mascota animada) a la izquierda + formulario a la derecha;
   en móvil el panel se reduce a una cabecera con la mascota y el formulario va debajo. */
:root {
  --navy: #1b2846; --navy-2: #24345a; --navy-3: #2f4272;
  --paper: #fff8ef; --paper-ink: #1b2846; --paper-muted: #5d6680; --field: #ffffff; --field-line: #e3d9cb;
  --brand: #c8322b; --brand-dark: #8f1f1a; --brand-ink: #ffffff;
  --lilac: #b7a3f4; --lilac-2: #9b84ea; --lilac-3: #ddd2ff; --blush: #ff8fab;
  --mint: #4fd1b5; --sun: #ffb547; --sky: #7dd3fc;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) { :root {
  --paper: #141b2e; --paper-ink: #eef1fb; --paper-muted: #a3abc3; --field: #1d2640; --field-line: #2f3a5c;
  --brand: #ff5d52; --brand-dark: #b8322b; --brand-ink: #1a0a09; --navy: #0f1628; --navy-2: #18213a; --navy-3: #22305a;
} }

body.auth { margin: 0; min-height: 100%; background: var(--paper); color: var(--paper-ink); font-family: var(--font-body); padding: 0 }
.auth-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh }

/* ---------- Panel ilustrado ---------- */
.art { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 30% 40%, var(--navy-2), var(--navy) 70%); color: #fff;
  display: grid; grid-template-rows: auto 1fr auto; padding: 40px clamp(24px, 4vw, 56px); gap: 12px }
.art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1.5px); background-size: 26px 26px; pointer-events: none }
.art-brand { position: relative; display: flex; align-items: center; gap: 12px; animation: rise .7s ease-out both }
.logo { width: 48px; height: 48px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 var(--brand-dark); transform: rotate(-6deg) }
.logo svg { width: 28px; height: 28px }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; letter-spacing: -.01em }
.stage { position: relative; display: grid; place-items: center; min-height: 0 }
.scene { width: min(100%, 460px); height: auto; overflow: visible }
.art-copy { position: relative; display: grid; gap: 8px; max-width: 30rem; animation: rise .8s .15s ease-out both }
.art-copy h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 3.2vw, 2.6rem); line-height: 1.05; margin: 0 }
.art-copy p { margin: 0; color: rgba(255,255,255,.82); line-height: 1.55 }
.word { display: inline-block; font-weight: 800; color: var(--sun); transition: opacity .25s, transform .25s }
.word.out { opacity: 0; transform: translateY(-6px) }

/* Escena SVG */
.scene * { transform-box: fill-box; transform-origin: center }
.halo.h1 { fill: rgba(255,255,255,.05); animation: pulse 6s ease-in-out infinite }
.halo.h2 { fill: rgba(255,255,255,.06); animation: pulse 6s 1s ease-in-out infinite }
.fcard rect:first-child { stroke: rgba(255,255,255,.85); stroke-width: 3 }
.fcard .win { fill: rgba(255,255,255,.35) }
.fcard .lines { stroke: rgba(255,255,255,.55); stroke-width: 4; stroke-linecap: round }
.fcard.c1 rect:first-child { fill: #e0542a } .fcard.c2 rect:first-child { fill: #2d84c8 } .fcard.c3 rect:first-child { fill: #4e9a3f }
.fcard.c1 { animation: drift1 7s ease-in-out infinite }
.fcard.c2 { animation: drift2 8s ease-in-out infinite }
.fcard.c3 { animation: drift3 7.5s ease-in-out infinite }
.spark { fill: #fff; animation: twinkle 2.4s ease-in-out infinite }
.spark.s1 { fill: var(--brand); animation-delay: .4s } .spark.s3 { animation-delay: 1.2s }
.dot { animation: bob 5s ease-in-out infinite }
.dot.d1 { fill: var(--brand) } .dot.d2 { fill: var(--mint); animation-delay: 1s } .dot.d3 { fill: var(--mint); animation-delay: 2s } .dot.d4 { fill: rgba(255,255,255,.5); animation-delay: 3s }
.shadow { fill: rgba(0,0,0,.28); animation: shadow 3.2s ease-in-out infinite }

.mascot-in { animation: enter .9s cubic-bezier(.2,1.4,.4,1) both }
.mascot { animation: float 3.2s ease-in-out infinite }
.mascot .body, .mascot .arm { fill: var(--lilac); stroke: var(--lilac) }
.mascot .body { stroke: none }
.mascot .ear, .mascot .foot { fill: var(--lilac-2) }
.mascot .belly { fill: var(--lilac-3) }
.mascot .cheek { fill: var(--blush); opacity: .45 }
.mascot .eye circle:first-child { fill: var(--navy) }
.mascot .pupil { fill: #fff; transition: transform .12s ease-out; transform-box: view-box; transform-origin: 0 0 }
.mascot .eyes { animation: blink 5s infinite }
.mascot .mouth { stroke: var(--navy) }
.mascot .mouth.sad { opacity: 0 }
.antenna { transform-origin: 50% 100%; animation: wiggle 2.6s ease-in-out infinite }
.antenna path:first-child { stroke: var(--lilac-2) }
.antenna .star { fill: var(--brand); animation: spin 6s linear infinite }
.arm-r { transform-origin: 0% 100%; animation: wave 2.2s ease-in-out infinite }
.arm-l { transform-origin: 100% 0% }
.hands ellipse { fill: var(--lilac-2) }
.hands { opacity: 0; transform: translateY(70px); transition: transform .35s cubic-bezier(.3,1.4,.5,1), opacity .2s }
.arm { transition: opacity .2s }

/* Estados de la mascota */
.peek .hands { opacity: 1; transform: translateY(0) }
.peek .arm { opacity: 0 }
.sad .mascot .mouth.happy { opacity: 0 }
.sad .mascot .mouth.sad { opacity: 1 }
.sad .mascot { animation: shake .5s ease-in-out 2 }
.sad .arm-r { animation: none }
.cheer .mascot { animation: jump .6s ease-in-out infinite }
.cheer .arm-l { animation: wave 0.5s ease-in-out infinite }

/* ---------- Formulario ---------- */
.auth-main { display: grid; place-items: center; padding: 40px clamp(20px, 5vw, 72px) }
.auth-card { width: min(400px, 100%); display: grid; gap: 22px; background: none; border: 0; box-shadow: none; padding: 0 }
.auth-card > * { animation: rise .55s ease-out both }
.auth-card > *:nth-child(2) { animation-delay: .08s } .auth-card > *:nth-child(3) { animation-delay: .16s }
.auth-card > *:nth-child(4) { animation-delay: .24s } .auth-card > *:nth-child(5) { animation-delay: .32s }
.auth-head { display: grid; gap: 6px }
.auth-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.9rem, 3vw, 2.3rem); color: var(--paper-ink); letter-spacing: -.01em; margin: 0 }
.auth-head p { margin: 0; color: var(--paper-muted); font-size: 1rem }
.auth-head b { color: var(--paper-ink) }
.auth-form { display: grid; gap: 16px }
.auth-form .field { display: grid; gap: 6px }
.auth-form .field label { font-size: .9rem; font-weight: 700; color: var(--paper-ink); letter-spacing: 0 }
.auth-form .hint { font-weight: 600; color: var(--paper-muted) }
.auth-form .field input { font-family: var(--font-body); font-size: 1rem; padding: 13px 16px; border-radius: 14px; border: 2px solid var(--field-line); background: var(--field); color: var(--paper-ink);
  transition: border-color .15s, box-shadow .15s, transform .15s }
.auth-form .field input::placeholder { color: color-mix(in srgb, var(--paper-muted) 70%, transparent) }
.auth-form .field input:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--field-line)) }
.auth-form .field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); transform: translateY(-1px) }
.pass { position: relative }
.pass input { padding-right: 52px !important }
.pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 10px; border: 0; background: none; color: var(--paper-muted); display: grid; place-items: center; padding: 0 }
.pass-toggle:hover { background: color-mix(in srgb, var(--paper-muted) 12%, transparent); color: var(--paper-ink) }
.pass-toggle svg { width: 20px; height: 20px }
.pass-toggle .eye-off { display: none }
.pass-toggle[aria-pressed="true"] .eye-on { display: none }
.pass-toggle[aria-pressed="true"] .eye-off { display: block }

.btn-3d { position: relative; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; letter-spacing: .01em;
  background: var(--brand); color: var(--brand-ink); box-shadow: 0 5px 0 var(--brand-dark); cursor: pointer; transition: transform .08s, box-shadow .08s, filter .15s; margin-top: 4px }
.btn-3d:hover { filter: brightness(1.06) }
.btn-3d:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--brand-dark) }
.btn-3d.loading { color: transparent; pointer-events: none }
.btn-3d.loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite }

.auth-card .msg { border-radius: 12px; padding: 12px 14px; font-weight: 600 }
.auth-card .msg.bad { animation: rise .4s ease-out both, shake .45s .1s ease-in-out }
.auth-alt { margin: 0; text-align: center; color: var(--paper-muted); font-size: .95rem }
.auth-alt a { color: var(--brand); font-weight: 800; text-underline-offset: 3px }
.auth-alt a:hover { text-decoration-thickness: 2px }

/* ---------- Móvil ---------- */
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; min-height: 0 }
  .art { grid-template-rows: auto auto; grid-template-columns: 1fr auto; align-items: center; padding: 20px 20px 0; padding-top: calc(20px + env(safe-area-inset-top, 0px)); gap: 0 }
  .art-brand { grid-column: 1 / -1 }
  .stage { grid-column: 1 / -1; height: 230px; margin-top: -6px }
  .scene { width: auto; height: 250px }
  .art-copy { display: none }
  .brand-text { font-size: 1.35rem }
  .logo { width: 40px; height: 40px; border-radius: 12px }
  .auth-main { place-items: start center; padding: 28px 20px 40px; padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)) }
}

/* ---------- Animaciones ---------- */
@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: 1 } 50% { transform: scaleX(.86); opacity: .7 } }
@keyframes enter { from { transform: translateY(40px) scale(.8); opacity: 0 } to { transform: none; opacity: 1 } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1) } 95% { transform: scaleY(.1) } }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg) } 50% { transform: rotate(7deg) } }
@keyframes wave { 0%, 100% { transform: rotate(0) } 50% { transform: rotate(-22deg) } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes twinkle { 0%, 100% { transform: scale(.6); opacity: .4 } 50% { transform: scale(1.15); opacity: 1 } }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.03) } }
@keyframes drift1 { 0%, 100% { transform: rotate(-14deg) translateY(0) } 50% { transform: rotate(-8deg) translateY(-12px) } }
@keyframes drift2 { 0%, 100% { transform: rotate(12deg) translateY(0) } 50% { transform: rotate(18deg) translateY(-10px) } }
@keyframes drift3 { 0%, 100% { transform: rotate(16deg) translateY(0) } 50% { transform: rotate(9deg) translateY(-14px) } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes shake { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-7px) } 75% { transform: translateX(7px) } }
@keyframes jump { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-22px) } }

@media (prefers-reduced-motion: reduce) {
  .auth *, .auth *::before, .auth *::after { animation: none !important; transition: none !important }
}
