*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    background: #000;
}

body {
    width: 100%;
    min-height: 100%;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: 0;
    transition: background 2s cubic-bezier(0.4, 0, 0.2, 1), transform 2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, background;
}

.blob-1 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(120, 80, 255, 0.35) 0%, rgba(0, 150, 255, 0.12) 40%, transparent 70%);
    top: -180px;
    left: -180px;
    animation: float1 22s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.blob-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 80, 180, 0.25) 0%, rgba(255, 150, 50, 0.08) 40%, transparent 70%);
    bottom: -200px;
    right: -160px;
    animation: float2 26s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.blob-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(60, 130, 255, 0.2) 0%, rgba(100, 60, 200, 0.08) 45%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float3 30s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

@keyframes float1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(55px, -45px) scale(1.08); }
    66% { transform: translate(-25px, 35px) scale(0.94); }
}

@keyframes float2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-45px, 35px) scale(1.06); }
    66% { transform: translate(35px, -25px) scale(0.93); }
}

@keyframes float3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    33% { transform: translate(-45%, -55%) scale(1.06); }
    66% { transform: translate(-55%, -48%) scale(0.95); }
}

.preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease;
}

.preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.preloader__logo {
    width: 160px;
    height: 160px;
    object-fit: contain;
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

.preloader-bottom {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0 40px;
}

.preloader-label {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

.progress-bar {
    width: 100%;
    max-width: 280px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #7c8aff, #a78bfa, #6ee7b7);
    transition: width 0.3s ease;
}

.preloader-version {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.3px;
}

.auth-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.shared-logo {
    width: 112px;
    height: 112px;
    object-fit: contain;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(-40px) scale(0);
    filter: drop-shadow(0 6px 24px rgba(255, 255, 255, 0.2));
    transition: opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
    flex-shrink: 0;
}

body.loaded .shared-logo {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.form-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

body.loaded .form-title {
    opacity: 1;
    transform: translateY(0);
}

.auth-form {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.auth-form.active,
.auth-form.entering,
.auth-form.exiting {
    display: flex;
}

.glass-input,
.glass-button {
    position: relative;
    width: 100%;
    height: 58px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -1px 1px rgba(255, 255, 255, 0.08),
        inset 0 0 24px rgba(255, 255, 255, 0.03),
        0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    will-change: transform, opacity;
    opacity: 0;
    transform: translateY(40px) scale(0.85);
    transition-property: opacity, transform;
    transition-duration: 0.55s;
    transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-form.active .glass-input,
.auth-form.active .glass-button,
.auth-form.active .glass-checkbox {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.auth-form.entering .glass-input,
.auth-form.entering .glass-button,
.auth-form.entering .glass-checkbox {
    opacity: 0;
    transform: translateY(40px) scale(0.85);
    transition: none;
}

.auth-form.exiting .glass-input,
.auth-form.exiting .glass-button,
.auth-form.exiting .glass-checkbox {
    opacity: 0;
    transform: translateY(-30px) scale(0.4);
    transition-duration: 0.5s;
    transition-timing-function: cubic-bezier(0.55, 0.085, 0.68, 0.53);
}

.glass-input::before,
.glass-button::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.08) 45%, rgba(255,255,255,0.22) 50%, rgba(255,255,255,0.08) 55%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.8s ease;
    pointer-events: none;
}

.glass-input:hover::before,
.glass-button:hover::before {
    transform: translateX(100%);
}

.glass-input {
    display: flex;
    align-items: center;
}

.glass-input input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 18px 24px 6px 24px;
    color: #fff;
    font-size: 16px;
    font-weight: 400;
    position: relative;
    z-index: 2;
    caret-color: #a0b0ff;
    user-select: text;
    -webkit-user-select: text;
    color-scheme: dark;
}

.glass-input label {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 1;
}

.glass-input input:focus + label,
.glass-input input:not(:placeholder-shown) + label {
    top: 12px;
    font-size: 11px;
    color: rgba(180, 200, 255, 0.9);
    letter-spacing: 0.3px;
}

.glass-input:focus-within {
    border-color: rgba(140, 170, 255, 0.5);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), inset 0 -1px 1px rgba(255,255,255,0.08), 0 8px 32px rgba(120,140,255,0.3);
}

.glass-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    opacity: 0;
    transform: translateY(40px) scale(0.85);
    transition: opacity 0.55s cubic-bezier(0.34,1.56,0.64,1), transform 0.55s cubic-bezier(0.34,1.56,0.64,1), background 0.3s ease, border-color 0.3s ease;
}

.glass-checkbox input {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.checkmark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.glass-checkbox input:checked + .checkmark {
    background: rgba(60, 200, 120, 0.8);
    border-color: rgba(60, 200, 120, 0.9);
}

.glass-checkbox input:checked + .checkmark::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
}

.glass-button {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.4px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), inset 0 -1px 1px rgba(0,0,0,0.05), 0 8px 32px rgba(0,0,0,0.4);
}

.glass-button span {
    position: relative;
    z-index: 2;
    color: #1a1a1a;
    transition: color 0.35s ease, text-shadow 0.35s ease;
}

.glass-button.secondary.green {
    background: rgba(60, 200, 120, 0.9);
    border-color: rgba(80, 220, 140, 0.7);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.4), inset 0 -1px 1px rgba(0,0,0,0.1), 0 8px 32px rgba(60,200,120,0.4), 0 0 20px rgba(60,200,120,0.2);
    cursor: pointer;
}

.glass-button.secondary.green span {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.glass-button.secondary.green:hover {
    background: rgba(80, 220, 140, 0.98);
}

.glass-button.secondary.green:active {
    transform: scale(0.97);
}

.glass-button.secondary.green.disabled {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.95);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.6), inset 0 -1px 1px rgba(0,0,0,0.05), 0 8px 32px rgba(0,0,0,0.4);
    cursor: default;
}

.glass-button.secondary.green.disabled span {
    color: #1a1a1a;
    text-shadow: none;
}

.glass-input.error {
    border-color: rgba(255, 90, 110, 0.6) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.35), inset 0 -1px 1px rgba(255,255,255,0.08), 0 8px 32px rgba(255,90,110,0.3) !important;
}

.glass-input.error label {
    color: rgba(255, 120, 130, 0.9) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.glass-button.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 300px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-title {
    padding: 20px 24px 16px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    color: #fff;
}

.modal-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 16px;
}

.modal-message {
    padding: 16px 24px;
    font-size: 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

.modal-btn {
    width: calc(100% - 32px);
    margin: 16px;
    height: 48px;
    border-radius: 999px;
    border: none;
    background: rgba(60, 200, 120, 0.9);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.modal-btn:hover {
    background: rgba(80, 220, 140, 0.98);
}

.modal-btn:active {
    transform: scale(0.96);
}

@media (max-width: 420px) {
    .auth-stage { max-width: 100%; }
    .glass-input, .glass-button { height: 54px; }
    .shared-logo { width: 96px; height: 96px; }
    .blob-1 { width: 480px; height: 480px; }
    .blob-2 { width: 420px; height: 420px; }
    .blob-3 { width: 320px; height: 320px; }
}