:root {
    --background-deep: #060409;
    --background-muted: #100b15;
    --surface: #150f1c;
    --surface-raised: #1a1322;
    --surface-input: rgba(12, 8, 16, 0.78);
    --border: rgba(180, 137, 230, 0.14);
    --border-strong: rgba(180, 132, 235, 0.48);
    --accent: #995ddf;
    --accent-bright: #b484eb;
    --text: #f8f7f9;
    --text-muted: #a296af;
    --text-dim: #6a5d78;
    --danger: #ff9292;
    --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--background-deep);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 50% -10%, rgba(109, 34, 195, 0.2), transparent 31rem),
        radial-gradient(circle at 50% 105%, rgba(72, 21, 130, 0.16), transparent 34rem),
        linear-gradient(155deg, #070509 0%, #110c17 50%, #070509 100%);
    color: var(--text);
    font-family: var(--font);
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(rgba(180, 132, 235, 0.012) 1px, transparent 1px) 0 0 / 72px 72px,
        linear-gradient(90deg, rgba(180, 132, 235, 0.012) 1px, transparent 1px) 0 0 / 72px 72px;
    content: "";
    mask-image: linear-gradient(to bottom, #000, transparent 90%);
    pointer-events: none;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.registration-page {
    display: grid;
    min-height: 100vh;
    padding: clamp(1rem, 4vw, 3rem);
    place-items: center;
}

.registration-card {
    position: relative;
    isolation: isolate;
    width: min(100%, 31.5rem);
    overflow: hidden;
    padding: clamp(2rem, 5vw, 3.15rem);
    border: 1px solid rgba(180, 135, 232, 0.16);
    border-radius: 1.15rem;
    background:
        linear-gradient(145deg, rgba(28, 21, 36, 0.97), rgba(14, 10, 19, 0.985));
    box-shadow: none;
}

.registration-card::before {
    position: absolute;
    top: 0;
    right: 2rem;
    left: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
    content: "";
    opacity: 0.68;
}

.registration-card::after {
    position: absolute;
    top: -7rem;
    right: -6rem;
    z-index: -2;
    width: 17rem;
    height: 17rem;
    border-radius: 50%;
    background: rgba(120, 41, 211, 0.11);
    content: "";
    filter: blur(3rem);
    pointer-events: none;
}

.registration-card > * {
    position: relative;
    z-index: 1;
}

.registration-card__heading h1 {
    margin: 0;
    color: #f8f8f9;
    font-size: clamp(2rem, 7vw, 2.55rem);
    line-height: 1.04;
    letter-spacing: -0.055em;
}

.registration-card__heading p {
    max-width: none;
    margin: 0.85rem 0 1.9rem;
    color: #9f92ae;
    font-size: 0.78rem;
    line-height: 1.7;
    white-space: nowrap;
}

.registration-form {
    display: grid;
    gap: 1rem;
}

.registration-form[hidden],
.registration-card__heading[hidden],
.legal-notice[hidden] {
    display: none;
}

.form-field {
    position: relative;
    display: grid;
    gap: 0.45rem;
}

.form-field label {
    color: #e0dee3;
    font-size: 0.7rem;
    font-weight: 600;
}

.form-control {
    display: flex;
    min-height: 3.35rem;
    padding: 0 1rem;
    gap: 0.75rem;
    align-items: center;
    border: 1px solid rgba(155, 130, 184, 0.17);
    border-radius: 0.68rem;
    background: #0e0a12;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease,
        transform 150ms ease;
}

.form-control:focus-within {
    border-color: var(--border-strong);
    background: #0d0912;
    box-shadow:
        0 0 0 3px rgba(157, 102, 220, 0.08),
        0 0.8rem 2rem rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

.form-control > svg,
.password-visibility svg {
    width: 1.1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: #7a698d;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.55;
}

.form-control:focus-within > svg {
    stroke: var(--accent);
}

.form-control input {
    width: 100%;
    min-width: 0;
    padding: 0.92rem 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
}

.form-control input::placeholder {
    color: #5b4e6a;
    opacity: 1;
}

.form-control input:autofill,
.form-control input:-webkit-autofill,
.form-control input:-webkit-autofill:hover,
.form-control input:-webkit-autofill:focus,
.form-control input:-webkit-autofill:active {
    border-radius: 0;
    box-shadow: 0 0 0 1000px #0e0a12 inset;
    caret-color: var(--text);
    -webkit-text-fill-color: var(--text);
}

.form-control:focus-within input:autofill,
.form-control:focus-within input:-webkit-autofill {
    box-shadow: 0 0 0 1000px #0d0912 inset;
}

.password-visibility {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
    cursor: pointer;
}

.password-visibility:hover,
.password-visibility:focus-visible {
    outline: 0;
    background: rgba(255, 255, 255, 0.05);
}

.password-visibility__hidden {
    display: none;
}

.password-visibility[aria-pressed="true"] .password-visibility__visible {
    display: none;
}

.password-visibility[aria-pressed="true"] .password-visibility__hidden {
    display: block;
}

.form-field__hint,
.form-field__message {
    font-size: 0.66rem;
    line-height: 1.4;
}

.form-field__hint {
    color: var(--text-dim);
}

.form-field__message {
    color: var(--danger);
}

.form-field__message:empty {
    display: none;
}

.form-field[data-invalid="true"] .form-control {
    border-color: rgba(255, 146, 146, 0.62);
}

.hcaptcha-field {
    overflow: hidden;
}

.hcaptcha-field__widget {
    display: flex;
    min-height: 4.9rem;
    align-items: center;
    justify-content: center;
}

.h-captcha {
    min-height: 4.9rem;
}

.hcaptcha-field > .form-field__message {
    text-align: center;
}

.registration-button,
.login-button {
    display: flex;
    min-height: 3.35rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.68rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        transform 150ms ease,
        filter 150ms ease,
        border-color 150ms ease,
        background 150ms ease,
        box-shadow 150ms ease;
}

.registration-button {
    margin-top: 0.35rem;
    padding: 0 1.15rem;
    justify-content: space-between;
    border: 1px solid #b484eb;
    background: linear-gradient(105deg, #8d51d2, #ac7ce4);
    box-shadow:
        0 0.8rem 2rem rgba(126, 51, 211, 0.16),
        inset 0 1px rgba(255, 255, 255, 0.24);
    color: #0d0911;
    cursor: pointer;
}

.registration-button svg {
    width: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.registration-button:hover,
.registration-button:focus-visible {
    outline: 0;
    filter: brightness(1.1);
    box-shadow: 0 1rem 2.4rem rgba(126, 51, 211, 0.23);
    transform: translateY(-1px);
}

.registration-button:disabled {
    cursor: wait;
    filter: saturate(0.65);
    opacity: 0.72;
    transform: none;
}

.registration-button[data-loading="true"] span::after {
    content: "…";
}

.login-separator {
    display: grid;
    margin: 0.1rem 0;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.7rem;
    align-items: center;
}

.login-separator span {
    height: 1px;
    background: rgba(155, 130, 184, 0.12);
}

.login-separator small {
    color: #827492;
    font-size: 0.72rem;
}

.login-button {
    border: 1px solid rgba(180, 139, 227, 0.22);
    background: rgba(32, 23, 43, 0.32);
    color: #dedae3;
    font-size: 0.78rem;
}

.login-button:hover,
.login-button:focus-visible {
    outline: 0;
    border-color: rgba(180, 132, 235, 0.5);
    background: rgba(61, 28, 99, 0.5);
    transform: translateY(-1px);
}

.registration-form__notice {
    display: none;
    margin: 0;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(177, 132, 228, 0.18);
    border-radius: 0.68rem;
    background: rgba(112, 46, 187, 0.08);
    color: var(--accent-bright);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.55;
    text-align: center;
}

.registration-form__notice[data-visible="true"] {
    display: block;
}

.registration-form__notice[data-state="error"] {
    border-color: rgba(255, 146, 146, 0.32);
    background: rgba(190, 71, 82, 0.13);
    color: #ffc0c0;
}

.registration-success {
    display: grid;
    padding: 0.25rem 0 0;
    justify-items: center;
    outline: 0;
    text-align: center;
}

.registration-success[hidden] {
    display: none;
}

.registration-card[data-state="success"] {
    width: min(100%, 34rem);
    padding: clamp(2.2rem, 6vw, 3.6rem);
}

.registration-success__icon {
    display: grid;
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.35rem;
    place-items: center;
    border: 1px solid rgba(79, 226, 212, 0.34);
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(48, 196, 184, 0.18), transparent 68%);
    color: #74eadc;
}

.registration-success__icon svg {
    width: 2.75rem;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
}

.registration-success__icon circle {
    fill: #1b1324;
}

.registration-success__eyebrow {
    color: #af80e4;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.registration-success h2 {
    margin: 0.55rem 0 0;
    color: #f8f8f9;
    font-size: clamp(2rem, 7vw, 2.55rem);
    line-height: 1.05;
    letter-spacing: -0.052em;
}

.registration-success__lead {
    margin: 1rem 0 0.4rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.6;
}

.registration-success__email {
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #edeaf1;
    font-size: 0.9rem;
}

.registration-success__steps {
    display: grid;
    width: 100%;
    margin-top: 1.7rem;
    overflow: hidden;
    border: 1px solid rgba(177, 134, 226, 0.15);
    border-radius: 0.75rem;
    background: rgba(12, 8, 16, 0.5);
}

.registration-success__steps > div {
    display: grid;
    padding: 0.95rem 1rem;
    grid-template-columns: 1.8rem 1fr;
    gap: 0.8rem;
    align-items: center;
    text-align: left;
}

.registration-success__steps > div + div {
    border-top: 1px solid rgba(177, 134, 226, 0.1);
}

.registration-success__steps span {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border: 1px dashed rgba(171, 120, 230, 0.42);
    border-radius: 0.45rem;
    color: var(--accent);
    font-size: 0.57rem;
    font-weight: 700;
}

.registration-success__steps p {
    margin: 0;
    color: #9f92ae;
    font-size: 0.71rem;
    line-height: 1.55;
}

.registration-success__steps strong {
    color: #e4e1e8;
    font-weight: 600;
}

.registration-success__tip {
    display: flex;
    margin: 1.1rem 0 1.4rem;
    gap: 0.55rem;
    align-items: center;
    color: #796b88;
    font-size: 0.65rem;
    line-height: 1.5;
}

.registration-success__tip svg {
    width: 1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: #755797;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
}

.registration-success__action {
    display: flex;
    width: 100%;
    min-height: 3.35rem;
    padding: 0 1.15rem;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #b484eb;
    border-radius: 0.68rem;
    background: linear-gradient(105deg, #8d51d2, #ac7ce4);
    color: #0d0911;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        filter 150ms ease,
        transform 150ms ease;
}

.registration-success__action:hover,
.registration-success__action:focus-visible {
    outline: 0;
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.registration-success__action svg {
    width: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

@media (max-width: 390px) {
    .hcaptcha-field__widget {
        justify-content: flex-start;
        transform: scale(0.88);
        transform-origin: left center;
    }
}

@media (max-width: 340px) {
    .hcaptcha-field__widget {
        transform: scale(0.78);
    }
}

.legal-notice {
    margin: 1.45rem 0 0;
    padding: 1.15rem 0.5rem 0;
    border-top: 1px solid rgba(155, 130, 184, 0.1);
    color: #827491;
    font-size: 0.72rem;
    line-height: 1.7;
    text-align: center;
}

.legal-notice a,
.legal-notice button {
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: #b592dd;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
}

.legal-notice a:hover,
.legal-notice a:focus-visible,
.legal-notice button:hover,
.legal-notice button:focus-visible {
    outline: 0;
    text-decoration: underline;
    text-underline-offset: 0.15rem;
}

body:has(.legal-modal:not([hidden])) {
    overflow: hidden;
}

.legal-modal[hidden] {
    display: none;
}

.legal-modal {
    display: grid;
    position: fixed;
    inset: 0;
    z-index: 100;
    padding: 1rem;
    place-items: center;
}

.legal-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 3, 7, 0.84);
    backdrop-filter: blur(8px);
}

.legal-modal__dialog {
    display: grid;
    position: relative;
    width: min(100%, 38rem);
    max-height: min(47rem, calc(100vh - 2rem));
    overflow: hidden;
    border: 1px solid rgba(179, 132, 233, 0.25);
    border-radius: 0.9rem;
    background: #140e1a;
    box-shadow: 0 2.5rem 7rem rgba(0, 0, 0, 0.68);
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.legal-modal__header {
    display: flex;
    padding: 1.25rem 1.4rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(155, 130, 184, 0.12);
    background: rgba(32, 23, 42, 0.42);
}

.legal-modal__header span {
    color: var(--accent);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.legal-modal__header h2 {
    margin: 0.3rem 0 0;
    font-size: 1.2rem;
}

.legal-modal__close {
    display: grid;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(155, 130, 184, 0.16);
    border-radius: 0.48rem;
    background: rgba(10, 7, 14, 0.45);
    color: var(--text-muted);
    cursor: pointer;
}

.legal-modal__close:hover,
.legal-modal__close:focus-visible {
    outline: 0;
    border-color: rgba(180, 132, 235, 0.48);
    color: var(--text);
}

.legal-modal__close svg {
    width: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
}

.legal-modal__content {
    padding: 1.35rem 1.4rem 1.6rem;
    overflow-y: auto;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.75;
    scrollbar-color: rgba(165, 121, 214, 0.35) transparent;
    scrollbar-width: thin;
}

.legal-modal__content h3 {
    margin: 1.25rem 0 0.35rem;
    color: #e5e3e8;
    font-size: 0.77rem;
}

.legal-modal__content h3:first-of-type {
    margin-top: 1rem;
}

.legal-modal__content p {
    margin: 0;
}

.legal-modal__example-warning {
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(167, 120, 221, 0.17);
    border-radius: 0.5rem;
    background: rgba(117, 54, 190, 0.08);
    color: #b592dd;
    font-size: 0.65rem;
    line-height: 1.6;
}

.legal-modal__footer {
    padding: 0.9rem 1.4rem;
    border-top: 1px solid rgba(155, 130, 184, 0.12);
    background: rgba(11, 8, 15, 0.68);
    text-align: right;
}

.legal-modal__footer button {
    min-height: 2.45rem;
    padding: 0 1.2rem;
    border: 1px solid rgba(180, 132, 235, 0.42);
    border-radius: 0.48rem;
    background: rgba(92, 37, 154, 0.35);
    color: #e6e2eb;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
}

.legal-modal__footer button:hover,
.legal-modal__footer button:focus-visible {
    outline: 0;
    background: rgba(109, 44, 182, 0.5);
}

@media (max-width: 600px) {
    .registration-page {
        padding: 0.65rem;
    }

    .registration-card {
        padding: 1.8rem 1.25rem 1.5rem;
        border-radius: 0.9rem;
    }

    .registration-card__heading p {
        margin-bottom: 1.6rem;
        white-space: normal;
    }

    .legal-modal {
        padding: 0.6rem;
    }

    .legal-modal__dialog {
        max-height: calc(100vh - 1.2rem);
    }

    .legal-modal__header,
    .legal-modal__content,
    .legal-modal__footer {
        padding-right: 1rem;
        padding-left: 1rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .registration-card {
        animation: card-entry 500ms ease-out both;
    }

    @keyframes card-entry {
        from {
            opacity: 0;
            transform: translateY(0.75rem);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
