/* Страницы входа и регистрации: Млечный путь, тёмно-синий фон, яркие звёзды (без JS) */

.auth-page {
    position: relative;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 4vw, 2.5rem);
    isolation: isolate;
    overflow-x: hidden;
}

/* Базовый космический градиент */
.auth-cosmic-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(circle at 15% 10%, rgba(127, 214, 255, 0.1), transparent 34%),
        radial-gradient(circle at 80% 20%, rgba(243, 201, 122, 0.08), transparent 30%),
        radial-gradient(circle at 50% 85%, rgba(160, 119, 255, 0.16), transparent 42%),
        radial-gradient(circle at 50% 40%, rgba(78, 35, 131, 0.28), transparent 55%),
        linear-gradient(160deg, var(--bg-start), var(--bg-mid) 42%, var(--bg-end));
}

.auth-cosmic-bg::before {
    content: "";
    position: absolute;
    width: 140vmax;
    height: 40vmax;
    top: 8%;
    left: -20%;
    border-radius: 999px;
    opacity: 0.85;
    filter: blur(22px);
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 50%, rgba(255, 241, 204, 0.1), transparent 14%),
        radial-gradient(circle at 40% 54%, rgba(255, 255, 255, 0.12), transparent 12%),
        radial-gradient(circle at 52% 46%, rgba(160, 119, 255, 0.18), transparent 18%),
        radial-gradient(circle at 76% 48%, rgba(127, 214, 255, 0.12), transparent 14%),
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 234, 193, 0.07) 18%,
            rgba(223, 197, 255, 0.14) 50%,
            rgba(135, 193, 255, 0.09) 76%,
            transparent 100%
        );
    box-shadow:
        0 0 80px rgba(192, 143, 255, 0.1),
        0 0 140px rgba(255, 209, 122, 0.06);
    transform: rotate(-18deg);
    animation: auth-drift-milky 38s ease-in-out infinite alternate;
}

.auth-cosmic-bg::after {
    content: "";
    position: absolute;
    inset: -15%;
    background:
        radial-gradient(circle at 35% 42%, rgba(243, 201, 122, 0.1), transparent 30%),
        radial-gradient(circle at 67% 58%, rgba(127, 214, 255, 0.09), transparent 34%);
    filter: blur(28px);
    opacity: 0.55;
    pointer-events: none;
}

/* Звёздное поле: яркие точки + мерцание */
.auth-stars {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.auth-stars__layer {
    position: absolute;
    inset: 0;
    background-repeat: repeat;
    background-size: 400px 400px;
    opacity: 0.95;
    animation: auth-twinkle-slow 7s ease-in-out infinite;
}

.auth-stars__layer--2 {
    background-size: 520px 520px;
    opacity: 0.75;
    animation-duration: 11s;
    animation-delay: -2s;
}

.auth-stars__layer--3 {
    background-size: 280px 280px;
    opacity: 0.55;
    animation-duration: 5s;
    animation-delay: -1s;
}

/* Набор radial-gradient как «звёзды» (яркие белые/голубые ядра) */
.auth-stars__layer--1 {
    background-image:
        radial-gradient(circle, #fff 0.5px, transparent 0.6px),
        radial-gradient(circle, rgba(200, 230, 255, 1) 0.4px, transparent 0.55px),
        radial-gradient(circle, #fff 0.35px, transparent 0.5px);
    background-position: 0 0, 120px 80px, 200px 200px;
}

.auth-stars__layer--2 {
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0.45px, transparent 0.55px),
        radial-gradient(circle, rgba(180, 220, 255, 1) 0.5px, transparent 0.65px);
    background-position: 60px 40px, 300px 160px;
}

.auth-stars__layer--3 {
    background-image:
        radial-gradient(circle, #fff 0.55px, transparent 0.7px),
        radial-gradient(circle, rgba(255, 248, 220, 0.9) 0.4px, transparent 0.55px);
    background-position: 200px 100px, 40px 220px;
}

@keyframes auth-drift-milky {
    from {
        transform: rotate(-18deg) translate3d(-1%, 0, 0);
    }
    to {
        transform: rotate(-16deg) translate3d(1.5%, 0.5%, 0);
    }
}

@keyframes auth-twinkle-slow {
    0%,
    100% {
        opacity: 0.88;
    }
    50% {
        opacity: 0.55;
    }
}

/* Карточка формы */
.auth-shell {
    width: min(26rem, 100%);
    position: relative;
    z-index: 1;
}

.auth-card {
    padding: clamp(1.75rem, 4vw, 2.35rem);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: rgba(19, 10, 38, 0.78);
    backdrop-filter: blur(16px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 24px 48px rgba(0, 0, 0, 0.45),
        var(--glow);
}

.auth-card__title {
    margin: 0 0 0.35rem;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(1.75rem, 4vw, 2.1rem);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.auth-card__lead {
    margin: 0 0 1.5rem;
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.45;
}

.auth-form .auth-field {
    margin-bottom: 1.1rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-soft);
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.38);
    color: var(--text-main);
    font: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: rgba(160, 119, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(160, 119, 255, 0.18);
}

.auth-form .helptext {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: rgba(205, 191, 230, 0.72);
    line-height: 1.35;
}

.auth-form ul.errorlist {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
    color: #fca5a5;
    font-size: 0.82rem;
}

.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
    font-size: 0.9rem;
}

.auth-form .btn {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
}

.auth-footer {
    margin-top: 1.35rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line-soft);
    text-align: center;
    font-size: 0.92rem;
    color: var(--text-soft);
}

.auth-footer a {
    color: var(--cyan);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    color: #fff;
    text-decoration: underline;
}

.auth-back {
    display: inline-block;
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: var(--text-soft);
}

.auth-back a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 600;
}

.auth-back a:hover {
    text-decoration: underline;
}

.auth-messages {
    margin-bottom: 1rem;
}

.auth-messages .auth-alert--ok {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
}

/* Узкие экраны и вырезы: отступы и чуть плотнее карточка */
@media (max-width: 420px) {
    .auth-page {
        padding-left: max(0.85rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.85rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
    }

    .auth-card {
        padding: 1.35rem 1rem;
    }
}
