/*
 * Ganadería SPACE — Login
 * Donde la tierra toca las estrellas.
 */

:root {
    --space-void: #050314;
    --space-deep: #0a0620;
    --space-nebula-1: #1e0b3e;
    --space-nebula-2: #3a1660;
    --space-nebula-3: #6b2d8f;
    --space-plasma: #a84ac9;
    --space-glow: #ff8fb8;
    --space-sun: #f6a05c;
    --space-gold: #ffd38a;
    --space-moon: #e9d9ff;
    --space-firefly: #d7ff8a;
    --space-ranch: #ffb86b;
    --space-star: #ffffff;
    --space-mist: rgba(255, 255, 255, 0.72);
    --space-text: #f3eaff;
    --space-text-dim: rgba(243, 234, 255, 0.62);
    --space-glass: rgba(16, 10, 38, 0.55);
    --space-glass-border: rgba(255, 211, 138, 0.18);
    --space-field: rgba(255, 255, 255, 0.04);
    --space-field-border: rgba(255, 255, 255, 0.12);
    --space-field-focus: rgba(255, 211, 138, 0.55);
    --space-error: #ff6b8a;
    --space-radius: 20px;
    --space-radius-sm: 12px;
    --space-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --space-ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100svh;
    font-family: 'Comfortaa', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--space-text);
    background: var(--space-void);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: transparent;
}

/* ----- Fondo cósmico ---------------------------------------------------- */

.space-stage {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 15% 20%, rgba(168, 74, 201, 0.32), transparent 60%),
        radial-gradient(ellipse 60% 60% at 85% 80%, rgba(246, 160, 92, 0.20), transparent 60%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(107, 45, 143, 0.20), transparent 70%),
        linear-gradient(180deg, #050314 0%, #0a0620 45%, #10082e 100%);
}

/* Vía Láctea diagonal — firma del logo */
.space-milkyway {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.7;
    background:
        linear-gradient(
            118deg,
            transparent 25%,
            rgba(168, 74, 201, 0.14) 42%,
            rgba(255, 143, 184, 0.18) 50%,
            rgba(255, 211, 138, 0.14) 58%,
            transparent 75%
        );
    filter: blur(18px);
    animation: milkyDrift 90s linear infinite;
    mix-blend-mode: screen;
}

.space-milkyway::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            118deg,
            transparent 40%,
            rgba(255, 255, 255, 0.08) 50%,
            transparent 60%
        );
    filter: blur(8px);
    mix-blend-mode: screen;
}

@keyframes milkyDrift {
    0%   { transform: translateX(-3%) translateY(-1%); }
    50%  { transform: translateX(3%)  translateY(1%);  }
    100% { transform: translateX(-3%) translateY(-1%); }
}

/* Luna creciente */
.space-moon {
    position: absolute;
    top: 9%;
    right: 14%;
    width: clamp(70px, 7vw, 110px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 35%, var(--space-moon), rgba(233, 217, 255, 0.75) 65%, rgba(233, 217, 255, 0.3) 100%);
    box-shadow:
        0 0 60px rgba(233, 217, 255, 0.35),
        0 0 120px rgba(168, 74, 201, 0.2),
        inset -14px -8px 24px rgba(10, 6, 32, 0.85);
    opacity: 0.78;
    animation: moonBreath 10s ease-in-out infinite;
    pointer-events: none;
}

.space-moon::after {
    content: "";
    position: absolute;
    inset: -40%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(233, 217, 255, 0.08), transparent 60%);
    pointer-events: none;
}

@keyframes moonBreath {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.08); }
}

.space-stars,
.space-fireflies,
.space-dust {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ----- Planeta anillado (Saturno estilizado) ---------------------------- */
.space-planet {
    position: absolute;
    bottom: 38%;
    left: 8%;
    width: clamp(68px, 7vw, 100px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 32%, #ffd38a 0%, #c86e4a 35%, #5c1f4f 70%, #1a0a2e 100%);
    box-shadow:
        inset -8px -4px 20px rgba(10, 6, 32, 0.7),
        0 0 30px rgba(246, 160, 92, 0.25),
        0 0 70px rgba(168, 74, 201, 0.18);
    pointer-events: none;
    transform: translate(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -8px));
    transition: transform 1200ms var(--space-ease-soft);
    animation: planetSpin 180s linear infinite;
    z-index: 1;
}

.space-planet::before {
    content: "";
    position: absolute;
    inset: 25%;
    border-radius: 50%;
    background: radial-gradient(circle at 70% 70%, rgba(90, 30, 70, 0.5), transparent 60%);
}

/* Anillo del planeta */
.space-planet::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -40%;
    width: 180%;
    height: 24%;
    transform: translateY(-50%) rotate(-18deg);
    border-radius: 50%;
    background:
        linear-gradient(90deg,
            transparent 0%,
            rgba(255, 211, 138, 0.08) 10%,
            rgba(255, 211, 138, 0.55) 25%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 211, 138, 0.55) 75%,
            rgba(255, 211, 138, 0.08) 90%,
            transparent 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    opacity: 0.9;
    filter: drop-shadow(0 0 4px rgba(255, 211, 138, 0.6));
}

@keyframes planetSpin {
    0%   { filter: hue-rotate(0deg); }
    50%  { filter: hue-rotate(15deg); }
    100% { filter: hue-rotate(0deg); }
}

/* ----- Nebulosa viva (segunda capa) ------------------------------------- */
.space-nebula {
    position: absolute;
    top: 55%;
    right: -8%;
    width: 55%;
    height: 55%;
    pointer-events: none;
    opacity: 0.35;
    filter: blur(40px);
    background:
        radial-gradient(ellipse at 40% 50%, rgba(255, 143, 184, 0.6) 0%, transparent 55%),
        radial-gradient(ellipse at 60% 40%, rgba(246, 160, 92, 0.4) 0%, transparent 60%);
    mix-blend-mode: screen;
    animation: nebulaBreath 14s ease-in-out infinite;
    z-index: 0;
}

.space-nebula--small {
    top: 12%;
    left: 3%;
    right: auto;
    width: 32%;
    height: 32%;
    opacity: 0.3;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(168, 74, 201, 0.55) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(255, 211, 138, 0.3) 0%, transparent 60%);
    animation-duration: 18s;
    animation-delay: -4s;
}

@keyframes nebulaBreath {
    0%, 100% { transform: scale(1)    translate(0, 0);    opacity: 0.3; }
    50%      { transform: scale(1.08) translate(2%, -1%); opacity: 0.5; }
}

/* ----- Eclíptica/zodíaco (línea diagonal tenue) ------------------------- */
.space-ecliptic {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.35;
    overflow: hidden;
    z-index: 0;
}

.space-ecliptic svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.space-ecliptic .ecliptic-line {
    stroke: rgba(255, 211, 138, 0.4);
    stroke-width: 0.5;
    stroke-dasharray: 2 8;
    fill: none;
    animation: eclipticGlow 8s ease-in-out infinite;
}

.space-ecliptic .ecliptic-tick {
    fill: rgba(255, 211, 138, 0.75);
}

@keyframes eclipticGlow {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.95; }
}

/* ----- Estrellas sparkle con rayos cruzados ----------------------------- */
.space-sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
}

.space-sparkle svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.space-sparkle .spark-core {
    fill: #fff;
    filter: drop-shadow(0 0 8px rgba(255, 211, 138, 0.9));
    animation: sparkleCore 4s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.space-sparkle .spark-ray {
    stroke: rgba(255, 255, 255, 0.75);
    stroke-width: 1;
    stroke-linecap: round;
    animation: sparkleRay 4s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.space-sparkle .spark-ray--warm {
    stroke: rgba(255, 211, 138, 0.8);
}

.space-sparkle--pulsar {
    width: 92px;
    height: 92px;
}

.space-sparkle--pulsar .spark-core {
    fill: var(--space-gold);
    filter: drop-shadow(0 0 20px var(--space-gold)) drop-shadow(0 0 40px rgba(255, 143, 184, 0.6));
    animation-duration: 2.6s;
}

.space-sparkle--pulsar .spark-ray {
    stroke: rgba(255, 211, 138, 0.9);
    stroke-width: 1.4;
    animation-duration: 2.6s;
}

.space-sparkle--s1 { top: 18%; left: 72%; animation-delay: 0s; }
.space-sparkle--s2 { top: 44%; left: 18%; animation-delay: -1.3s; }
.space-sparkle--s3 { top: 62%; left: 60%; animation-delay: -2.8s; }
.space-sparkle--pulsar { top: 28%; left: 90%; }

@keyframes sparkleCore {
    0%, 100% { transform: scale(0.7); opacity: 0.7; }
    50%      { transform: scale(1.15); opacity: 1; }
}

@keyframes sparkleRay {
    0%, 100% { transform: scale(0.5); opacity: 0.3; }
    50%      { transform: scale(1);   opacity: 1; }
}

/* ----- Constelaciones de fondo (tenues) -------------------------------- */
.space-constellation {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    animation: constReveal 2600ms var(--space-ease) 1600ms forwards;
}

.space-constellation svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.space-constellation .const-line {
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 0.5;
    stroke-dasharray: 1.5 3;
    fill: none;
}

.space-constellation .const-star {
    fill: #fff;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.75));
    animation: constTwinkle 3.6s ease-in-out infinite;
}

.space-constellation .const-label {
    fill: rgba(255, 211, 138, 0.4);
    font-family: inherit;
    font-size: 6px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.space-constellation--orion {
    top: 22%;
    right: 10%;
    width: 150px;
}

.space-constellation--cross {
    bottom: 36%;
    right: 28%;
    width: 90px;
}

@keyframes constReveal {
    to { opacity: 0.65; }
}

@keyframes constTwinkle {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1;   }
}

/* Grano/textura sutil */
.space-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Silueta de pradera: la tierra bajo el cielo */
.space-horizon {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32vh;
    pointer-events: none;
    z-index: 1;
    background:
        linear-gradient(180deg, transparent 0%, rgba(5, 3, 20, 0.75) 60%, var(--space-void) 100%);
}

.space-horizon svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Ventanas del rancho — pulso ámbar */
.space-horizon .ranch-window {
    animation: ranchPulse 3.5s ease-in-out infinite;
    transform-origin: center;
}
.space-horizon .ranch-window:nth-child(2) { animation-delay: 1.2s; }
.space-horizon .ranch-window:nth-child(3) { animation-delay: 2.3s; }
.space-horizon .ranch-window:nth-child(4) { animation-delay: 0.6s; }

@keyframes ranchPulse {
    0%, 100% { opacity: 0.55; filter: blur(0.2px); }
    50%      { opacity: 1;    filter: blur(0.8px); }
}

/* ----- Capa principal --------------------------------------------------- */

.authentication {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
}

/* Panel izquierdo: brand cósmico */
.space-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 4vw, 4rem);
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px);
    animation: brandEnter 1200ms var(--space-ease) 180ms forwards;
}

@keyframes brandEnter {
    to { opacity: 1; transform: translateY(0); }
}

.space-brand__kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--space-text-dim);
    font-weight: 400;
}

.space-brand__kicker::before {
    content: "";
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--space-gold));
}

.space-brand__hero {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    max-width: 540px;
    margin-top: auto;
}

/* Logo + constelación-marca lado a lado */
.space-logo-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 1.75rem;
}

.space-logo {
    position: relative;
    width: clamp(120px, 15vw, 180px);
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 211, 138, 0.25),
        0 20px 60px -10px rgba(168, 74, 201, 0.55),
        0 0 80px rgba(246, 160, 92, 0.18);
    isolation: isolate;
    flex-shrink: 0;
}

.space-logo::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(255, 211, 138, 0.45),
        transparent 50%,
        rgba(168, 74, 201, 0.45),
        transparent
    );
    animation: haloSpin 18s linear infinite;
    z-index: -1;
}

.space-logo::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 211, 138, 0.25), transparent 60%);
    mix-blend-mode: screen;
    animation: breath 6s ease-in-out infinite;
}

.space-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes haloSpin {
    to { transform: rotate(360deg); }
}

@keyframes breath {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 0.95; }
}

/* Constelación-marca: la "marca ganadera" del cielo */
.space-brand-mark {
    position: relative;
    width: clamp(110px, 11vw, 150px);
    height: auto;
    opacity: 0;
    animation: markReveal 1800ms var(--space-ease) 900ms forwards;
}

.space-brand-mark svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.space-brand-mark .mark-line {
    stroke: rgba(255, 211, 138, 0.55);
    stroke-width: 0.6;
    fill: none;
    stroke-dasharray: 1 2.5;
    stroke-dashoffset: 180;
    animation: markDraw 2600ms var(--space-ease) 1100ms forwards;
}

.space-brand-mark .mark-star {
    fill: #fff;
    filter: drop-shadow(0 0 4px rgba(255, 211, 138, 0.8));
    opacity: 0;
    animation: markTwinkle 2800ms ease-in-out infinite;
}
.space-brand-mark .mark-star:nth-child(1) { animation-delay: 0ms;    animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(2) { animation-delay: 180ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(3) { animation-delay: 320ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(4) { animation-delay: 460ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(5) { animation-delay: 600ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(6) { animation-delay: 760ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(7) { animation-delay: 900ms;  animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(8) { animation-delay: 1040ms; animation-fill-mode: both; }
.space-brand-mark .mark-star:nth-child(9) { animation-delay: 1180ms; animation-fill-mode: both; }

.space-brand-mark .mark-label {
    fill: var(--space-text-dim);
    font-family: inherit;
    font-size: 7px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    opacity: 0;
    animation: markLabelIn 1000ms var(--space-ease) 2400ms forwards;
}

@keyframes markReveal {
    to { opacity: 1; }
}
@keyframes markDraw {
    to { stroke-dashoffset: 0; }
}
@keyframes markTwinkle {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.15); }
}
@keyframes markLabelIn {
    to { opacity: 0.75; }
}

.space-brand__title {
    margin: 0;
    font-size: clamp(2.6rem, 5.5vw, 5rem);
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.space-brand__title em {
    font-family: 'Fraunces', 'Comfortaa', serif;
    font-style: italic;
    font-weight: 500;
    font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
    background: linear-gradient(135deg, var(--space-gold) 0%, var(--space-glow) 45%, var(--space-plasma) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    position: relative;
}

.space-brand__title em::after {
    content: "✦";
    position: absolute;
    top: -0.3em;
    right: -0.5em;
    font-size: 0.3em;
    color: var(--space-gold);
    -webkit-text-fill-color: var(--space-gold);
    opacity: 0.7;
    filter: drop-shadow(0 0 8px var(--space-gold));
    animation: spark 4s ease-in-out infinite;
}

@keyframes spark {
    0%, 100% { opacity: 0.5; transform: rotate(0deg) scale(1); }
    50%      { opacity: 1;   transform: rotate(90deg) scale(1.2); }
}

.space-brand__tagline {
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.6;
    color: var(--space-text-dim);
    max-width: 44ch;
    margin: 0;
}

.space-brand__meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--space-text-dim);
    text-transform: uppercase;
}

.space-brand__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.space-brand__meta span::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--space-gold);
    box-shadow: 0 0 10px var(--space-gold);
}

/* Panel derecho: formulario */
.space-pane {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 3vw, 3rem);
    background:
        linear-gradient(180deg, rgba(5, 3, 20, 0.35), rgba(5, 3, 20, 0.6)),
        radial-gradient(ellipse 100% 80% at 100% 0%, rgba(246, 160, 92, 0.12), transparent 60%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-left: 1px solid var(--space-glass-border);
}

/* ----- Tarjeta del formulario ------------------------------------------- */

.space-card {
    width: 100%;
    max-width: 440px;
    padding: clamp(1.75rem, 3vw, 2.5rem);
    background: var(--space-glass);
    border: 1px solid var(--space-glass-border);
    border-radius: var(--space-radius);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    box-shadow:
        0 30px 80px -20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    opacity: 0;
    transform: translateY(24px);
    animation: cardEnter 1100ms var(--space-ease) 450ms forwards;
    position: relative;
    overflow: hidden;
}

@keyframes cardEnter {
    to { opacity: 1; transform: translateY(0); }
}

/* Luz tenue en la esquina de la tarjeta */
.space-card::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 211, 138, 0.14), transparent 60%);
    pointer-events: none;
    animation: cardBeacon 8s ease-in-out infinite;
}

@keyframes cardBeacon {
    0%, 100% { opacity: 0.4; transform: translate(0, 0); }
    50%      { opacity: 0.9; transform: translate(-4%, 4%); }
}

.space-card__head {
    margin-bottom: 2rem;
    position: relative;
}

.space-card__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--space-gold);
    opacity: 0.85;
}

.space-card__eyebrow::before {
    content: "✦";
    font-size: 0.85rem;
    opacity: 0.8;
}

.space-card__title {
    margin: 0.75rem 0 0.4rem;
    font-size: clamp(1.5rem, 2.2vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--space-text);
}

.space-card__subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: var(--space-text-dim);
    line-height: 1.5;
}

/* Campos */
.space-field {
    position: relative;
    margin-bottom: 1.1rem;
}

.space-field__input {
    width: 100%;
    padding: 1.35rem 1rem 0.6rem 2.75rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--space-text);
    background: var(--space-field);
    border: 1px solid var(--space-field-border);
    border-radius: var(--space-radius-sm);
    outline: none;
    transition: border-color 220ms var(--space-ease),
                box-shadow 220ms var(--space-ease),
                background-color 220ms var(--space-ease);
    appearance: none;
}

.space-field__input:hover {
    background: rgba(255, 255, 255, 0.06);
}

.space-field__input:focus {
    border-color: var(--space-field-focus);
    background: rgba(255, 255, 255, 0.07);
    box-shadow:
        0 0 0 4px rgba(255, 211, 138, 0.12),
        0 0 24px rgba(255, 211, 138, 0.1);
}

.space-field__input::placeholder {
    color: transparent;
}

.space-field__label {
    position: absolute;
    left: 2.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.95rem;
    color: var(--space-text-dim);
    transition: top 180ms var(--space-ease),
                font-size 180ms var(--space-ease),
                color 180ms var(--space-ease),
                transform 180ms var(--space-ease);
}

.space-field__input:focus ~ .space-field__label,
.space-field__input:not(:placeholder-shown) ~ .space-field__label {
    top: 0.55rem;
    transform: translateY(0);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--space-gold);
}

.space-field__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--space-text-dim);
    pointer-events: none;
    transition: color 180ms var(--space-ease);
}

.space-field__input:focus ~ .space-field__icon {
    color: var(--space-gold);
}

.space-field__toggle {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--space-text-dim);
    cursor: pointer;
    border-radius: 10px;
    transition: color 180ms var(--space-ease), background-color 180ms var(--space-ease);
}

.space-field__toggle:hover,
.space-field__toggle:focus-visible {
    color: var(--space-gold);
    background: rgba(255, 211, 138, 0.08);
    outline: none;
}

.space-field__toggle svg {
    width: 18px;
    height: 18px;
}

.space-field--has-toggle .space-field__input {
    padding-right: 3rem;
}

.space-field__error {
    display: block;
    margin: 0.4rem 0.2rem 0;
    font-size: 0.78rem;
    color: var(--space-error);
    letter-spacing: 0.01em;
}

/* Fila: recordarme + ayuda */
.space-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.25rem 0 1.5rem;
    font-size: 0.85rem;
}

.space-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--space-text-dim);
    cursor: pointer;
    user-select: none;
}

.space-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.space-check__box {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--space-field-border);
    background: var(--space-field);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 180ms var(--space-ease);
}

.space-check__box::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--space-gold), var(--space-glow));
    transform: scale(0);
    transition: transform 180ms var(--space-ease);
}

.space-check input:checked ~ .space-check__box {
    border-color: var(--space-gold);
    background: rgba(255, 211, 138, 0.1);
}

.space-check input:checked ~ .space-check__box::after {
    transform: scale(1);
}

.space-check input:focus-visible ~ .space-check__box {
    box-shadow: 0 0 0 4px rgba(255, 211, 138, 0.18);
}

.space-link {
    color: var(--space-text-dim);
    text-decoration: none;
    transition: color 180ms var(--space-ease);
}

.space-link:hover,
.space-link:focus-visible {
    color: var(--space-gold);
    outline: none;
}

/* Botón principal */
.space-btn {
    position: relative;
    width: 100%;
    padding: 1rem 1.5rem;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1a0b2e;
    background: linear-gradient(135deg, var(--space-gold) 0%, var(--space-glow) 55%, var(--space-plasma) 100%);
    background-size: 180% 180%;
    background-position: 0% 0%;
    border: 0;
    border-radius: var(--space-radius-sm);
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow:
        0 10px 30px -10px rgba(255, 143, 184, 0.5),
        0 0 0 1px rgba(255, 211, 138, 0.3) inset;
    transition: background-position 500ms var(--space-ease),
                transform 180ms var(--space-ease),
                box-shadow 300ms var(--space-ease);
}

.space-btn:hover,
.space-btn:focus-visible {
    background-position: 100% 100%;
    outline: none;
    box-shadow:
        0 14px 40px -8px rgba(255, 143, 184, 0.6),
        0 0 0 1px rgba(255, 211, 138, 0.5) inset,
        0 0 30px rgba(255, 211, 138, 0.25);
}

.space-btn:active {
    transform: translateY(1px);
}

.space-btn__shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 650ms var(--space-ease);
    pointer-events: none;
}

.space-btn:hover .space-btn__shine {
    transform: translateX(100%);
}

/* Chispas que flotan alrededor del botón al hacer hover */
.space-btn::before,
.space-btn::after {
    content: "✦";
    position: absolute;
    top: 50%;
    font-size: 10px;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
    transition: opacity 200ms var(--space-ease);
}

.space-btn::before { left: 12%; }
.space-btn::after  { right: 12%; }

.space-btn:hover::before { animation: sparkFloatA 1.4s ease-in-out infinite; }
.space-btn:hover::after  { animation: sparkFloatB 1.4s ease-in-out infinite; }

@keyframes sparkFloatA {
    0%   { opacity: 0; transform: translateY(0)   scale(0.5) rotate(0); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-18px) scale(1.2) rotate(90deg); }
}
@keyframes sparkFloatB {
    0%   { opacity: 0; transform: translateY(0)   scale(0.5) rotate(0); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-14px) scale(1.1) rotate(-70deg); }
}

/* Footer */
.space-card__foot {
    margin-top: 1.6rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--space-text-dim);
    letter-spacing: 0.02em;
}

.space-card__foot span {
    color: var(--space-gold);
    font-weight: 700;
}

/* ----- Mobile ----------------------------------------------------------- */

@media (max-width: 980px) {
    .authentication {
        grid-template-columns: 1fr;
    }

    .space-brand {
        padding: clamp(1.75rem, 5vw, 2.5rem) clamp(1.5rem, 5vw, 2rem) 0;
        text-align: center;
        align-items: center;
    }

    .space-brand__kicker {
        margin: 0 auto;
    }

    .space-brand__hero {
        align-items: center;
        margin-top: 1rem;
        gap: 1.25rem;
    }

    .space-logo-wrap {
        flex-direction: column;
        gap: 1rem;
    }

    .space-brand__meta {
        display: none;
    }

    .space-moon {
        top: 5%;
        right: 8%;
        width: 56px;
    }

    .space-planet {
        bottom: 42%;
        left: auto;
        right: 6%;
        width: 54px;
    }

    .space-constellation--orion { top: 14%; right: 6%; width: 110px; }
    .space-constellation--cross { bottom: 44%; right: 8%; width: 70px; }

    .space-sparkle--s1 { top: 10%; left: 20%; }
    .space-sparkle--s2 { top: 48%; left: 85%; width: 48px; height: 48px; }
    .space-sparkle--s3 { display: none; }
    .space-sparkle--pulsar { top: 8%; left: 78%; width: 72px; height: 72px; }

    .space-pane {
        border-left: none;
        border-top: 1px solid var(--space-glass-border);
        padding: 2rem 1.25rem 2.5rem;
    }
}

@media (max-width: 560px) {
    :root {
        --space-radius: 16px;
    }

    .space-brand {
        padding-top: 2rem;
    }

    .space-logo {
        width: 100px;
    }

    .space-brand-mark {
        width: 90px;
    }

    .space-brand__title {
        font-size: 2.4rem;
    }

    .space-brand__tagline {
        font-size: 0.9rem;
    }

    .space-card {
        padding: 1.4rem 1.25rem 1.5rem;
    }

    .space-horizon {
        height: 24vh;
    }

    .space-moon {
        width: 44px;
    }

    .space-planet { width: 42px; }
    .space-sparkle--s2 { display: none; }
    .space-sparkle--pulsar { width: 56px; height: 56px; top: 6%; left: 72%; }
    .space-constellation--orion { width: 86px; top: 11%; right: 4%; }
    .space-constellation--cross { display: none; }
}

@media (max-width: 380px) {
    .space-brand__title {
        font-size: 2.05rem;
    }

    .space-field__input {
        font-size: 16px; /* evita zoom en iOS */
    }

    .space-brand-mark { width: 76px; }
}

/* ----- Tabletas horizontales grandes ------------------------------------ */

@media (min-width: 1400px) {
    .space-card {
        max-width: 480px;
    }
}

/* ----- Preferencias de accesibilidad ------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    .space-logo::before,
    .space-logo::after,
    .space-btn__shine,
    .space-btn::before,
    .space-btn::after,
    .space-stars,
    .space-fireflies,
    .space-dust,
    .space-milkyway,
    .space-moon,
    .space-planet,
    .space-nebula,
    .space-ecliptic .ecliptic-line,
    .space-sparkle .spark-core,
    .space-sparkle .spark-ray,
    .space-brand,
    .space-card,
    .space-horizon .ranch-window,
    .space-brand-mark,
    .space-brand-mark .mark-star,
    .space-brand-mark .mark-line,
    .space-brand-mark .mark-label,
    .space-constellation,
    .space-constellation .const-star,
    .space-card::before,
    .space-brand__title em::after {
        animation: none !important;
        transition: none !important;
    }

    .space-brand,
    .space-card,
    .space-brand-mark,
    .space-brand-mark .mark-star,
    .space-brand-mark .mark-label,
    .space-constellation {
        opacity: 1 !important;
        transform: none !important;
    }

    .space-brand-mark .mark-line {
        stroke-dashoffset: 0 !important;
    }
}

/* Autofill */
.space-field__input:-webkit-autofill,
.space-field__input:-webkit-autofill:hover,
.space-field__input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--space-text);
    -webkit-box-shadow: 0 0 0 1000px rgba(16, 10, 38, 0.95) inset;
    caret-color: var(--space-text);
    transition: background-color 5000s ease-in-out 0s;
}
