:root {
    --login-bg-start: #f7f7fc;
    --login-bg-end: #f0f3ff;
    --login-accent: #16161f;
    --login-muted: #666a7a;
    --login-border: #e5e8f5;
    --login-success: #1f8f4c;
    --login-error: #d73b4a;
    --crowd-shadow: rgba(20, 20, 35, 0.14);
}

.login-shell {
    display: flex;
    justify-content: center;
    padding: 1.2rem 0;
}

.login-card {
    width: 100%;
    max-width: 960px;
    background: linear-gradient(145deg, var(--login-bg-start), var(--login-bg-end));
    border: 1px solid var(--login-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 45px rgba(20, 24, 40, 0.13);
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 460px;
}

.crowd-panel {
    --look-x: 0px;
    --look-y: 0px;
    position: relative;
    background: radial-gradient(circle at 22% 18%, #ffffff 0%, #f5f2ff 45%, #ececff 100%);
    padding: 2rem 1.4rem 1.2rem;
    overflow: hidden;
}

.crowd-panel::before,
.crowd-panel::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.crowd-panel::before {
    width: 220px;
    height: 220px;
    top: -95px;
    left: -80px;
    background: rgba(123, 85, 255, 0.12);
}

.crowd-panel::after {
    width: 180px;
    height: 180px;
    right: -60px;
    bottom: -70px;
    background: rgba(255, 168, 0, 0.14);
}

.crowd-label {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(20, 20, 35, 0.08);
    color: #3d4156;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
}

.crowd-character {
    position: absolute;
    bottom: 1rem;
    box-shadow: 0 14px 26px var(--crowd-shadow);
    animation: crowd-idle 3.6s ease-in-out infinite;
    transform-origin: 50% 100%;
    transition: transform 220ms ease, filter 220ms ease;
}

.crowd-character::after {
    content: "";
    position: absolute;
    inset: 22% 22% auto;
    height: 34%;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 180ms ease, transform 180ms ease;
}

.char-purple {
    --face-top: 12%;
    --eye-scale: 1;
    width: 106px;
    height: 178px;
    left: 5.4rem;
    border-radius: 26px 30px 18px 16px;
    transform: rotate(-5deg);
    background: linear-gradient(160deg, #9370ff 0%, #5c38ef 100%);
    animation-delay: 0s;
    z-index: 2;
}

.char-black {
    --face-top: 15%;
    --eye-scale: 0.85;
    width: 68px;
    height: 116px;
    left: 9.2rem;
    border-radius: 14px 18px 22px 12px;
    transform: rotate(3deg);
    background: linear-gradient(165deg, #3d4155 0%, #191c2a 100%);
    animation-delay: 0.5s;
    z-index: 3;
}

.char-black .eye {
    width: 14px;
    height: 14px;
}

.char-black .eye.left {
    left: 14%;
}

.char-black .eye.right {
    right: 14%;
}

.char-black .pupil {
    width: 6px;
    height: 6px;
}

.crowd-panel.password-mode .char-black .eye {
    width: 16px;
    height: 4px;
}

.char-yellow .eye.left {
    left: 16%;
}

.char-yellow .eye.right {
    right: 16%;
}

.crowd-panel.password-mode .char-yellow .eye {
    width: 16px;
    height: 4px;
}

.char-orange {
    --face-top: 34%;
    --eye-scale: 1.25;
    width: 142px;
    height: 100px;
    left: 2rem;
    border-radius: 999px 999px 24px 24px;
    transform: rotate(0deg);
    background: linear-gradient(160deg, #ffb347 0%, #ff7c12 100%);
    animation-delay: 1s;
    z-index: 4;
}

.char-yellow {
    --face-top: 30%;
    --eye-scale: 1.1;
    width: 88px;
    height: 136px;
    right: 2.6rem;
    border-radius: 88px 88px 26px 26px;
    transform: rotate(4deg);
    background: linear-gradient(160deg, #ffe05a 0%, #f8b800 100%);
    animation-delay: 1.3s;
    z-index: 1;
}

.eye {
    position: absolute;
    top: var(--face-top);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.eye.left {
    left: 28%;
}

.eye.right {
    right: 28%;
}

.pupil {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #11141b;
    transform: translate(
        calc(var(--look-x) * var(--eye-scale)),
        calc(var(--look-y) * var(--eye-scale))
    );
    transition: transform 90ms linear, opacity 120ms ease;
}

.brow {
    position: absolute;
    top: calc(var(--face-top) - 10%);
    width: 17px;
    height: 4px;
    border-radius: 999px;
    background: rgba(17, 20, 27, 0.5);
    transition: transform 200ms ease, opacity 180ms ease;
}

.brow.left {
    left: 27%;
}

.brow.right {
    right: 27%;
}

.mouth {
    position: absolute;
    top: calc(var(--face-top) + 21%);
    left: 50%;
    width: 22px;
    height: 10px;
    border-bottom: 3.5px solid rgba(17, 20, 27, 0.4);
    border-radius: 0 0 22px 22px;
    transform: translateX(-50%);
    transition: all 200ms ease, opacity 180ms ease;
}

.eye {
    transition: opacity 180ms ease, background 180ms ease, border-color 180ms ease,
        width 180ms ease, height 180ms ease, transform 180ms ease;
}

.crowd-panel.is-thinking .crowd-character {
    animation-duration: 2.2s;
}

.crowd-panel.password-mode .crowd-character {
    transform: rotate(-12deg);
    filter: none;
}

.crowd-panel.password-mode .char-purple {
    transform: rotate(-12deg);
}

.crowd-panel.password-mode .char-black {
    transform: rotate(-10deg);
}

.crowd-panel.password-mode .char-orange {
    transform: rotate(-8deg);
}

.crowd-panel.password-mode .char-yellow {
    transform: rotate(-10deg);
}

.crowd-panel.password-mode .brow,
.crowd-panel.password-mode .mouth {
    opacity: 0;
}

.crowd-panel.password-mode .eye {
    opacity: 1;
    width: 22px;
    height: 4px;
    background: transparent;
    border-top: 4px solid rgba(17, 20, 27, 0.55);
    border-radius: 999px;
    transform: translateY(4px);
}

.crowd-panel.password-mode .pupil {
    opacity: 0;
}

.crowd-panel.login-failed .brow.left {
    transform: rotate(22deg) translateY(2px);
}

.crowd-panel.login-failed .brow.right {
    transform: rotate(-22deg) translateY(2px);
}

.crowd-panel.login-failed .mouth {
    border-bottom: 0;
    border-top: 3.5px solid rgba(17, 20, 27, 0.45);
    border-radius: 18px 18px 0 0;
    top: calc(var(--face-top) + 24%);
}

.crowd-tip {
    position: absolute;
    left: 1.5rem;
    bottom: 0.8rem;
    right: 1.5rem;
    margin: 0;
    color: #5f6477;
    font-size: 0.9rem;
    line-height: 1.5;
}

.login-panel {
    background: #ffffff;
    padding: 2.1rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-panel h2 {
    margin-bottom: 0.45rem;
    font-size: 2rem;
    color: var(--login-accent);
    letter-spacing: 0.01em;
}

.login-subtitle {
    color: var(--login-muted);
    margin-bottom: 1.4rem;
}

#login-form .form-label {
    color: #3f4459;
    font-weight: 600;
}

#login-form .form-control {
    border-radius: 10px;
    border: 1px solid #d6dbe9;
    padding: 0.62rem 0.78rem;
}

#login-form .form-control:focus {
    border-color: #8a7fff;
    box-shadow: 0 0 0 0.2rem rgba(138, 127, 255, 0.18);
}

.btn-login {
    margin-top: 0.35rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, #1f1f2e 0%, #0d0d14 100%);
    color: #fff;
    font-weight: 700;
    padding: 0.7rem 1rem;
}

.btn-login:hover,
.btn-login:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(21, 19, 34, 0.26);
}

.login-feedback {
    min-height: 1.5rem;
    margin-top: 0.95rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    color: #4f5672;
}

.login-feedback.is-loading {
    color: #3a4f8f;
}

.login-feedback.is-success {
    color: var(--login-success);
}

.login-feedback.is-error {
    color: var(--login-error);
    font-weight: 600;
}

.register-hint {
    margin: 0;
    color: #666d86;
}

.register-hint a {
    color: #6658e8;
    text-decoration: none;
}

.register-hint a:hover {
    text-decoration: underline;
}

@keyframes crowd-idle {
    0%,
    100% {
        translate: 0 0;
    }
    50% {
        translate: 0 -4px;
    }
}

@media (max-width: 992px) {
    .login-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .crowd-panel {
        min-height: 310px;
    }

    .login-panel {
        padding: 1.5rem 1.3rem;
    }
}

@media (max-width: 576px) {
    .login-shell {
        padding-top: 0.4rem;
    }

    .crowd-tip {
        font-size: 0.82rem;
    }

    .char-purple {
        left: 1.2rem;
    }

    .char-black {
        left: 7.6rem;
    }

    .char-yellow {
        right: 1.2rem;
    }
}
