/* ===== AUTH PAGES — современный UI (login / register) ===== */

body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background: #070714;
    background-image: none;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-bg__aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    will-change: transform;
}

.auth-bg__aurora--1 {
    width: min(90vw, 640px);
    height: min(90vw, 640px);
    top: -18%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(107, 91, 212, 0.55) 0%, transparent 68%);
    animation: auth-aurora-drift 18s ease-in-out infinite;
}

.auth-bg__aurora--2 {
    width: min(70vw, 480px);
    height: min(70vw, 480px);
    bottom: -12%;
    right: -8%;
    background: radial-gradient(circle, rgba(0, 229, 212, 0.35) 0%, transparent 70%);
    animation: auth-aurora-drift 22s ease-in-out infinite reverse;
}

.auth-bg__aurora--3 {
    width: min(55vw, 380px);
    height: min(55vw, 380px);
    bottom: 20%;
    left: -12%;
    background: radial-gradient(circle, rgba(255, 107, 157, 0.28) 0%, transparent 72%);
    animation: auth-aurora-drift 26s ease-in-out infinite;
    animation-delay: -6s;
}

@keyframes auth-aurora-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3%, 2%) scale(1.06); }
    66% { transform: translate(-2%, 4%) scale(0.96); }
}

.auth-bg__orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.2), rgba(139, 124, 255, 0.08) 40%, transparent 70%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 40px rgba(139, 124, 255, 0.15);
    animation: auth-orb-float 12s ease-in-out infinite;
}

.auth-bg__orb--1 {
    width: 120px;
    height: 120px;
    top: 12%;
    right: 8%;
    animation-duration: 14s;
}

.auth-bg__orb--2 {
    width: 64px;
    height: 64px;
    top: 42%;
    left: 6%;
    animation-duration: 11s;
    animation-delay: -3s;
}

.auth-bg__orb--3 {
    width: 88px;
    height: 88px;
    bottom: 14%;
    right: 18%;
    animation-duration: 16s;
    animation-delay: -7s;
}

@keyframes auth-orb-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-18px) rotate(6deg); }
}

.auth-bg__grid {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(139, 124, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 124, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
}

.auth-bg__vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 40%, rgba(4, 4, 12, 0.75) 100%);
}

.auth-container {
    max-width: 520px;
    min-height: auto;
    padding: max(16px, env(safe-area-inset-top, 0px) + 12px) max(14px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px) + 16px) max(14px, env(safe-area-inset-left, 0px));
}

body.auth-page .auth-container {
    min-height: auto;
    justify-content: flex-start;
    padding-top: max(20px, env(safe-area-inset-top, 0px) + 16px);
    padding-bottom: max(28px, env(safe-area-inset-bottom, 0px) + 20px);
}

.auth-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}

.auth-brand {
    width: 100%;
    margin: 0 auto 24px;
    padding: 0 8px;
    display: flex;
    justify-content: center;
}

.auth-logo {
    display: block;
    width: min(100%, 480px);
    height: auto;
    max-height: clamp(110px, 32vw, 200px);
    object-fit: contain;
    filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 56px rgba(139, 124, 255, 0.42));
    animation: auth-logo-float 5s ease-in-out infinite;
}

@keyframes auth-logo-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.auth-card {
    position: relative;
    margin: 0;
    border: none;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 196, 87, 0.85) 0%, rgba(139, 124, 255, 0.9) 45%, rgba(92, 201, 255, 0.75) 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 8px 32px rgba(139, 124, 255, 0.22),
        0 0 48px rgba(255, 196, 87, 0.12);
    animation: auth-card-enter 0.65s cubic-bezier(0.22, 1, 0.36, 1), auth-panel-glow 4s ease-in-out 0.65s infinite;
    overflow: hidden;
}

@keyframes auth-panel-glow {
    0%, 100% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.06) inset,
            0 8px 32px rgba(139, 124, 255, 0.22),
            0 0 40px rgba(255, 196, 87, 0.1);
    }
    50% {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 10px 36px rgba(139, 124, 255, 0.32),
            0 0 56px rgba(255, 196, 87, 0.18);
    }
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 196, 87, 0.14), transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(139, 124, 255, 0.16), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.auth-card__inner {
    position: relative;
    z-index: 1;
    padding: clamp(22px, 5vw, 32px);
    border-radius: 23px;
    background: linear-gradient(165deg, rgba(22, 20, 48, 0.97) 0%, rgba(12, 11, 28, 0.98) 100%);
    backdrop-filter: blur(28px) saturate(1.2);
    -webkit-backdrop-filter: blur(28px) saturate(1.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

@keyframes auth-card-enter {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card__header {
    text-align: center;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-card__eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c4b5ff;
    background: rgba(107, 91, 212, 0.2);
    border: 1px solid rgba(139, 124, 255, 0.35);
    box-shadow: 0 0 24px rgba(107, 91, 212, 0.2);
}

.auth-card__title {
    font-family: 'Cinzel', serif;
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 4.5vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
    text-shadow: 0 2px 20px rgba(139, 124, 255, 0.35);
}

.auth-card__subtitle {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.58);
}

.auth-card__subtitle strong {
    color: #ffd56a;
    font-weight: 600;
}

.auth-card h2:not(.auth-card__title) {
    font-family: 'Cinzel', serif;
    text-align: center;
    margin-bottom: 8px;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
}

/* Алерты */
.auth-page .alert {
    border-radius: 14px;
    border: 1px solid transparent;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.45;
    backdrop-filter: blur(8px);
}

.auth-page .alert-danger {
    background: rgba(220, 53, 69, 0.12);
    border-color: rgba(255, 107, 129, 0.35);
    color: #ffb3be;
}

.auth-page .alert-success {
    background: rgba(40, 167, 69, 0.12);
    border-color: rgba(72, 220, 130, 0.35);
    color: #a8f0c8;
}

.auth-page .alert-info {
    background: rgba(107, 91, 212, 0.12);
    border-color: rgba(139, 124, 255, 0.35);
    color: #c4b5ff;
}

/* Поля формы */
.auth-page .form-group {
    margin-bottom: 16px;
}

.auth-page .form-group > label:not([for]) {
    display: block;
    margin-bottom: 8px;
}

.auth-page .form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
}

.auth-page .form-control {
    min-height: 50px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-page .form-control:hover:not(:disabled):not([readonly]) {
    border-color: rgba(139, 124, 255, 0.35);
    background: rgba(0, 0, 0, 0.42);
}

.auth-page .form-control:focus {
    border-color: rgba(139, 124, 255, 0.75);
    background: rgba(0, 0, 0, 0.48);
    box-shadow:
        0 0 0 3px rgba(107, 91, 212, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    outline: none;
}

.auth-page .form-control::placeholder {
    color: rgba(255, 255, 255, 0.32);
    font-weight: 400;
}

.auth-page .form-control[readonly],
.auth-page .auth-field--readonly {
    opacity: 0.88;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.22) !important;
    border-style: dashed;
}

.auth-page .form-hint,
.auth-page .form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.45) !important;
}

.auth-page .auth-field-note {
    margin: 6px 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.45);
}

/* OTP / код подтверждения */
.auth-page .auth-otp-input,
.auth-page #reg-code,
.auth-page #login-code {
    text-align: center;
    font-size: 1.75rem !important;
    font-weight: 700;
    letter-spacing: 0.35em;
    font-variant-numeric: tabular-nums;
    padding-left: 0.35em;
}

.auth-page .auth-verify-banner {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    text-align: center;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.72);
    background: linear-gradient(135deg, rgba(107, 91, 212, 0.15) 0%, rgba(0, 229, 212, 0.08) 100%);
    border: 1px solid rgba(139, 124, 255, 0.25);
}

/* Пол персонажа — сегмент */
.auth-page .form-row--gender {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 4px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-page .form-row--gender label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.auth-page .form-row--gender label:has(input:checked) {
    color: #fff;
    background: linear-gradient(145deg, rgba(107, 91, 212, 0.55) 0%, rgba(74, 144, 217, 0.45) 100%);
    box-shadow: 0 4px 16px rgba(107, 91, 212, 0.35);
}

.auth-page .form-row--gender input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Кнопки */
.auth-page .btn-primary.btn-block {
    min-height: 52px;
    margin-top: 6px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fff;
    background: linear-gradient(135deg, #7c6cf7 0%, #6b5bd4 40%, #5a4bc4 100%);
    box-shadow:
        0 8px 28px rgba(107, 91, 212, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    position: relative;
    overflow: hidden;
}

.auth-page .btn-primary.btn-block::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65%);
    transform: translateX(-120%);
    transition: transform 0.55s ease;
}

.auth-page .btn-primary.btn-block:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 12px 36px rgba(107, 91, 212, 0.55);
}

.auth-page .btn-primary.btn-block:hover::after {
    transform: translateX(120%);
}

.auth-page .btn-primary.btn-block:active {
    transform: translateY(0);
}

.auth-page .btn-secondary.btn-block {
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.auth-page .btn-secondary.btn-block:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 124, 255, 0.35);
}

.auth-page .auth-form-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.auth-page .mt-12 {
    margin-top: 14px;
}

/* Чекбокс соглашения */
.auth-page .terms-checkbox-wrapper {
    margin-top: 4px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.auth-page .terms-checkbox-wrapper label {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
}

.auth-page .terms-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #7c6cf7;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Ссылки */
.auth-page .auth-links {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
}

.auth-page .auth-links a {
    color: #a898ff;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.auth-page .auth-links a:hover {
    color: #ffd56a;
    text-decoration: none;
}

.auth-page .auth-hint,
.auth-page .auth-guest-hint {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.42);
    margin-top: 12px;
}

/* Соцсети */
.auth-page .auth-social {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-page .auth-social__divider span {
    background: rgba(12, 11, 28, 0.95);
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.auth-page .btn-social {
    min-height: 52px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.auth-page .btn-social:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* Пароль toggle */
.auth-page .password-toggle-btn {
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-page .password-toggle-btn:hover {
    background: rgba(107, 91, 212, 0.25);
    border-color: rgba(139, 124, 255, 0.4);
}

/* Help details */
.auth-page .register-help-details {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-page .register-help-details summary {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
}

.auth-page .register-help-details summary::before {
    content: '? ';
    color: #a898ff;
}

.auth-page .register-help-details__text {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
}

/* Footer tagline */
.auth-footer-tagline {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
}

/* Инвайт-код — без градиентной подсветки (акцент только на auth-card) */
.auth-page .invite-code-panel {
    margin: 2px 0 14px;
    padding: 0;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    animation: none;
    box-shadow: none;
}

.auth-page .invite-code-panel__glow {
    display: none;
}

.auth-page .invite-code-panel__inner {
    padding: 14px 16px 12px;
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.22);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.auth-page .invite-code-panel__badge {
    box-shadow: none;
}

.auth-page .register-help-details a {
    color: #a898ff;
    font-weight: 700;
    text-decoration: none;
}

.auth-page .register-help-details a:hover {
    color: #ffd56a;
    text-decoration: underline;
}

/* Модалки документов */
.auth-page .auth-doc-modal__panel {
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 540px) {
    .auth-container {
        max-width: 480px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg__aurora,
    .auth-bg__orb,
    .auth-logo,
    .auth-card {
        animation: none !important;
    }

    .auth-page .btn-primary.btn-block::after {
        display: none;
    }
}
