:root {
    --md-primary: #33abe0;
    --md-primary-hover: #2a9bcc;
    --md-surface: #ffffff;
    --md-background: #fbf9f4;
    --md-ink: #2b3036;
    --md-muted: #647184;
    --md-border: #e2e8f0;
    --md-field: #f8fafc;
    --md-danger: #c93434;
    --md-shadow: 0 30px 60px rgba(0, 0, 0, 0.1);
    --md-font-display: "Manrope", "Segoe UI", sans-serif;
    --md-font-body: "Work Sans", "Segoe UI", sans-serif;
    --md-font-serif: "Playfair Display", Georgia, serif;
}

.md-modal,
.md-modal *,
.md-modal *::before,
.md-modal *::after {
    box-sizing: border-box;
}

body.md-modal-open {
    overflow: hidden;
}

.md-success__button {
    min-height: 48px;
    padding: 12px 26px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--md-primary);
    box-shadow: 0 10px 22px -8px rgba(51, 171, 224, 0.65);
    font: 700 0.84rem var(--md-font-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.md-success__button:hover {
    background: var(--md-primary-hover);
    box-shadow: 0 14px 26px -8px rgba(51, 171, 224, 0.75);
    transform: translateY(-1px);
}

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

.md-modal {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: grid;
    padding: 12px;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 260ms ease, visibility 260ms ease;
}

.md-modal.md-is-open {
    visibility: visible;
    opacity: 1;
}

.md-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(245, 245, 245, 0.9);
    backdrop-filter: blur(4px);
}

.md-modal__dialog {
    position: relative;
    display: grid;
    grid-template-columns: 48% 52%;
    width: min(100%, 960px);
    height: min(600px, calc(100dvh - 24px));
    overflow: hidden;
    overscroll-behavior: none;
    border: 1px solid rgba(43, 48, 54, 0.06);
    border-radius: 5px;
    outline: 0;
    background: var(--md-surface);
    box-shadow: var(--md-shadow);
    transform: translateY(18px) scale(0.985);
    transition: transform 260ms ease;
}

.md-modal.md-is-open .md-modal__dialog {
    transform: translateY(0) scale(1);
}

.md-modal__visual {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #43362d;
}

.md-modal__image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transform: scale(1.01);
}

.md-modal__image-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20, 16, 13, 0.2) 0%, transparent 38%, rgba(20, 16, 13, 0.18) 100%);
    pointer-events: none;
}

.md-modal__feature {
    position: absolute;
    right: 30px;
    bottom: 30px;
    left: 30px;
    padding: 20px 22px 19px;
    border-left: 4px solid var(--md-primary);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
    backdrop-filter: blur(8px);
}

.md-modal__feature-label {
    display: block;
    margin-bottom: 6px;
    color: var(--md-primary);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.md-modal__feature-title {
    margin: 0 0 4px;
    color: var(--md-ink);
    font: 800 1.2rem/1.22 var(--md-font-display);
}

.md-modal__feature-text {
    margin: 0;
    color: #4a5568;
    font: italic 0.92rem/1.38 var(--md-font-serif);
}

.md-modal__content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
    padding: 32px 46px 24px;
    background: var(--md-surface);
}

.md-modal__close {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 14px;
    display: grid;
    width: 35px;
    height: 35px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    transition: color 170ms ease, background-color 170ms ease, transform 170ms ease;
}

.md-modal__close svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

.md-modal__close:hover {
    color: var(--md-primary);
    background: rgba(51, 171, 224, 0.08);
    transform: rotate(4deg);
}

.md-modal__header {
    margin-bottom: 18px;
}

.md-modal__kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
    color: var(--md-primary);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.md-modal__kicker-line {
    width: 32px;
    height: 1px;
    background: currentColor;
}

.md-modal__title {
    margin: 0 0 8px;
    color: var(--md-ink);
    font: 800 clamp(1.42rem, 2.2vw, 1.7rem)/1.16 var(--md-font-display);
}

.md-modal__subtitle {
    margin: 0;
    color: var(--md-muted);
    font-size: 0.84rem;
    line-height: 1.42;
}

.md-form {
    display: grid;
    gap: 10px;
}

.md-field {
    display: grid;
    gap: 4px;
}

.md-field__label {
    color: #475569;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 160ms ease;
}

.md-field:focus-within .md-field__label {
    color: var(--md-primary);
}

.md-field__control {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--md-border);
    border-radius: 5px;
    outline: 0;
    color: #334155;
    background: var(--md-field);
    font: 400 0.86rem var(--md-font-body);
    transition: border-color 170ms ease, box-shadow 170ms ease, background-color 170ms ease;
}

.md-field__control::placeholder {
    color: #94a3b8;
}

.md-field__control:hover {
    border-color: #cbd5e1;
}

.md-field__control:focus {
    border-color: var(--md-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(51, 171, 224, 0.16);
}

.md-field.md-has-error .md-field__label,
.md-field__error {
    color: var(--md-danger);
}

.md-field.md-has-error .md-field__control {
    border-color: var(--md-danger);
    background: #fffafa;
}

.md-field.md-has-error .md-field__control:focus {
    box-shadow: 0 0 0 3px rgba(201, 52, 52, 0.12);
}

.md-field__error {
    min-height: 0;
    font-size: 0.66rem;
    line-height: 1.2;
}

.md-field__error:not(:empty) {
    min-height: 1em;
}

.md-form__submit {
    display: grid;
    min-height: 48px;
    margin-top: 2px;
    padding: 11px 20px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: var(--md-primary);
    box-shadow: 0 10px 22px -7px rgba(51, 171, 224, 0.58);
    font: 700 0.74rem var(--md-font-body);
    letter-spacing: 0.13em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.md-form__submit:hover:not(:disabled) {
    background: var(--md-primary-hover);
    box-shadow: 0 15px 27px -7px rgba(51, 171, 224, 0.68);
    transform: translateY(-1px);
}

.md-form__submit:active:not(:disabled) {
    transform: scale(0.985);
}

.md-form__submit:disabled {
    cursor: wait;
    opacity: 0.8;
}

.md-form__submit-label,
.md-form__submit-loading {
    align-items: center;
    justify-content: center;
    gap: 9px;
}

.md-form__submit-label {
    display: inline-flex;
}

.md-form__submit-label svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

.md-form__submit-loading {
    display: none;
}

.md-form__submit.md-is-loading .md-form__submit-label {
    display: none;
}

.md-form__submit.md-is-loading .md-form__submit-loading {
    display: inline-flex;
}

.md-spinner {
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: md-spin 700ms linear infinite;
}

.md-form__dismiss {
    justify-self: center;
    padding: 3px 8px;
    border: 0;
    color: #94a3b8;
    background: transparent;
    font: 700 0.68rem var(--md-font-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: underline;
    text-decoration-color: #e2e8f0;
    text-underline-offset: 7px;
    cursor: pointer;
    transition: color 160ms ease, text-decoration-color 160ms ease;
}

.md-form__dismiss:hover {
    color: var(--md-primary);
    text-decoration-color: currentColor;
}

.md-modal__security {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    margin: 14px 0 0;
    color: #94a3b8;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.md-modal__security svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    fill: currentColor;
}

.md-success {
    display: grid;
    min-height: 0;
    padding: 20px 4px;
    align-content: center;
    justify-items: center;
    text-align: center;
}

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

.md-success__icon {
    display: grid;
    width: 66px;
    height: 66px;
    margin-bottom: 16px;
    place-items: center;
    border-radius: 5px;
    color: var(--md-primary);
    background: rgba(51, 171, 224, 0.12);
}

.md-success__icon svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.md-success__eyebrow {
    margin-bottom: 9px;
    color: var(--md-primary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.md-success__title {
    margin: 0;
    outline: 0;
    color: var(--md-ink);
    font: 800 1.55rem/1.2 var(--md-font-display);
}

.md-success__text {
    max-width: 360px;
    margin: 11px auto 20px;
    color: var(--md-muted);
    line-height: 1.6;
}

.md-success__button {
    min-width: 160px;
}

.md-modal__close:focus-visible,
.md-form__submit:focus-visible,
.md-form__dismiss:focus-visible,
.md-success__button:focus-visible {
    outline: 3px solid rgba(51, 171, 224, 0.32);
    outline-offset: 3px;
}

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

@media (max-width: 920px) and (min-width: 768px) {
    .md-modal__feature {
        right: 24px;
        bottom: 24px;
        left: 24px;
        padding: 18px;
    }

    .md-modal__content {
        padding-right: 34px;
        padding-left: 34px;
    }
}

@media (max-width: 767px) {
    .md-modal {
        padding: 6px;
    }

    .md-modal__dialog {
        display: block;
        width: min(100%, 520px);
        height: auto;
        max-height: calc(100dvh - 12px);
        overflow: hidden;
        overscroll-behavior: none;
        border-radius: 5px;
    }

    .md-modal__visual {
        display: block;
        width: 100%;
        height: 112px;
        min-height: 112px;
        border-bottom: 3px solid var(--md-primary);
        box-shadow: none;
    }

    .md-modal__image {
        object-position: center 57%;
    }

    .md-modal__image-shade {
        background: linear-gradient(180deg, rgba(12, 18, 24, 0.04) 0%, rgba(12, 18, 24, 0.15) 100%);
    }

    .md-modal__feature {
        display: none;
    }

    .md-modal__close {
        top: 10px;
        right: 10px;
        color: #fff;
        background: rgba(15, 23, 31, 0.32);
        border: 1px solid rgba(255, 255, 255, 0.42);
        box-shadow: 0 5px 14px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(5px);
    }

    .md-modal__close:hover {
        color: #fff;
        background: rgba(15, 23, 31, 0.58);
    }

    .md-modal__content {
        display: block;
        overflow: hidden;
        padding: 20px 22px 15px;
        box-shadow: none;
    }

    .md-modal__header {
        margin-bottom: 14px;
        text-align: left;
    }

    .md-modal__kicker {
        width: fit-content;
        margin-right: 0;
        margin-left: 0;
        padding: 0;
        justify-content: flex-start;
        background: transparent;
    }

    .md-modal__kicker-line {
        display: block;
        width: 24px;
    }

    .md-modal__subtitle {
        max-width: 440px;
        margin-right: 0;
        margin-left: 0;
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .md-form__submit {
        box-shadow: 0 7px 16px -8px rgba(51, 171, 224, 0.52);
    }

    .md-form__submit:hover:not(:disabled) {
        box-shadow: 0 9px 19px -8px rgba(51, 171, 224, 0.58);
    }

    .md-modal__security {
        margin-top: 10px;
    }
}

@media (max-width: 420px) {
    .md-modal {
        padding: 4px;
    }

    .md-modal__dialog {
        max-height: calc(100dvh - 8px);
        border-radius: 5px;
    }

    .md-modal__content {
        padding: 15px 16px 12px;
    }

    .md-modal__close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }

    .md-modal__visual {
        height: 104px;
        min-height: 104px;
    }

    .md-modal__title {
        font-size: 1.26rem;
    }

    .md-modal__subtitle {
        font-size: 0.76rem;
    }

    .md-field__control {
        min-height: 40px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .md-form__submit {
        min-height: 44px;
        padding-right: 15px;
        padding-left: 15px;
        font-size: 0.68rem;
        letter-spacing: 0.09em;
    }

    .md-modal__security {
        align-items: flex-start;
        font-size: 0.58rem;
        line-height: 1.45;
    }
}

@media (min-width: 768px) and (max-height: 650px) {
    .md-modal {
        padding: 8px;
    }

    .md-modal__dialog {
        width: min(100%, 900px);
        height: calc(100dvh - 16px);
    }

    .md-modal__feature {
        right: 20px;
        bottom: 20px;
        left: 20px;
        padding: 15px 17px;
    }

    .md-modal__feature-title {
        font-size: 1.05rem;
    }

    .md-modal__feature-text {
        font-size: 0.82rem;
    }

    .md-modal__content {
        padding: 22px 34px 16px;
    }

    .md-modal__header {
        margin-bottom: 12px;
    }

    .md-modal__kicker {
        margin-bottom: 7px;
    }

    .md-modal__title {
        font-size: 1.42rem;
    }

    .md-modal__subtitle {
        font-size: 0.76rem;
        line-height: 1.32;
    }

    .md-form {
        gap: 8px;
    }

    .md-field {
        gap: 3px;
    }

    .md-field__control {
        min-height: 40px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .md-form__submit {
        min-height: 43px;
        padding-top: 9px;
        padding-bottom: 9px;
    }

    .md-modal__security {
        margin-top: 8px;
    }
}

@media (max-width: 767px) and (max-height: 650px) {
    .md-modal__dialog {
        max-height: calc(100dvh - 8px);
    }

    .md-modal__content {
        padding: 14px 18px 11px;
    }

    .md-modal__visual {
        height: 72px;
        min-height: 72px;
    }

    .md-modal__close {
        top: 7px;
        right: 7px;
        width: 30px;
        height: 30px;
    }

    .md-modal__header {
        margin-bottom: 10px;
    }

    .md-modal__kicker {
        margin-bottom: 6px;
        font-size: 0.6rem;
    }

    .md-modal__title {
        margin-bottom: 0;
        font-size: 1.2rem;
    }

    .md-modal__subtitle,
    .md-modal__security {
        display: none;
    }

    .md-form {
        gap: 7px;
    }

    .md-field {
        gap: 2px;
    }

    .md-field__label {
        font-size: 0.63rem;
    }

    .md-field__control {
        min-height: 39px;
        padding: 7px 11px;
        font-size: 0.8rem;
    }

    .md-form__submit {
        min-height: 42px;
        margin-top: 0;
        padding-top: 8px;
        padding-bottom: 8px;
    }
}

@media (max-width: 767px) and (max-height: 560px) {
    .md-modal__visual {
        display: none;
    }

    .md-modal__content {
        box-shadow: none;
    }

    .md-modal__close {
        top: 5px;
        right: 5px;
        color: #94a3b8;
        background: transparent;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
    }

    .md-modal__close:hover {
        color: var(--md-primary);
        background: rgba(51, 171, 224, 0.08);
    }
}

@media (max-width: 767px) and (max-height: 520px) {
    .md-modal__content {
        padding: 8px 14px 7px;
    }

    .md-modal__close {
        top: 5px;
        right: 5px;
        width: 29px;
        height: 29px;
    }

    .md-modal__kicker {
        display: none;
    }

    .md-modal__header {
        margin-bottom: 7px;
    }

    .md-modal__title {
        font-size: 1.1rem;
    }

    .md-form {
        gap: 5px;
    }

    .md-field__control {
        min-height: 36px;
        padding-top: 6px;
        padding-bottom: 6px;
    }

    .md-form__submit {
        min-height: 39px;
    }

    .md-form__dismiss {
        padding-top: 1px;
        padding-bottom: 1px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .md-modal,
    .md-modal__dialog,
    .md-success__button,
    .md-modal__close,
    .md-field__control,
    .md-form__submit {
        transition: none;
    }

    .md-spinner {
        animation-duration: 1.4s;
    }
}
