:root {
    --bg: #f4f2ff;
    --card: #ffffff;
    --ink: #17163a;
    --mute: #777594;
    --line: #dedbf3;
    --accent: #5b4bff;
    --ok: #12a58a;
    --err: #d6336c;
    --blob1: #b7acff;
    --blob2: #8fe9d6;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    overflow-x: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: "Bricolage Grotesque", system-ui, sans-serif;
}

button,
input {
    font: inherit;
}

.blob {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
    animation: drift 14s ease-in-out infinite alternate;
}

.b1 {
    width: 380px;
    height: 380px;
    background: var(--blob1);
    top: -100px;
    left: -90px;
}

.b2 {
    width: 340px;
    height: 340px;
    background: var(--blob2);
    right: -80px;
    bottom: -110px;
    animation-delay: -6s;
}

@keyframes drift {
    to {
        transform: translate(50px, 40px) scale(1.12);
    }
}

.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

.login-card {
    width: 100%;
    padding: 30px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: 0 30px 70px -35px rgba(40, 30, 140, 0.4);
    animation: rise 0.7s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(24px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    20%, 60% { transform: translateX(-7px); }
    40%, 80% { transform: translateX(7px); }
}

.login-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.login-brand img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 70px;
    object-fit: contain;
}

.login-brand .logo-light {
    display: none;
}

.mascot {
    display: block;
    width: 112px;
    height: 86px;
    margin: 0 auto 10px;
    overflow: hidden;
}

.mascot .eye {
    fill: #fff;
    stroke: var(--line);
    stroke-width: 2;
}

.mascot .pupil {
    fill: #17163a;
    transition: transform 0.08s linear;
}

.mascot .body {
    fill: var(--accent);
}

.mascot .hand {
    fill: var(--accent);
    stroke: var(--card);
    stroke-width: 3;
    transition: transform 0.4s cubic-bezier(.3, 1.4, .5, 1);
}

.mascot .hand.l,
.mascot .hand.r {
    transform: translateY(70px);
}

.mascot.cover .hand {
    transform: translateY(0);
}

.login-title {
    margin: 7px 0 5px;
    text-align: center;
    font-size: 29px;
    font-weight: 800;
    letter-spacing: -0.7px;
    color: var(--ink);
}

.login-subtitle {
    margin: 0 0 25px;
    text-align: center;
    color: var(--mute);
    font-size: 14px;
    line-height: 1.6;
}

.login-field {
    position: relative;
    margin-bottom: 17px;
}

.login-field input {
    display: block;
    width: 100%;
    height: 56px;
    padding: 20px 48px 6px 15px;
    color: var(--ink);
    font-family: inherit;
    font-size: 15px;
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    outline: none;
    box-shadow: none;
    transition: border-color .2s, box-shadow .2s;
}

.login-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(91, 75, 255, 0.12);
}

.login-field label {
    position: absolute;
    top: 17px;
    left: 15px;
    z-index: 1;
    color: var(--mute);
    font-size: 15px;
    pointer-events: none;
    transform-origin: left;
    transition: all .2s ease;
}

.login-field input:focus + label,
.login-field input:not(:placeholder-shown) + label {
    top: 6px;
    font-size: 11px;
    color: var(--accent);
}

.login-field.has-error input,
.login-field input.is-invalid {
    border-color: var(--err);
}

.login-error {
    display: block;
    margin-top: 5px;
    color: var(--err);
    font-size: 12px;
    line-height: 1.4;
}

.login-field .login-error:empty {
    display: none;
}

.password-toggle {
    position: absolute;
    top: 10px;
    right: 7px;
    z-index: 2;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    color: var(--mute);
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--accent);
    background: rgba(91, 75, 255, 0.07);
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 3px 0 22px;
    color: var(--mute);
    font-size: 13px;
}

.remember-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.remember-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.login-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}

.login-button {
    position: relative;
    display: block;
    width: 100%;
    height: 53px;
    padding: 0 16px;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: transform .15s, filter .2s, background .2s;
}

.login-button:hover {
    filter: brightness(1.08);
}

.login-button:active {
    transform: scale(.985);
}

.login-button:disabled {
    cursor: wait;
    opacity: .8;
}

.login-button .button-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rotate .7s linear infinite;
}

.login-button.loading .button-text {
    visibility: hidden;
}

.login-button.loading .button-spinner {
    display: block;
}

@keyframes rotate {
    to { transform: rotate(360deg); }
}

.login-footer {
    margin: 22px 0 0;
    color: var(--mute);
    text-align: center;
    font-size: 12px;
}

.login-footer strong {
    color: var(--ink);
    font-weight: 600;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(91, 75, 255, .5);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .login-card {
        padding: 25px 20px;
        border-radius: 22px;
    }

    .login-brand img {
        height: 62px;
    }

    .login-title {
        font-size: 26px;
    }

    .login-subtitle {
        margin-bottom: 22px;
    }

    .b1 {
        width: 260px;
        height: 260px;
    }

    .b2 {
        width: 240px;
        height: 240px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}