* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --theme-bg-1: #0b1220;
    --theme-bg-2: #0f172a;
    --theme-bg-3: #1d2f57;
    --theme-btn-border: rgba(129, 140, 248, 0.45);
    --accent: #818cf8;
    --accent-soft: #6366f1;
    --accent-deep: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.5);
    --ink: #03070e;
    --ink-2: #07111f;
    --white-soft: rgba(240, 249, 255, 0.85);
}

body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 18% -10%, var(--theme-bg-3) 0%, var(--theme-bg-2) 42%, var(--theme-bg-1) 100%);
    color: #fff;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(129, 140, 248, 0.05) 0,
            rgba(129, 140, 248, 0.05) 1px,
            transparent 1px,
            transparent 28px
        );
    pointer-events: none;
}

.auth-scene {
    width: min(980px, 88vw);
    aspect-ratio: 16 / 9;
    position: relative;
    transform: none;
}

.auth-frame {
    position: absolute;
    inset: 0;
    clip-path: none;
    border-radius: 14px;
    border: 2px solid rgba(129, 140, 248, 0.9);
    background: linear-gradient(135deg, rgba(5, 10, 20, 0.96) 0%, rgba(3, 7, 14, 0.97) 100%);
    box-shadow:
        0 0 16px rgba(99, 102, 241, 0.78),
        0 0 38px rgba(99, 102, 241, 0.42),
        inset 0 0 40px rgba(99, 102, 241, 0.16);
    overflow: hidden;
}

.accent-pane {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(129, 140, 248, 0.78) 0%, rgba(79, 70, 229, 0.72) 100%);
    clip-path: polygon(62% 0, 100% 0, 100% 100%, 78% 100%);
    transition: clip-path 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.dark-pane {
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(3, 7, 14, 0.8) 0%, rgba(2, 5, 12, 0.96) 65%);
    clip-path: polygon(0 0, 64% 0, 80% 100%, 0 100%);
    border-right: 2px solid rgba(129, 140, 248, 0.28);
    transition: clip-path 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.auth-frame.register-mode .accent-pane {
    clip-path: polygon(0 0, 38% 0, 22% 100%, 0 100%);
}

.auth-frame.register-mode .dark-pane {
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 36% 100%);
}

.welcome-copy {
    position: absolute;
    top: 50%;
    right: 14%;
    transform: translateY(-50%);
    text-align: center;
    letter-spacing: 0.03em;
    z-index: 2;
    transition: all 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.welcome-copy h2 {
    font-size: clamp(26px, 3vw, 44px);
    font-weight: 800;
    color: rgba(241, 255, 255, 0.98);
    text-transform: uppercase;
    text-shadow: 0 3px 18px rgba(0, 0, 0, 0.35);
    line-height: 1.08;
    margin-bottom: 8px;
}

.welcome-copy p {
    font-size: 14px;
    color: rgba(14, 45, 56, 0.9);
    font-weight: 600;
    max-width: 280px;
}

.auth-frame.register-mode .welcome-copy {
    right: auto;
    left: 12%;
}

.form-shell {
    position: absolute;
    top: 50%;
    left: 12%;
    width: min(390px, 40%);
    transform: translateY(-50%);
    z-index: 3;
    transition: all 0.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.auth-frame.register-mode .form-shell {
    left: auto;
    right: 12%;
}

.auth-form {
    width: 100%;
    opacity: 0;
    pointer-events: none;
    transform: translateX(12px);
    transition: all 0.35s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.auth-form.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    position: relative;
}

.auth-form h3 {
    font-size: clamp(28px, 3vw, 44px);
    font-weight: 800;
    margin-bottom: 20px;
    color: #f2f9ff;
}

.alert {
    display: none;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid transparent;
}

.alert.error {
    background: rgba(30, 163, 186, 0.14);
    border-color: rgba(57, 246, 255, 0.48);
    color: #bdf9ff;
}

.alert.success {
    background: rgba(24, 199, 223, 0.14);
    border-color: rgba(57, 246, 255, 0.55);
    color: #d9fdff;
}

.field {
    margin-bottom: 16px;
}

.field-line {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid rgba(129, 140, 248, 0.72);
    padding: 8px 0;
}

.field input,
.field select {
    width: 100%;
    border: none;
    background: transparent;
    color: #effbff;
    font-size: 16px;
    padding: 4px 0;
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #effbff;
    -webkit-box-shadow: 0 0 0 1000px transparent inset;
    transition: background-color 9999s ease-in-out 0s;
}

.field select option {
    background: #041020;
    color: #ebf8ff;
}

.field input::placeholder {
    color: rgba(186, 223, 232, 0.72);
}

.field input:focus,
.field select:focus {
    outline: none;
}

.field-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    opacity: 0.95;
}

.password-strength {
    margin-top: 8px;
    height: 4px;
    border-radius: 999px;
    background: rgba(147, 225, 244, 0.2);
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength.weak {
    width: 34%;
    background: var(--accent-deep);
}

.password-strength.medium {
    width: 67%;
    background: var(--accent-soft);
}

.password-strength.strong {
    width: 100%;
    background: var(--accent);
}

.btn-primary {
    width: 100%;
    margin-top: 8px;
    padding: 11px 16px;
    border: 1px solid var(--theme-btn-border);
    border-radius: 999px;
    background: radial-gradient(circle at 18% -10%, var(--theme-bg-3) 0%, var(--theme-bg-2) 42%, var(--theme-bg-1) 100%);
    color: #ffffff;
    font-size: 19px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 22px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.4);
}

.btn-primary:disabled {
    cursor: not-allowed;
    filter: saturate(0.8);
    box-shadow: none;
}

.btn-primary.loading {
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid #c7d2fe;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

.switch-copy {
    margin-top: 14px;
    text-align: center;
    font-size: 14px;
    color: var(--white-soft);
}

.switch-copy button {
    border: none;
    background: none;
    color: var(--accent);
    font-weight: 700;
    margin-left: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.switch-copy button:hover {
    color: #a5b4fc;
    text-shadow: 0 0 12px rgba(129, 140, 248, 0.35);
}

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

@media (max-width: 920px) {
    .auth-scene {
        width: 96vw;
        aspect-ratio: 1.45 / 1;
        transform: none;
    }

    .auth-frame {
        clip-path: none;
        border-radius: 14px;
    }

    .accent-pane,
    .dark-pane {
        clip-path: none !important;
    }

    .accent-pane {
        opacity: 0.26;
    }

    .dark-pane {
        border-right: none;
    }

    .welcome-copy,
    .auth-frame.register-mode .welcome-copy {
        left: 50%;
        right: auto;
        top: 16%;
        transform: translateX(-50%);
    }

    .form-shell,
    .auth-frame.register-mode .form-shell {
        left: 50%;
        right: auto;
        width: min(440px, 84%);
        top: 56%;
        transform: translate(-50%, -50%);
    }

    .welcome-copy p {
        display: none;
    }
}
