.thm-modal,
.thm-modal * {
    box-sizing: border-box;
}

.thm-modal[hidden] {
    display: none !important;
}

.thm-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
}

.thm-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.thm-modal__overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(42, 171, 238, 0.28), transparent 36%),
        radial-gradient(circle at 80% 80%, rgba(34, 158, 217, 0.22), transparent 38%),
        rgba(4, 14, 23, 0.66);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.thm-modal__dialog {
    position: relative;
    width: min(100%, 460px);
    overflow: hidden;
    padding: 34px 30px 28px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 255, 0.96)) padding-box,
        linear-gradient(135deg, rgba(42, 171, 238, 0.9), rgba(34, 158, 217, 0.35)) border-box;
    box-shadow: 0 28px 90px rgba(9, 56, 82, 0.35);
    color: #102433;
    text-align: center;
    transform: translateY(18px) scale(0.96);
    transition: transform 280ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 280ms ease;
    opacity: 0;
}

.thm-modal.is-visible .thm-modal__dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.thm-modal__dialog::before {
    content: "";
    position: absolute;
    inset: -110px -80px auto;
    height: 205px;
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 70%, #6fd3ff 100%);
    border-radius: 0 0 48% 48%;
    z-index: 0;
}

.thm-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #168ac1;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(8, 56, 82, 0.14);
    transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.thm-modal__close:hover,
.thm-modal__close:focus {
    transform: rotate(90deg) scale(1.05);
    background: #ffffff;
    color: #0d6f9d;
    outline: none;
}

.thm-modal__icon,
.thm-modal__badge,
.thm-modal h2,
.thm-modal p,
.thm-modal__button,
.thm-modal__progress {
    position: relative;
    z-index: 1;
}

.thm-modal__icon {
    display: inline-grid;
    width: 88px;
    height: 88px;
    place-items: center;
    margin: 6px auto 16px;
    border: 7px solid rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    background: #ffffff;
    color: #2AABEE;
    box-shadow: 0 20px 44px rgba(26, 143, 202, 0.34);
}

.thm-modal__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.thm-modal__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(42, 171, 238, 0.12);
    color: #168ac1;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.thm-modal h2 {
    margin: 14px 0 10px;
    color: #0d293b;
    font-size: clamp(25px, 5vw, 33px);
    line-height: 1.12;
    font-weight: 850;
}

.thm-modal p {
    margin: 0;
}

.thm-modal #thm-modal-description {
    max-width: 36ch;
    margin: 0 auto;
    color: #486170;
    font-size: 16px;
    line-height: 1.65;
}

.thm-modal__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 56px;
    margin-top: 24px;
    padding: 14px 20px;
    border-radius: 18px;
    background: linear-gradient(135deg, #2AABEE, #229ED9);
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 18px 34px rgba(34, 158, 217, 0.31);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.thm-modal__button:hover,
.thm-modal__button:focus {
    transform: translateY(-2px);
    color: #ffffff !important;
    filter: saturate(1.08);
    box-shadow: 0 23px 42px rgba(34, 158, 217, 0.38);
    outline: none;
}

.thm-modal__button svg {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.thm-modal__note {
    margin-top: 14px !important;
    color: #7d94a3;
    font-size: 13px;
    line-height: 1.45;
}

.thm-modal__progress {
    width: 100%;
    height: 6px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(34, 158, 217, 0.13);
}

.thm-modal__progress span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2AABEE, #229ED9);
    transform-origin: left center;
}

.thm-modal.is-visible .thm-modal__progress span {
    animation: thm-progress var(--thm-autoclose-duration, 5s) linear forwards;
}

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

@keyframes thm-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@media (max-width: 480px) {
    .thm-modal {
        padding: 16px;
    }

    .thm-modal__dialog {
        padding: 30px 22px 24px;
        border-radius: 24px;
    }

    .thm-modal__icon {
        width: 78px;
        height: 78px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thm-modal,
    .thm-modal__dialog,
    .thm-modal__close,
    .thm-modal__button {
        transition: none;
    }

    .thm-modal.is-visible .thm-modal__progress span {
        animation: none;
        transform: scaleX(0);
    }
}
