.vln-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(640px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    min-height: 0;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    overflow: hidden;
    border: 4px solid #2776be;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
}

.vln-modal:not([open]) {
    display: none;
}

.vln-modal::backdrop {
    background: rgba(0, 0, 0, 0.48);
}

.vln-modal--wide {
    width: min(960px, calc(100vw - 16px));
}

.vln-modal[data-vln-modal-positioned] {
    transform: none;
}

.vln-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    min-height: 52px;
    padding: 8px 10px 8px 20px;
    background: linear-gradient(#438dca, #1b66a6);
    color: #fff;
    cursor: move;
    touch-action: none;
    user-select: none;
}

.vln-modal__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.vln-modal__close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #1b66a6;
    font: 28px/1 Arial, Helvetica, sans-serif;
    cursor: pointer;
}

.vln-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow: auto;
    overscroll-behavior: contain;
}

.vln-modal__footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    box-sizing: border-box;
    min-height: 56px;
    padding: 10px 44px 10px 20px;
    border-top: 1px solid #d6e1eb;
    background: #f7fafc;
}

.vln-modal__button {
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid #9bb7d0;
    border-radius: 5px;
    background: #fff;
    color: #194a73;
    font: 700 14px/1.2 Arial, Helvetica, sans-serif;
    cursor: pointer;
}

.vln-modal__button--primary {
    border-color: #1b66a6;
    background: #216fb0;
    color: #fff;
}

.vln-modal__button:hover {
    filter: brightness(0.95);
}

.vln-modal__resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4 11 11 4M8 11l3-3' fill='none' stroke='%23869bab' stroke-width='1.25' stroke-linecap='round'/%3E%3C/svg%3E") right 3px bottom 3px / 12px 12px no-repeat;
    cursor: nwse-resize;
    touch-action: none;
}

.vln-modal__close:focus-visible,
.vln-modal__resize:focus-visible,
.vln-modal__button:focus-visible {
    outline: 2px solid #ffcc33;
    outline-offset: -2px;
}

.vln-sample-trigger,
.vln-modal-trigger {
    appearance: none;
    background: transparent;
    font-family: inherit;
}

.vln-sample-form,
.vln-modal-form {
    display: grid;
    gap: 8px;
    max-width: 100%;
}

.vln-sample-form__field,
.vln-modal-form__field {
    display: grid;
    gap: 3px;
    min-width: 0;
    color: #303d4b;
    font-size: 13px;
    font-weight: 700;
}

.vln-sample-form__field input,
.vln-sample-form__field textarea,
.vln-modal-form__field input,
.vln-modal-form__field textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 5px 8px;
    border: 1px solid #b8c6d2;
    border-radius: 5px;
    background: #fff;
    color: #26323d;
    font: 14px/1.35 Arial, Helvetica, sans-serif;
}

.vln-sample-form__field textarea,
.vln-modal-form__field textarea {
    min-height: 90px;
    resize: none;
}

.vln-sample-form__field input:focus-visible,
.vln-sample-form__field textarea:focus-visible,
.vln-modal-form__field input:focus-visible,
.vln-modal-form__field textarea:focus-visible {
    outline: 2px solid #2776be;
    outline-offset: 1px;
}

.vln-sample-form__pair {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 10px;
}

.vln-sample-form .recaptcha_message,
.vln-modal-form .recaptcha_message {
    margin: 0;
}

@media (max-width: 640px), (max-height: 480px) {
    .vln-modal {
        left: 8px;
        top: 8px;
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        transform: none;
    }

    .vln-modal__header {
        padding-left: 12px;
        cursor: default;
        touch-action: auto;
    }

    .vln-modal__title {
        font-size: 18px;
    }

    .vln-modal__body {
        padding: 12px;
    }

    .vln-modal__footer {
        padding: 10px 12px;
    }

    .vln-modal__footer .vln-modal__button {
        flex: 1 1 120px;
    }

    .vln-modal__resize {
        display: none;
    }
}

@media (max-width: 640px) {
    .vln-sample-form,
    .vln-modal-form {
        gap: 10px;
    }

    .vln-sample-form__field,
    .vln-modal-form__field {
        gap: 4px;
    }

    .vln-sample-form__field input,
    .vln-sample-form__field textarea,
    .vln-modal-form__field input,
    .vln-modal-form__field textarea {
        min-height: 40px;
        padding: 8px 10px;
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .vln-sample-form__pair {
        grid-template-columns: minmax(0, 1fr);
    }
}
