:root {
    color-scheme: dark;
    --red: #f01824;
    --red-bright: #ff3440;
    --ink: #07090c;
    --panel: rgba(13, 16, 21, 0.82);
    --text: #f7f8fa;
    --muted: #989fa9;
    --line: rgba(255, 255, 255, 0.1);
    --field: rgba(255, 255, 255, 0.045);
    --success: #51d995;
    --danger: #ff626b;
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--ink);
}

body {
    position: relative;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 15% 8%, rgba(240, 24, 36, 0.13), transparent 30%),
        radial-gradient(circle at 78% 92%, rgba(115, 10, 18, 0.18), transparent 34%),
        linear-gradient(135deg, #030405 0%, #0a0c10 48%, #050608 100%);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    transform: translateY(-160%);
    border-radius: 8px;
    color: #fff;
    background: var(--red);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 180ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.scene,
.scene__grid,
.scene__glow,
.scene__beam {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.scene {
    z-index: 0;
    overflow: hidden;
}

.scene::after {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 25%, rgba(0, 0, 0, 0.58) 100%);
    content: "";
}

.scene__grid {
    inset: -40%;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px);
    background-size: 58px 58px;
    transform: perspective(650px) rotateX(62deg) translateY(22%);
    transform-origin: center center;
    -webkit-mask-image: linear-gradient(to bottom, transparent 18%, #000 65%, transparent 92%);
    mask-image: linear-gradient(to bottom, transparent 18%, #000 65%, transparent 92%);
    animation: grid-drift 18s linear infinite;
}

.scene__glow {
    width: 42vw;
    height: 42vw;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.14;
}

.scene__glow--one {
    inset: -18vw auto auto -16vw;
    background: var(--red);
    animation: glow-pulse 9s ease-in-out infinite;
}

.scene__glow--two {
    inset: auto -19vw -22vw auto;
    background: #8f0711;
    animation: glow-pulse 11s ease-in-out 2s infinite reverse;
}

.scene__beam {
    top: -80%;
    left: 54%;
    width: 1px;
    height: 250%;
    opacity: 0.36;
    background: linear-gradient(to bottom, transparent 10%, var(--red) 45%, transparent 78%);
    box-shadow: 0 0 25px 4px rgba(240, 24, 36, 0.25);
    transform: rotate(24deg);
    transform-origin: center;
    animation: beam-scan 10s ease-in-out infinite alternate;
}

.scene__particle {
    position: absolute;
    z-index: 1;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--red-bright);
    box-shadow: 0 0 14px 3px rgba(240, 24, 36, 0.5);
    animation: particle-float 8s ease-in-out infinite;
}

.scene__particle--one {
    top: 18%;
    left: 9%;
}

.scene__particle--two {
    right: 10%;
    bottom: 18%;
    animation-delay: -3s;
}

.scene__particle--three {
    top: 68%;
    left: 46%;
    width: 3px;
    height: 3px;
    animation-delay: -5s;
}

.login-shell {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 0.9fr);
    width: min(1240px, calc(100% - 64px));
    min-height: 100vh;
    min-height: 100svh;
    margin: 0 auto;
}

.brand-panel,
.access-panel {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 54px;
}

.brand-panel {
    padding-left: 16px;
}

.brand-panel__content {
    width: min(650px, 100%);
}

.brand-mark {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(330px, 62%);
    margin: 0 0 48px;
    animation: reveal-up 750ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.brand-mark::before {
    position: absolute;
    inset: -20% -12%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(240, 24, 36, 0.16), transparent 68%);
    filter: blur(8px);
    content: "";
    animation: logo-breathe 5s ease-in-out infinite;
}

.brand-mark__halo {
    position: absolute;
    left: -5%;
    bottom: -25%;
    width: 110%;
    height: 1px;
    overflow: hidden;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

.brand-mark__halo::after {
    position: absolute;
    top: 0;
    left: -35%;
    width: 35%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
    box-shadow: 0 0 14px var(--red);
    content: "";
    animation: halo-run 4.8s ease-in-out 1.2s infinite;
}

.brand-mark__logo {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.48));
}

.brand-copy {
    animation: reveal-up 750ms cubic-bezier(0.2, 0.8, 0.2, 1) 100ms both;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 18px;
    color: #c5c9cf;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.eyebrow span {
    width: 34px;
    height: 2px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--red), var(--red-bright));
    box-shadow: 0 0 10px rgba(240, 24, 36, 0.55);
}

.brand-copy h1 {
    margin: 0;
    font-size: clamp(2.4rem, 4.6vw, 4.8rem);
    font-weight: 340;
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.brand-copy h1 strong {
    color: transparent;
    background: linear-gradient(105deg, #ffffff 8%, #d7d9dd 48%, #ffffff 76%);
    -webkit-background-clip: text;
    background-clip: text;
    font-weight: 760;
}

.brand-copy__description {
    max-width: 580px;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: clamp(0.98rem, 1.35vw, 1.08rem);
    line-height: 1.75;
}

.brand-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
    animation: reveal-up 750ms cubic-bezier(0.2, 0.8, 0.2, 1) 180ms both;
}

.brand-features span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: #afb4bc;
    background: rgba(255, 255, 255, 0.035);
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.05em;
}

.environment-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 42px;
    color: #777f89;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    animation: reveal-up 750ms cubic-bezier(0.2, 0.8, 0.2, 1) 260ms both;
}

.environment-status__signal {
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 11px rgba(81, 217, 149, 0.72);
}

.environment-status__signal::after {
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(81, 217, 149, 0.3);
    border-radius: 50%;
    content: "";
    animation: status-ring 2.4s ease-out infinite;
}

.access-panel {
    position: relative;
    justify-content: center;
}

.access-panel::before {
    position: absolute;
    top: 10%;
    bottom: 10%;
    left: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.12), transparent);
    content: "";
}

.access-panel__inner {
    width: min(440px, 100%);
    animation: card-arrive 850ms cubic-bezier(0.16, 1, 0.3, 1) 100ms both;
}

.login-card {
    position: relative;
    overflow: hidden;
    padding: clamp(30px, 4vw, 46px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 32%),
        var(--panel);
    box-shadow:
        0 34px 80px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(22px) saturate(130%);
    backdrop-filter: blur(22px) saturate(130%);
}

.login-card::after {
    position: absolute;
    right: -90px;
    bottom: -90px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(240, 24, 36, 0.07);
    filter: blur(18px);
    content: "";
    pointer-events: none;
}

.login-card__accent {
    position: absolute;
    top: -1px;
    left: 50%;
    width: 58%;
    height: 2px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
    box-shadow: 0 0 20px rgba(240, 24, 36, 0.62);
}

.login-header {
    position: relative;
    z-index: 1;
}

.access-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid rgba(240, 24, 36, 0.26);
    border-radius: 999px;
    color: #ff848b;
    background: rgba(240, 24, 36, 0.07);
    font-size: 0.69rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.access-label svg {
    width: 14px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.login-header h2 {
    margin: 25px 0 10px;
    font-size: clamp(1.8rem, 3vw, 2.35rem);
    font-weight: 720;
    letter-spacing: -0.04em;
}

.login-header > p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

#login-form {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 18px;
    margin-top: 32px;
}

.field {
    min-width: 0;
}

.field__control {
    position: relative;
}

.field__control input {
    display: block;
    width: 100%;
    height: 60px;
    padding: 21px 48px 8px 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    color: var(--text);
    background: var(--field);
    font-size: 0.96rem;
    font-weight: 560;
    caret-color: var(--red-bright);
    transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.field__control input:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.field__control input:focus {
    border-color: rgba(240, 24, 36, 0.62);
    background: rgba(255, 255, 255, 0.065);
    box-shadow: 0 0 0 4px rgba(240, 24, 36, 0.08), 0 12px 25px rgba(0, 0, 0, 0.14);
}

.field__control label {
    position: absolute;
    top: 50%;
    left: 50px;
    color: #858c96;
    font-size: 0.93rem;
    pointer-events: none;
    transform: translateY(-50%);
    transform-origin: left center;
    transition: top 160ms ease, color 160ms ease, font-size 160ms ease, transform 160ms ease;
}

.field__control input:focus + label,
.field__control input:not(:placeholder-shown) + label {
    top: 11px;
    color: #b4bac2;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    transform: translateY(0);
}

.field__control input:focus + label {
    color: #ff777f;
}

.field__icon {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 17px;
    width: 19px;
    height: 19px;
    fill: none;
    stroke: #747c87;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
    pointer-events: none;
    transform: translateY(-50%);
    transition: stroke 180ms ease, filter 180ms ease;
}

.field__control:focus-within .field__icon {
    stroke: var(--red-bright);
    filter: drop-shadow(0 0 5px rgba(240, 24, 36, 0.48));
}

.field__line {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: calc(100% - 24px);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--red-bright), transparent);
    opacity: 0;
    transform: translateX(-50%) scaleX(0.2);
    transition: opacity 180ms ease, transform 220ms ease;
}

.field__control:focus-within .field__line {
    opacity: 0.85;
    transform: translateX(-50%) scaleX(1);
}

.password-toggle {
    position: absolute;
    z-index: 3;
    top: 50%;
    right: 10px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #7f8791;
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 160ms ease, background 160ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    outline: none;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.password-toggle__hide,
.password-toggle.is-visible .password-toggle__show {
    display: none;
}

.password-toggle.is-visible .password-toggle__hide {
    display: block;
}

.field__message {
    display: none;
    margin: 7px 3px 0;
    color: var(--danger);
    font-size: 0.74rem;
}

.field.is-invalid .field__control input {
    border-color: rgba(255, 98, 107, 0.58);
}

.field.is-invalid .field__message {
    display: block;
}

.form-error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid rgba(255, 98, 107, 0.25);
    border-radius: 10px;
    color: #ff9da3;
    background: rgba(255, 60, 72, 0.075);
    font-size: 0.79rem;
    line-height: 1.45;
    animation: error-arrive 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.form-error svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.submit-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    width: 100%;
    height: 56px;
    margin-top: 2px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(110deg, #a70913 0%, var(--red) 48%, #ce101b 100%);
    box-shadow: 0 14px 34px rgba(196, 10, 21, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 760;
    letter-spacing: 0.015em;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.submit-button::before {
    position: absolute;
    top: -60%;
    left: -34%;
    width: 22%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    content: "";
    transform: rotate(18deg);
    transition: left 580ms ease;
}

.submit-button:hover {
    filter: brightness(1.08);
    box-shadow: 0 18px 42px rgba(216, 10, 23, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.26);
    transform: translateY(-2px);
}

.submit-button:hover::before {
    left: 112%;
}

.submit-button:active {
    transform: translateY(0) scale(0.99);
}

.submit-button:focus-visible {
    outline: 3px solid rgba(255, 52, 64, 0.32);
    outline-offset: 3px;
}

.submit-button__arrow {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
    transition: transform 180ms ease;
}

.submit-button:hover .submit-button__arrow {
    transform: translateX(3px);
}

.submit-button__loader {
    display: none;
    width: 19px;
    height: 19px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 650ms linear infinite;
}

.submit-button.is-loading {
    pointer-events: none;
}

.submit-button.is-loading .submit-button__label,
.submit-button.is-loading .submit-button__arrow {
    display: none;
}

.submit-button.is-loading .submit-button__loader {
    display: block;
}

.login-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 26px -10px 0;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    color: #68717c;
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    text-align: center;
}

.login-footer svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.copyright {
    margin: 22px 0 0;
    color: #515963;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-align: center;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px #16191e inset;
    transition: background-color 9999s ease-out;
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes card-arrive {
    from { opacity: 0; transform: translateY(24px) scale(0.975); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes error-arrive {
    0% { opacity: 0; transform: translateY(-5px); }
    65% { transform: translateX(2px); }
    100% { opacity: 1; transform: translate(0); }
}

@keyframes grid-drift {
    to { transform: perspective(650px) rotateX(62deg) translateY(calc(22% + 58px)); }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.1; transform: scale(0.9); }
    50% { opacity: 0.19; transform: scale(1.08); }
}

@keyframes beam-scan {
    from { transform: translateX(-8vw) rotate(24deg); opacity: 0.16; }
    to { transform: translateX(8vw) rotate(24deg); opacity: 0.38; }
}

@keyframes particle-float {
    0%, 100% { opacity: 0.2; transform: translateY(8px) scale(0.7); }
    50% { opacity: 0.85; transform: translateY(-16px) scale(1); }
}

@keyframes logo-breathe {
    0%, 100% { opacity: 0.55; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1.04); }
}

@keyframes halo-run {
    0%, 12% { left: -35%; opacity: 0; }
    24% { opacity: 1; }
    62%, 100% { left: 100%; opacity: 0; }
}

@keyframes status-ring {
    0% { opacity: 0.8; transform: scale(0.45); }
    80%, 100% { opacity: 0; transform: scale(1.45); }
}

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

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: minmax(0, 0.95fr) minmax(390px, 1.05fr);
        width: min(100% - 36px, 980px);
    }

    .brand-panel,
    .access-panel {
        padding: 38px;
    }

    .brand-panel {
        padding-left: 6px;
    }

    .brand-copy h1 {
        font-size: clamp(2.3rem, 5vw, 3.6rem);
    }
}

@media (max-width: 760px) {
    body {
        overflow-y: auto;
    }

    .login-shell {
        display: block;
        width: min(100% - 30px, 520px);
        padding: 34px 0 24px;
    }

    .brand-panel,
    .access-panel {
        display: block;
        padding: 0;
    }

    .brand-panel {
        text-align: center;
    }

    .brand-panel__content {
        width: 100%;
    }

    .brand-mark {
        width: min(230px, 57vw);
        margin-bottom: 26px;
    }

    .eyebrow {
        justify-content: center;
        margin-bottom: 12px;
    }

    .brand-copy h1 {
        font-size: clamp(2rem, 9vw, 3rem);
        line-height: 1.02;
    }

    .brand-copy__description {
        max-width: 430px;
        margin: 18px auto 0;
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .brand-features {
        justify-content: center;
        margin-top: 20px;
    }

    .environment-status {
        display: none;
    }

    .access-panel {
        margin-top: 30px;
    }

    .access-panel::before {
        display: none;
    }

    .login-card {
        border-radius: 20px;
    }

    .scene__beam {
        left: 70%;
    }
}

@media (max-width: 420px) {
    .login-shell {
        width: min(100% - 22px, 400px);
        padding-top: 24px;
    }

    .brand-mark {
        width: 190px;
        margin-bottom: 20px;
    }

    .brand-copy__description,
    .brand-features {
        display: none;
    }

    .access-panel {
        margin-top: 22px;
    }

    .login-card {
        padding: 26px 20px;
        border-radius: 18px;
    }

    .login-header h2 {
        margin-top: 20px;
    }

    #login-form {
        margin-top: 26px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
