.ams-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.ams-modal.is-open {
    display: flex;
}

.ams-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
}

.ams-modal-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .25);
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;

    animation: ams-modal-in .2s ease;
}

@keyframes ams-modal-in {
    from { opacity: 0; transform: translateY(-12px) scale(.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1);   }
}

.ams-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    padding: 0 4px;
    z-index: 2;
    transition: color .15s;
}
.ams-modal-close:hover { color: #000; }

.ams-modal-content {
    padding: 32px 28px 28px;
}
.ams-modal-content > *:first-child { margin-top: 0; }
.ams-modal-content > *:last-child  { margin-bottom: 0; }

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

@media (max-width: 480px) {
    .ams-modal-box {
        border-radius: 6px;
        max-height: calc(100vh - 24px);
    }
    .ams-modal-content {
        padding: 24px 18px 18px;
    }
}
