/* Purchase agreement only. Other Layui dialogs remain unchanged. */
@keyframes purchase-agreement-ios-in {
    0% {
        opacity: 0;
        transform: translate3d(0, 14px, 0) scale(.94);
    }
    58% { opacity: 1; }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes purchase-agreement-ios-out {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, 8px, 0) scale(.965);
    }
}

@keyframes purchase-agreement-gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes purchase-agreement-warning-breathe {
    0%, 100% { transform: translateZ(0) scale(1); }
    50% { transform: translateZ(0) scale(1.015); }
}

.layui-layer-page.purchase-agreement-blue {
    display: flex !important;
    flex-direction: column !important;
    width: 1180px !important;
    max-width: calc(100vw - 40px) !important;
    height: calc(100vh - 40px) !important;
    max-height: 780px !important;
    min-width: 0 !important;
    min-height: 520px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, .72) !important;
    border-radius: 24px !important;
    background: linear-gradient(145deg, #9cddff 0%, #5dbdff 47%, #83d5ff 100%) !important;
    box-shadow: 0 28px 70px rgba(0, 0, 0, .24), 0 8px 22px rgba(0, 0, 0, .12) !important;
    transform-origin: 50% 45%;
    backface-visibility: hidden;
    animation: purchase-agreement-ios-in .34s cubic-bezier(.22, 1, .36, 1) both !important;
    will-change: transform, opacity;
}

.layui-layer-page.purchase-agreement-blue.purchase-agreement-blue-ready {
    opacity: 1 !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    animation: none !important;
    will-change: auto;
}

.layui-layer-page.purchase-agreement-blue.purchase-agreement-blue-closing {
    pointer-events: none;
    animation: purchase-agreement-ios-out .20s cubic-bezier(.4, 0, 1, 1) both !important;
    will-change: transform, opacity;
}

.purchase-agreement-blue > .layui-layer-title,
.purchase-agreement-blue > .layui-layer-content,
.purchase-agreement-blue > .layui-layer-btn {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.purchase-agreement-blue > .layui-layer-title {
    flex: 0 0 74px;
    display: flex;
    align-items: center;
    height: 74px !important;
    line-height: 1.25 !important;
    padding: 0 76px 0 68px !important;
    overflow: visible !important;
    border: 0 !important;
    color: #fff !important;
    background: linear-gradient(110deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .06)) !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: .04em;
    text-shadow: 0 1px 5px rgba(0, 72, 128, .18);
    cursor: move;
    user-select: none;
}

.purchase-agreement-blue > .layui-layer-title::before {
    content: "";
    position: absolute;
    left: 24px;
    top: 50%;
    width: 28px;
    height: 28px;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 10px;
    background: rgba(255, 255, 255, .86);
    box-shadow: inset 0 0 0 6px #56baff, 0 5px 14px rgba(0, 87, 151, .16);
}

.purchase-agreement-blue > .layui-layer-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 2px !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    border-radius: 20px 20px 0 0 !important;
    background: #f5fbff !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .92) !important;
    scrollbar-color: #73c4f7 #e1f2fc;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}

.purchase-agreement-blue > .layui-layer-content::-webkit-scrollbar { width: 10px; }
.purchase-agreement-blue > .layui-layer-content::-webkit-scrollbar-track {
    margin: 12px 0;
    border-radius: 999px;
    background: #e1f2fc;
}
.purchase-agreement-blue > .layui-layer-content::-webkit-scrollbar-thumb {
    border: 2px solid #e1f2fc;
    border-radius: 999px;
    background: #69bff7;
}

.purchase-agreement-blue #buy-protocol {
    width: auto !important;
    max-width: none !important;
    min-height: 100%;
    box-sizing: border-box;
    padding: 26px 28px 38px !important;
    color: #17314b !important;
    font-size: 16px !important;
    line-height: 1.78 !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-rendering: optimizeLegibility;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-split {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) minmax(390px, .96fr);
    grid-template-areas:
        "intro preview"
        "records preview";
    column-gap: 22px;
    align-items: start;
}

.purchase-agreement-split__intro {
    grid-area: intro;
    min-width: 0;
}

.purchase-agreement-split__records {
    grid-area: records;
    min-width: 0;
}

.purchase-agreement-blue #buy-protocol a {
    color: #0784dc !important;
    font-weight: 650;
    text-decoration: none;
    text-underline-offset: 3px;
}

.purchase-agreement-blue #buy-protocol a:hover {
    color: #006bb6 !important;
    text-decoration: underline;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-risk-item {
    margin: 0 0 12px !important;
    padding: 14px 16px !important;
    border: 1px solid rgba(91, 182, 240, .27);
    border-left: 4px solid #52b8f7;
    border-radius: 13px;
    background: rgba(255, 255, 255, .75);
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning {
    display: inline-block;
    max-width: 100%;
    color: #a63bd2 !important;
    background-color: transparent !important;
    font-size: clamp(21px, 2.15vw, 28px) !important;
    font-weight: 900 !important;
    line-height: 1.42 !important;
    letter-spacing: .018em;
    overflow-wrap: anywhere;
    transform-origin: left center;
    filter: drop-shadow(0 4px 8px rgba(136, 54, 172, .18));
    animation: purchase-agreement-gradient-flow 3.2s ease-in-out infinite,
               purchase-agreement-warning-breathe 2.4s ease-in-out infinite;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning-row {
    margin: 5px 0 12px !important;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning {
        color: transparent !important;
        background: linear-gradient(100deg, #ff3547 0%, #ff8a24 18%, #f2b72f 34%, #9b51e0 53%, #2f80ed 72%, #16b8cc 86%, #ff3547 100%) !important;
        background-size: 300% 100% !important;
        -webkit-background-clip: text !important;
        background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
    }
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-preview {
    grid-area: preview;
    position: relative;
    width: 100%;
    height: clamp(300px, 48vh, 450px);
    min-height: 300px;
    margin: 14px 0 24px;
    overflow: hidden;
    border: 1px solid rgba(67, 170, 235, .42);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(17, 108, 168, .14), 0 2px 8px rgba(17, 108, 168, .08);
    contain: layout paint style;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-split > .purchase-agreement-preview {
    position: sticky;
    top: 0;
    height: clamp(430px, calc(100vh - 220px), 620px);
    min-height: 430px;
    margin: 0;
}

.purchase-agreement-preview__toolbar {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 52px;
    padding: 0 14px 0 16px;
    color: #fff;
    background: linear-gradient(110deg, #71c9ff 0%, #31a9f5 54%, #76d3ff 100%);
    box-shadow: 0 3px 12px rgba(0, 117, 190, .14);
}

.purchase-agreement-preview__title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .02em;
    white-space: nowrap;
}

.purchase-agreement-preview__browser-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 7px;
    background: rgba(255, 255, 255, .18);
}

.purchase-agreement-preview__browser-icon i {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    opacity: .95;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-preview__open {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid rgba(255, 255, 255, .62);
    border-radius: 9px;
    color: #fff !important;
    background: rgba(255, 255, 255, .16);
    font-size: 12.5px;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
    transition: background .16s ease, transform .16s ease;
}

.purchase-agreement-blue #buy-protocol .purchase-agreement-preview__open:hover {
    color: #fff !important;
    text-decoration: none;
    background: rgba(255, 255, 255, .28);
    transform: translateY(-1px);
}

.purchase-agreement-preview__viewport {
    position: absolute;
    inset: 52px 0 0;
    overflow: hidden;
    background: #f5f8fc;
    overscroll-behavior: contain;
}

.purchase-agreement-preview__loading {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64829a;
    background: linear-gradient(135deg, #f7fcff, #edf7fd);
    font-size: 13px;
    transition: opacity .2s ease, visibility .2s ease;
}

.purchase-agreement-preview--loaded .purchase-agreement-preview__loading {
    visibility: hidden;
    opacity: 0;
}

.purchase-agreement-preview__spinner {
    width: 18px;
    height: 18px;
    box-sizing: border-box;
    border: 2px solid rgba(49, 169, 245, .24);
    border-top-color: #31a9f5;
    border-radius: 50%;
    animation: purchase-agreement-preview-spin .7s linear infinite;
}

@keyframes purchase-agreement-preview-spin {
    to { transform: rotate(360deg); }
}

.purchase-agreement-preview__frame {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    opacity: 0;
    transition: opacity .2s ease;
    -webkit-overflow-scrolling: touch;
}

.purchase-agreement-preview--loaded .purchase-agreement-preview__frame {
    opacity: 1;
}

.purchase-agreement-preview--slow .purchase-agreement-preview__loading {
    padding: 24px;
    color: #3c6f92;
    text-align: center;
}

.purchase-agreement-blue > .layui-layer-btn {
    flex: 0 0 auto;
    min-height: 78px;
    margin: 0 2px 2px !important;
    padding: 14px 24px 18px !important;
    border: 0 !important;
    border-radius: 0 0 20px 20px;
    background: #e9f7ff !important;
    text-align: center !important;
    box-shadow: 0 -10px 24px rgba(0, 95, 155, .07);
}

.purchase-agreement-blue > .layui-layer-btn .layui-layer-btn0 {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    height: 48px !important;
    margin: 0 !important;
    padding: 0 30px !important;
    border: 0 !important;
    border-radius: 14px !important;
    color: #fff !important;
    background: linear-gradient(105deg, #46b9ff 0%, #169df0 55%, #56c8ff 100%) !important;
    box-shadow: 0 10px 22px rgba(0, 128, 208, .22) !important;
    font-size: 16px !important;
    font-weight: 750 !important;
    letter-spacing: .06em;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.purchase-agreement-blue > .layui-layer-btn .layui-layer-btn0:hover {
    transform: translateY(-1px);
    filter: brightness(1.025);
    box-shadow: 0 13px 26px rgba(0, 128, 208, .27) !important;
}

.purchase-agreement-blue > .layui-layer-btn .protocol-djz {
    display: block;
    margin-top: 8px;
    color: #6f8ba1 !important;
    font-size: 13px !important;
}

.purchase-agreement-blue > .layui-layer-setwin {
    position: absolute !important;
    z-index: 3;
    top: 20px !important;
    right: 22px !important;
    width: 34px;
    height: 34px;
}

.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close {
    position: relative !important;
    right: auto !important;
    top: auto !important;
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    border-radius: 11px;
    background: rgba(255, 255, 255, .20) !important;
    transition: background .16s ease, transform .16s ease;
}

.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close::before,
.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 16px;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: #fff;
}
.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close::before { transform: rotate(45deg); }
.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close::after { transform: rotate(-45deg); }
.purchase-agreement-blue > .layui-layer-setwin .layui-layer-close:hover {
    background: rgba(255, 255, 255, .34) !important;
    transform: scale(1.04);
}

.purchase-agreement-blue > .layui-layer-resize { display: none !important; }

.layui-layer-shade.purchase-agreement-blue-shade {
    background: #16171a !important;
    opacity: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: opacity .22s ease-out !important;
    cursor: pointer;
    touch-action: manipulation;
    will-change: opacity;
}

.layui-layer-shade.purchase-agreement-blue-shade.purchase-agreement-blue-shade-ready {
    opacity: .42 !important;
    will-change: auto;
}

.layui-layer-shade.purchase-agreement-blue-shade.purchase-agreement-blue-shade-closing {
    opacity: 0 !important;
    pointer-events: none;
    transition-duration: .20s !important;
    transition-timing-function: ease-in !important;
    will-change: opacity;
}

@media (max-width: 640px) {
    .layui-layer-page.purchase-agreement-blue {
        left: 12px !important;
        top: 18px !important;
        width: calc(100vw - 24px) !important;
        max-width: none !important;
        height: calc(100vh - 56px) !important;
        height: calc(100dvh - 56px) !important;
        max-height: 720px !important;
        min-height: 0 !important;
        border-radius: 20px !important;
    }
    .purchase-agreement-blue > .layui-layer-title {
        flex-basis: 58px;
        height: 58px !important;
        padding: 0 62px 0 56px !important;
        font-size: 19px !important;
        cursor: default;
    }
    .purchase-agreement-blue > .layui-layer-title::before {
        left: 19px;
        width: 24px;
        height: 24px;
        border-radius: 9px;
        box-shadow: inset 0 0 0 5px #56baff, 0 5px 12px rgba(0, 87, 151, .14);
    }
    .purchase-agreement-blue > .layui-layer-setwin {
        top: 14px !important;
        right: 15px !important;
    }
    .purchase-agreement-blue #buy-protocol {
        padding: 18px 14px 24px !important;
        font-size: 14.5px !important;
        line-height: 1.72 !important;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-risk-item {
        margin-bottom: 10px !important;
        padding: 12px 13px !important;
        border-radius: 11px;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning {
        display: block;
        font-size: 20px !important;
        line-height: 1.46 !important;
        letter-spacing: 0;
        animation-duration: 3.8s, 2.8s;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning-row {
        margin: 5px 0 11px !important;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-preview {
        height: clamp(280px, 44dvh, 380px);
        min-height: 280px;
        margin: 12px 0 20px;
        border-radius: 14px;
    }
    .purchase-agreement-preview__toolbar {
        height: 48px;
        gap: 8px;
        padding: 0 10px 0 12px;
    }
    .purchase-agreement-preview__title {
        gap: 7px;
        font-size: 13.5px;
    }
    .purchase-agreement-preview__browser-icon {
        height: 20px;
        padding: 0 5px;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-preview__open {
        min-height: 29px;
        padding: 0 9px;
        border-radius: 8px;
        font-size: 11.5px;
    }
    .purchase-agreement-preview__viewport { inset: 48px 0 0; }
    .purchase-agreement-blue > .layui-layer-btn {
        min-height: calc(62px + env(safe-area-inset-bottom));
        padding: 9px 13px max(11px, env(safe-area-inset-bottom)) !important;
        box-shadow: 0 -8px 18px rgba(0, 95, 155, .09);
    }
    .purchase-agreement-blue > .layui-layer-btn .layui-layer-btn0 {
        width: 100%;
        min-width: 0;
        height: 42px !important;
        padding: 0 18px !important;
        border-radius: 12px !important;
        font-size: 15px !important;
    }
}

@media (max-width: 900px) {
    .purchase-agreement-blue #buy-protocol .purchase-agreement-split {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "intro"
            "preview"
            "records";
        row-gap: 0;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-split > .purchase-agreement-preview {
        position: relative;
        top: auto;
        height: clamp(330px, 56dvh, 500px);
        min-height: 330px;
        margin: 12px 0 20px;
    }
}

@media (max-width: 640px) {
    .purchase-agreement-blue #buy-protocol .purchase-agreement-split > .purchase-agreement-preview {
        height: clamp(280px, 44dvh, 380px);
        min-height: 280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .layui-layer-page.purchase-agreement-blue,
    .layui-layer-page.purchase-agreement-blue.purchase-agreement-blue-closing {
        animation-duration: .01ms !important;
    }
    .layui-layer-shade.purchase-agreement-blue-shade,
    .layui-layer-shade.purchase-agreement-blue-shade.purchase-agreement-blue-shade-closing {
        transition-duration: .01ms !important;
    }
    .purchase-agreement-blue #buy-protocol .purchase-agreement-gradient-warning {
        animation: none !important;
        background-position: 50% 50%;
    }
    .purchase-agreement-preview__spinner {
        animation-duration: 1.4s;
    }
}
