:root {
    color-scheme: dark;
    --login-gold: #f5cf70;
    --parallax-x: 0px;
    --parallax-y: 0px;
}

html,
body.login-page--animated {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    background: #170b0c;
}

body.login-page--animated {
    position: relative;
    display: block;
    isolation: isolate;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.login-scene,
.login-scene__backdrop,
.login-scene__sun-glow,
.login-scene__mist,
.login-scene__particles,
.login-scene__vignette {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.login-scene {
    z-index: 0;
    overflow: hidden;
    background: #170b0c;
}

.login-scene__backdrop {
    display: block;
    inset: -4%;
    width: 108%;
    height: 108%;
    background: url("/img/login-background.jpg") center center / cover no-repeat;
    filter: saturate(1.06) contrast(1.04) brightness(0.82);
    transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(1.055);
    animation: login-scene-breathe 16s ease-in-out infinite alternate;
    will-change: transform, filter;
}

.login-enhanced .login-scene__backdrop {
    inset: 0;
    width: 100%;
    height: 100%;
    animation: none;
    transform: none;
}

.login-scene__sun-glow {
    z-index: 1;
    left: 40%;
    top: -22%;
    width: 52%;
    height: 72%;
    background: radial-gradient(circle, rgba(255, 229, 151, 0.38) 0%, rgba(255, 149, 55, 0.15) 31%, rgba(255, 104, 38, 0) 70%);
    mix-blend-mode: screen;
    filter: blur(14px);
    animation: login-sun-pulse 5.5s ease-in-out infinite;
}

.login-scene__mist {
    z-index: 2;
    inset: auto -20% -18% -20%;
    width: 140%;
    height: 56%;
    opacity: 0.5;
    filter: blur(25px);
    background:
        radial-gradient(ellipse at 16% 60%, rgba(255, 226, 190, 0.28) 0%, rgba(255, 212, 177, 0) 54%),
        radial-gradient(ellipse at 54% 72%, rgba(255, 224, 195, 0.23) 0%, rgba(255, 202, 168, 0) 58%),
        radial-gradient(ellipse at 88% 62%, rgba(220, 223, 229, 0.21) 0%, rgba(210, 213, 224, 0) 52%);
    will-change: transform, opacity;
}

.login-scene__mist--far {
    animation: login-mist-far 16s ease-in-out infinite alternate;
}

.login-scene__mist--near {
    z-index: 4;
    bottom: -29%;
    opacity: 0.36;
    transform: scale(1.18);
    animation: login-mist-near 11s ease-in-out infinite alternate-reverse;
}

.login-scene__particles {
    z-index: 3;
}

.login-scene__vignette {
    z-index: 5;
    background:
        linear-gradient(90deg, rgba(24, 8, 10, 0.16) 0%, transparent 30%, transparent 66%, rgba(18, 7, 10, 0.3) 100%),
        linear-gradient(180deg, rgba(12, 6, 9, 0.26) 0%, transparent 24%, transparent 68%, rgba(10, 5, 7, 0.68) 100%),
        radial-gradient(ellipse at center, transparent 44%, rgba(10, 4, 6, 0.35) 100%);
}

.login-shell {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    padding: 28px 24px 28px clamp(170px, 24vw, 430px);
}

body.login-page--animated .login-card-modal {
    position: relative;
    z-index: 1;
    width: min(354px, calc(100vw - 32px));
    max-width: none;
    margin: 0;
    box-sizing: border-box;
    padding: 34px 32px 25px;
    overflow: visible;
    border: 1px solid rgba(255, 218, 128, 0.6);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 226, 145, 0.1), transparent 24%),
        linear-gradient(180deg, rgba(32, 23, 28, 0.93), rgba(14, 12, 18, 0.95));
    box-shadow:
        0 22px 70px rgba(0, 0, 0, 0.68),
        0 0 0 4px rgba(57, 34, 24, 0.64),
        0 0 0 5px rgba(230, 177, 72, 0.2),
        inset 0 1px 0 rgba(255, 241, 190, 0.16),
        inset 0 0 38px rgba(121, 52, 28, 0.18);
    backdrop-filter: blur(12px) saturate(1.12);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
    animation: login-card-arrive 720ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
}

body.login-page--animated .login-card-modal::before,
body.login-page--animated .login-card-modal::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(250, 207, 103, 0.7), transparent);
}

body.login-page--animated .login-card-modal::before { top: 9px; }
body.login-page--animated .login-card-modal::after { bottom: 9px; }

.login-card-crest {
    position: absolute;
    top: -17px;
    left: 50%;
    width: 58px;
    height: 32px;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 219, 126, 0.72);
    border-radius: 50% 50% 42% 42%;
    background: linear-gradient(180deg, #3d2120, #171219);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.56), inset 0 0 10px rgba(205, 115, 42, 0.22);
}

.login-card-crest::before,
.login-card-crest::after,
.login-card-crest span {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(244, 201, 100, 0.78);
    transform: translate(-50%, -50%) rotate(45deg);
}

.login-card-crest::before { width: 15px; height: 15px; }

.login-card-crest::after {
    width: 8px;
    height: 8px;
    background: #9f3b26;
    box-shadow: 0 0 10px rgba(246, 139, 61, 0.72);
}

.login-card-crest span {
    width: 27px;
    height: 27px;
    border-color: rgba(208, 142, 57, 0.34);
}

.login-card-kicker {
    margin: 0 0 5px;
    color: #c69e61;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-align: center;
    text-transform: uppercase;
}

body.login-page--animated .login-card-title {
    margin: 0;
    color: var(--login-gold);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(25px, 3vw, 31px);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 2px 0 #3c1d13, 0 0 17px rgba(255, 177, 70, 0.4);
}

.login-card-subtitle {
    margin: 7px 0 23px;
    color: #bcb1a7;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-align: center;
}

body.login-page--animated .login-error-msg {
    margin: -8px 0 16px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 111, 89, 0.56);
    border-radius: 4px;
    background: rgba(98, 20, 20, 0.45);
    color: #ffd0c7;
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

body.login-page--animated .input-group { margin-bottom: 15px; }

body.login-page--animated .input-label {
    display: block;
    margin: 0 0 6px;
    color: #e0cda8;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.input-frame { position: relative; }

body.login-page--animated .custom-input {
    display: block;
    width: 100%;
    height: 43px;
    box-sizing: border-box;
    padding: 0 13px 0 42px;
    border: 1px solid rgba(209, 166, 89, 0.35);
    border-radius: 4px;
    outline: none;
    background: rgba(5, 7, 11, 0.72);
    color: #fff9ea;
    font-family: inherit;
    font-size: 13px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.48);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

body.login-page--animated .custom-input::placeholder { color: #776e69; }

body.login-page--animated .custom-input:focus {
    border-color: rgba(255, 207, 100, 0.86);
    background: rgba(9, 9, 13, 0.84);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.42), 0 0 0 2px rgba(226, 151, 49, 0.14), 0 0 16px rgba(226, 131, 44, 0.16);
}

.input-icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 15px;
    width: 13px;
    height: 13px;
    border: 1px solid #bd8d4c;
    transform: translateY(-50%);
    opacity: 0.8;
}

.input-icon--user { border-radius: 50%; }

.input-icon--user::after {
    content: "";
    position: absolute;
    left: -4px;
    bottom: -8px;
    width: 19px;
    height: 10px;
    border: 1px solid #bd8d4c;
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
}

.input-icon--lock {
    top: calc(50% + 3px);
    height: 11px;
    border-radius: 2px;
}

.input-icon--lock::before {
    content: "";
    position: absolute;
    left: 2px;
    top: -8px;
    width: 7px;
    height: 8px;
    border: 1px solid #bd8d4c;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

body.login-page--animated .btn-submit {
    position: relative;
    width: 100%;
    height: 45px;
    margin-top: 4px;
    padding: 0 18px;
    overflow: hidden;
    border: 1px solid #f0c86b;
    border-radius: 4px;
    background: linear-gradient(180deg, #b7432c 0%, #822319 48%, #5a1515 100%);
    color: #fff3cf;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-shadow: 0 1px 2px #3b0808;
    box-shadow: inset 0 1px 0 rgba(255, 237, 176, 0.25), 0 5px 15px rgba(0, 0, 0, 0.42), 0 0 14px rgba(180, 73, 28, 0.22);
    cursor: pointer;
    transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

body.login-page--animated .btn-submit:hover,
body.login-page--animated .btn-submit:focus-visible {
    filter: brightness(1.12) saturate(1.06);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 237, 176, 0.34), 0 7px 20px rgba(0, 0, 0, 0.5), 0 0 19px rgba(228, 121, 45, 0.32);
}

body.login-page--animated .btn-submit:active { transform: translateY(1px); }

.btn-submit__shine {
    position: absolute;
    top: -65%;
    left: -45%;
    width: 25%;
    height: 230%;
    background: linear-gradient(90deg, transparent, rgba(255, 244, 204, 0.42), transparent);
    transform: rotate(20deg);
    animation: login-button-shine 4.8s ease-in-out infinite;
}

.btn-submit__text { position: relative; z-index: 1; }
.btn-submit.is-loading { cursor: wait; filter: saturate(0.78); }

.login-card-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0 10px;
}

.login-card-divider::before,
.login-card-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(191, 143, 68, 0.48));
}

.login-card-divider::after { transform: scaleX(-1); }

.login-card-divider span {
    width: 5px;
    height: 5px;
    border: 1px solid rgba(230, 185, 92, 0.72);
    transform: rotate(45deg);
}

body.login-page--animated .login-footer-info {
    display: block;
    margin: 0;
    color: #b99a68;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 150ms ease, text-shadow 150ms ease;
}

body.login-page--animated .login-footer-info:hover,
body.login-page--animated .login-footer-info:focus-visible {
    color: #f5cf70;
    outline: none;
    text-shadow: 0 0 10px rgba(245, 207, 112, 0.42);
}

.login-motion-toggle {
    position: fixed;
    z-index: 30;
    right: 16px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid rgba(231, 188, 103, 0.34);
    border-radius: 999px;
    outline: none;
    background: rgba(14, 10, 15, 0.64);
    color: rgba(239, 215, 172, 0.78);
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.04em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.login-motion-toggle:hover,
.login-motion-toggle:focus-visible {
    border-color: rgba(245, 207, 112, 0.7);
    background: rgba(30, 18, 20, 0.82);
    color: #f5cf70;
}

.login-motion-toggle__icon {
    min-width: 10px;
    color: #d9a84d;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
}

.login-motion-paused .login-scene__sun-glow,
.login-motion-paused .login-scene__mist,
.login-motion-paused .btn-submit__shine {
    animation-play-state: paused !important;
}

@keyframes login-scene-breathe {
    0% {
        filter: saturate(1.03) contrast(1.03) brightness(0.79);
        transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(1.055);
    }
    100% {
        filter: saturate(1.11) contrast(1.05) brightness(0.86);
        transform: translate3d(calc(var(--parallax-x) - 7px), calc(var(--parallax-y) - 3px), 0) scale(1.075);
    }
}

@keyframes login-sun-pulse {
    0%, 100% { opacity: 0.7; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1.07); }
}

@keyframes login-mist-far {
    0% { opacity: 0.3; transform: translate3d(-8%, 2%, 0) scale(1); }
    100% { opacity: 0.58; transform: translate3d(9%, -5%, 0) scale(1.08); }
}

@keyframes login-mist-near {
    0% { opacity: 0.24; transform: translate3d(9%, 5%, 0) scale(1.18); }
    100% { opacity: 0.46; transform: translate3d(-8%, -3%, 0) scale(1.26); }
}

@keyframes login-card-arrive {
    0% { opacity: 0; transform: translate3d(0, 20px, 0) scale(0.975); }
    100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes login-button-shine {
    0%, 67% { left: -45%; opacity: 0; }
    72% { opacity: 1; }
    88%, 100% { left: 130%; opacity: 0; }
}

@media (max-width: 760px) {
    html,
    body.login-page--animated {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .login-scene__backdrop {
        background-position: 55% center;
        filter: saturate(1.02) contrast(1.04) brightness(0.63);
    }

    .login-scene__vignette { background: rgba(14, 7, 9, 0.38); }

    .login-shell {
        min-height: 100svh;
        padding: 38px 16px 30px;
    }

    body.login-page--animated .login-card-modal {
        padding: 32px 25px 23px;
        background:
            linear-gradient(135deg, rgba(255, 226, 145, 0.09), transparent 24%),
            linear-gradient(180deg, rgba(32, 23, 28, 0.94), rgba(14, 12, 18, 0.97));
    }
}

@media (max-height: 620px) and (min-width: 761px) {
    .login-shell { padding-top: 20px; padding-bottom: 20px; }
    body.login-page--animated .login-card-modal { padding-top: 28px; padding-bottom: 19px; }
    .login-card-subtitle { margin-bottom: 15px; }
    body.login-page--animated .input-group { margin-bottom: 11px; }
    .login-card-divider { margin-top: 14px; }
}

@media (max-width: 520px) {
    .login-motion-toggle {
        right: 10px;
        bottom: 9px;
        padding: 7px 9px;
    }

    .login-motion-toggle__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}
