:root {
    color-scheme: dark;
    --auth-bg: #07080c;
    --auth-panel: rgba(19, 21, 28, 0.82);
    --auth-line: rgba(255, 255, 255, 0.1);
    --auth-line-strong: rgba(255, 255, 255, 0.16);
    --auth-text: #f7f7f8;
    --auth-muted: #9ca0aa;
    --auth-blue: #0a84ff;
    --auth-blue-hover: #2997ff;
    --auth-danger: #ff6961;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body.auth-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 16% 16%, rgba(205, 65, 255, 0.17), transparent 30rem),
        radial-gradient(circle at 86% 82%, rgba(0, 197, 255, 0.14), transparent 34rem),
        linear-gradient(145deg, #090910 0%, var(--auth-bg) 48%, #071014 100%);
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.auth-page button,
.auth-page input,
.auth-page select {
    font: inherit;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(20rem, 1fr) minmax(25rem, 31rem);
    gap: clamp(2rem, 6vw, 7rem);
    align-items: center;
    width: min(76rem, calc(100% - 3rem));
    margin: 0 auto;
    padding: 3rem 0;
}

.auth-brand {
    max-width: 38rem;
}

.auth-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--auth-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.auth-logo-link img {
    width: 2.6rem;
    height: 2.6rem;
    object-fit: contain;
}

.auth-eyebrow {
    margin: clamp(4rem, 12vh, 8rem) 0 1rem;
    color: #77baff;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-brand h1 {
    margin: 0;
    max-width: 36rem;
    font-size: clamp(2.6rem, 5.2vw, 5.2rem);
    font-weight: 650;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.auth-brand-copy {
    max-width: 32rem;
    margin: 1.6rem 0 0;
    color: var(--auth-muted);
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.55;
}

.auth-points {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 2.4rem;
}

.auth-point {
    padding-top: 0.9rem;
    border-top: 1px solid var(--auth-line);
    color: #c9cbd1;
    font-size: 0.82rem;
    line-height: 1.35;
}

.auth-card {
    width: 100%;
    min-height: 37rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--auth-line);
    border-radius: 1.75rem;
    background: var(--auth-panel);
    box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(30px) saturate(125%);
    -webkit-backdrop-filter: blur(30px) saturate(125%);
}

.auth-card.is-auth-entry {
    height: 41.5rem;
}

.auth-mobile-brand {
    display: none;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0.25rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.045);
}

.auth-tabs.is-hidden {
    display: none;
}

.auth-tab {
    min-height: 2.6rem;
    padding: 0 0.8rem;
    border: 0;
    border-radius: 0.7rem;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 650;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.auth-tab:hover {
    color: var(--auth-text);
}

.auth-tab.is-active {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0.35rem 1rem rgba(0, 0, 0, 0.16);
    color: var(--auth-text);
}

.auth-form {
    display: none;
    padding-top: 1.75rem;
}

.auth-form.is-active {
    display: block;
    animation: auth-form-in 220ms ease both;
}

@keyframes auth-form-in {
    from {
        opacity: 0;
        transform: translateY(0.35rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form h2 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.035em;
}

.auth-form-intro {
    margin: 0.45rem 0 1.45rem;
    color: var(--auth-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.auth-field {
    margin-top: 1rem;
}

.auth-recovery-section {
    min-width: 0;
    margin: 1.35rem 0 0;
    padding: 1.1rem 0 0;
    border: 0;
    border-top: 1px solid var(--auth-line);
}

.auth-recovery-section legend {
    padding: 0;
    color: var(--auth-text);
    font-size: 0.86rem;
    font-weight: 700;
}

.auth-recovery-section > p {
    margin: 0.35rem 0 0;
    color: var(--auth-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

[data-register-questions] {
    margin-top: 0.55rem;
    padding-top: 0;
    border-top: 0;
}

[data-register-questions] > legend,
[data-register-questions] > p {
    display: none;
}

.auth-recovery-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    color: var(--auth-muted);
    font-size: 0.75rem;
    font-weight: 650;
}

.auth-recovery-dots {
    display: inline-flex;
    gap: 0.35rem;
}

.auth-recovery-dots i {
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    transition: width 160ms ease, background 160ms ease;
}

.auth-recovery-dots i.is-active {
    width: 1rem;
    background: var(--auth-blue);
}

.auth-answer-input {
    margin-top: 0.55rem;
}

.auth-field label {
    display: block;
    margin: 0 0 0.48rem;
    color: #d8d9de;
    font-size: 0.78rem;
    font-weight: 650;
}

.auth-input-wrap {
    position: relative;
}

.auth-input {
    width: 100%;
    height: 3.15rem;
    padding: 0 0.95rem;
    border: 1px solid var(--auth-line);
    border-radius: 0.9rem;
    outline: none;
    background: rgba(255, 255, 255, 0.055);
    color: var(--auth-text);
    font-size: 0.93rem;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.auth-input::placeholder {
    color: #6f737d;
}

.auth-input:hover {
    background: rgba(255, 255, 255, 0.07);
}

.auth-input:focus {
    border-color: rgba(10, 132, 255, 0.82);
    background: rgba(255, 255, 255, 0.075);
    box-shadow: 0 0 0 0.22rem rgba(10, 132, 255, 0.14);
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.7rem;
    transform: translateY(-50%);
    min-width: 3.3rem;
    min-height: 2rem;
    border: 0;
    border-radius: 0.6rem;
    background: transparent;
    color: #aeb1b9;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 650;
}

.auth-password-toggle:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--auth-muted);
    font-size: 0.78rem;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
}

.auth-check input {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--auth-blue);
}

.auth-link {
    color: #79baff;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-submit {
    width: 100%;
    min-height: 3.15rem;
    margin-top: 1.3rem;
    border: 0;
    border-radius: 0.9rem;
    background: var(--auth-blue);
    color: #fff;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    box-shadow: 0 0.8rem 2rem rgba(10, 132, 255, 0.2);
    transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

.auth-submit:hover {
    background: var(--auth-blue-hover);
}

.auth-submit:active {
    transform: scale(0.985);
}

.auth-legal {
    margin: 1rem 0 0;
    color: #767a84;
    font-size: 0.71rem;
    line-height: 1.45;
    text-align: center;
}

.auth-message {
    display: none;
    margin-top: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(119, 186, 255, 0.22);
    border-radius: 0.8rem;
    background: rgba(10, 132, 255, 0.08);
    color: #cfe6ff;
    font-size: 0.78rem;
    line-height: 1.4;
}

.auth-message.is-visible {
    display: block;
}

.auth-state {
    display: none;
    padding: 0.65rem 0 0.15rem;
    text-align: center;
}

.auth-state.is-active {
    display: block;
    animation: auth-form-in 220ms ease both;
}

.auth-state-icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    margin: 0.5rem auto 1.35rem;
    border: 1px solid rgba(119, 186, 255, 0.28);
    border-radius: 1.25rem;
    background: rgba(10, 132, 255, 0.1);
    color: #8dc7ff;
    font-size: 1.7rem;
    font-weight: 700;
    box-shadow: 0 1rem 3rem rgba(10, 132, 255, 0.1);
}

.auth-state-icon.is-success {
    border-color: rgba(48, 209, 88, 0.28);
    background: rgba(48, 209, 88, 0.1);
    color: #63dc7f;
}

.auth-state-icon.is-pending {
    border-color: rgba(255, 214, 10, 0.28);
    background: rgba(255, 214, 10, 0.09);
    color: #ffdc4a;
}

.auth-state-icon.is-blocked {
    border-color: rgba(255, 105, 97, 0.28);
    background: rgba(255, 105, 97, 0.09);
    color: #ff817a;
}

.auth-state h2 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.035em;
}

.auth-state-copy {
    max-width: 23rem;
    margin: 0.65rem auto 0;
    color: var(--auth-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.auth-state-detail {
    margin: 1.25rem 0 0;
    padding: 0.9rem;
    border: 1px solid var(--auth-line);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.035);
    color: #c9cbd2;
    font-size: 0.78rem;
    line-height: 1.45;
}

.auth-secondary-button {
    width: 100%;
    min-height: 3rem;
    margin-top: 0.75rem;
    border: 1px solid var(--auth-line-strong);
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.055);
    color: #f4f4f6;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 650;
    transition: background 140ms ease, transform 140ms ease;
}

.auth-secondary-button:hover {
    background: rgba(255, 255, 255, 0.09);
}

.auth-secondary-button:active {
    transform: scale(0.985);
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.2rem;
    color: #8e929c;
    text-decoration: none;
    font-size: 0.78rem;
}

.auth-back:hover {
    color: #fff;
}

@media (min-width: 901px) and (max-width: 1600px),
       (min-width: 901px) and (max-height: 900px) {
    .auth-shell {
        gap: clamp(2rem, 4vw, 4rem);
        width: min(76rem, calc(100% - 2rem));
        padding: 1rem 0;
        align-items: start;
    }

    .auth-brand {
        display: grid;
        grid-template-rows: auto 1fr;
        height: calc(100vh - 2rem);
        padding-top: 0.2rem;
    }

    .auth-brand-content {
        align-self: center;
        transform: translateY(-1.3rem);
    }

    .auth-eyebrow {
        margin: 0 0 0.65rem;
    }

    .auth-brand h1 {
        max-width: 31rem;
        font-size: clamp(2.6rem, 4.2vw, 3.5rem);
        line-height: 1;
    }

    .auth-brand-copy {
        margin-top: 1rem;
        font-size: 0.95rem;
        line-height: 1.45;
    }

    .auth-points {
        margin-top: 1.25rem;
    }

    .auth-point {
        padding-top: 0.65rem;
        font-size: 0.72rem;
    }

    .auth-card {
        min-height: 0;
        padding: 1.2rem;
        border-radius: 1.35rem;
    }

    .auth-card.is-auth-entry {
        height: calc(100vh - 2rem);
    }

    .auth-tab {
        min-height: 2.25rem;
        font-size: 0.8rem;
    }

    .auth-form {
        padding-top: 1rem;
    }

    .auth-form h2 {
        font-size: 1.4rem;
    }

    .auth-form-intro {
        margin: 0.25rem 0 0.8rem;
        font-size: 0.8rem;
    }

    .auth-field {
        margin-top: 0.7rem;
    }

    .auth-field label {
        margin-bottom: 0.35rem;
        font-size: 0.72rem;
    }

    .auth-input {
        height: 2.65rem;
        border-radius: 0.75rem;
        font-size: 0.84rem;
    }

    .auth-options {
        margin-top: 0.7rem;
        font-size: 0.72rem;
    }

    .auth-submit {
        min-height: 2.65rem;
        margin-top: 0.85rem;
        border-radius: 0.75rem;
        font-size: 0.82rem;
    }

    .auth-legal {
        margin-top: 0.65rem;
        font-size: 0.66rem;
    }

    .auth-recovery-section {
        margin-top: 0.85rem;
        padding-top: 0.75rem;
    }

    .auth-recovery-progress {
        margin-top: 0.65rem;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        width: min(34rem, calc(100% - 2rem));
        padding: 1.2rem 0 2rem;
    }

    .auth-brand {
        display: none;
    }

    .auth-mobile-brand {
        display: flex;
        justify-content: center;
        margin-bottom: 1.2rem;
    }
}

@media (max-width: 520px) {
    .auth-shell {
        width: 100%;
        padding: 0;
        align-items: stretch;
    }

    .auth-card {
        height: auto;
        min-height: 100vh;
        padding: 1.1rem;
        border: 0;
        border-radius: 0;
        background: rgba(10, 11, 16, 0.8);
        box-shadow: none;
    }

    .auth-mobile-brand {
        margin: 0.4rem 0 1.3rem;
    }

    .auth-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-options {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
    }
}

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