.has-magma-payment-flow {
    overflow: hidden;
}

.magma-payment-flow {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: grid;
    place-items: start center;
    padding:
        max(14px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(14px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
    overflow-y: auto;
    color: var(--ink);
    pointer-events: none;
}

.magma-payment-flow[hidden],
.magma-payment-flow [hidden] {
    display: none !important;
}

.magma-payment-flow.is-open {
    pointer-events: auto;
}

.magma-payment-flow__backdrop {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 84% 8%, rgba(255, 92, 24, 0.18), transparent 29%),
        rgba(36, 11, 14, 0.72);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.magma-payment-flow__dialog {
    position: relative;
    z-index: 1;
    width: min(880px, calc(100vw - 24px));
    max-height: calc(100dvh - 28px);
    margin: auto;
    overflow-y: auto;
    border: 2px solid var(--red-main);
    border-radius: 0;
    background:
        linear-gradient(90deg, rgba(173, 32, 36, 0.038) 1px, transparent 1px),
        linear-gradient(180deg, rgba(173, 32, 36, 0.035) 1px, transparent 1px),
        #ffffff;
    background-size: 28px 28px, 28px 28px, auto;
    box-shadow:
        10px 10px 0 rgba(173, 32, 36, 0.18),
        0 34px 82px rgba(49, 7, 11, 0.3);
    opacity: 0;
    transform: translateY(16px);
    transition: width 0.22s ease, opacity 0.22s ease, transform 0.22s ease;
}

.magma-payment-flow.is-method-step .magma-payment-flow__dialog {
    width: min(640px, calc(100vw - 24px));
}

.magma-payment-flow.is-open .magma-payment-flow__backdrop {
    opacity: 1;
}

.magma-payment-flow.is-open .magma-payment-flow__dialog {
    opacity: 1;
    transform: translateY(0);
}

.magma-payment-flow__heatline {
    position: sticky;
    z-index: 3;
    top: 0;
    display: block;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #72090d 0 18%, #ad2024 18% 48%, #ef3d22 48% 72%, #ff7b19 72%);
}

.magma-payment-step {
    padding: 24px;
}

.magma-payment-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.magma-payment-head__eyebrow,
.magma-payment-order span,
.magma-payment-summary > p:first-child,
.magma-payment-summary__method span,
.magma-payment-order-id span {
    margin: 0 0 6px;
    color: rgba(122, 14, 19, 0.72);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    line-height: 1.3;
    text-transform: uppercase;
}

.magma-payment-head h3 {
    margin: 0;
    color: var(--ink);
    font-family: "Oxanium", sans-serif;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.magma-payment-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.magma-payment-close,
.magma-payment-change {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(173, 32, 36, 0.24);
    border-radius: 0;
    background: #fff8f5;
    color: var(--red-main);
}

.magma-payment-change {
    gap: 8px;
    padding: 0 13px;
    font-size: 12px;
    font-weight: 800;
}

.magma-payment-close:hover,
.magma-payment-change:hover {
    border-color: var(--red-main);
    background: var(--red-main);
    color: #ffffff;
}

.magma-payment-order {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 20px;
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(173, 32, 36, 0.18);
    background: #fff8f5;
}

.magma-payment-order strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.35;
}

.magma-payment-order__money {
    min-width: 92px;
    text-align: right;
}

[data-payment-item-name],
[data-checkout-item-name] {
    white-space: pre-line;
}

.magma-payment-order__money strong {
    color: var(--red-main);
    font-family: "Oxanium", sans-serif;
    font-size: 24px;
    line-height: 1;
}

.magma-payment-order__money small {
    display: block;
    margin-top: 5px;
    color: rgba(36, 22, 24, 0.58);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.magma-payment-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.magma-payment-method-country {
    margin-bottom: 18px;
}

.magma-payment-method-country input {
    max-width: 110px;
    text-transform: uppercase;
}

.magma-payment-method {
    position: relative;
    min-height: 76px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(36, 22, 24, 0.14);
    border-radius: 0;
    background: #ffffff;
    color: var(--ink);
    text-align: left;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.magma-payment-method::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: transparent;
}

.magma-payment-method:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: rgba(173, 32, 36, 0.5);
    background: #fff4f1;
}

.magma-payment-method:not(:disabled):hover::before {
    background: linear-gradient(180deg, var(--red-main), #ff7b19);
}

.magma-payment-method:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.magma-payment-method__mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(173, 32, 36, 0.18);
    background: #fff4f1;
    color: var(--red-main);
    font-size: 16px;
}

.magma-payment-method__copy {
    min-width: 0;
}

.magma-payment-method__copy strong,
.magma-payment-method__copy small {
    display: block;
}

.magma-payment-method__copy strong {
    overflow: hidden;
    color: inherit;
    font-family: "Oxanium", sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.magma-payment-method__copy small {
    margin-top: 4px;
    color: rgba(36, 22, 24, 0.56);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.magma-payment-method__arrow {
    color: rgba(173, 32, 36, 0.58);
    font-size: 12px;
}

.magma-payment-methods__note {
    margin: 13px 2px 0;
    color: rgba(36, 22, 24, 0.62);
    font-size: 11px;
    line-height: 1.55;
}

.magma-payment-methods__status,
.magma-payment-status {
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid rgba(173, 32, 36, 0.34);
    background: #fff0ec;
    color: #781218;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.magma-payment-methods__status--info,
.magma-payment-status--info {
    border-color: rgba(34, 96, 151, 0.28);
    background: #f1f7fc;
    color: #174c79;
}

.magma-payment-status--success {
    border-color: rgba(24, 119, 66, 0.28);
    background: #eff9f3;
    color: #17623a;
}

.magma-payment-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
    border: 1px solid rgba(173, 32, 36, 0.2);
    background: #ffffff;
}

.magma-payment-step--details.is-status-view .magma-payment-layout {
    grid-template-columns: 1fr;
}

.magma-payment-summary {
    position: relative;
    min-width: 0;
    padding: 24px 20px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(155deg, #7c1015, var(--red-main) 62%, #e54820);
    background-size: 24px 24px, 24px 24px, auto;
    color: #ffffff;
}

.magma-payment-summary::after {
    content: "";
    position: absolute;
    right: -55px;
    bottom: -55px;
    width: 150px;
    height: 150px;
    border: 24px solid rgba(255, 255, 255, 0.07);
    transform: rotate(28deg);
}

.magma-payment-summary > p:first-child {
    color: rgba(255, 255, 255, 0.7);
}

.magma-payment-summary__item {
    position: relative;
    z-index: 1;
    display: block;
    overflow-wrap: anywhere;
    font-family: "Oxanium", sans-serif;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.magma-payment-summary__price {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    font-family: "Oxanium", sans-serif;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.magma-payment-summary > small {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 10px;
    font-weight: 700;
}

.magma-payment-summary__method {
    position: relative;
    z-index: 1;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.magma-payment-summary__method span {
    display: block;
    color: rgba(255, 255, 255, 0.66);
}

.magma-payment-summary__method strong {
    display: block;
    margin-top: 5px;
    font-family: "Oxanium", sans-serif;
    font-size: 16px;
}

.magma-payment-summary__secure {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 26px 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    line-height: 1.5;
}

.magma-payment-summary__secure i {
    margin-top: 2px;
}

.magma-payment-main {
    min-width: 0;
    padding: 22px;
}

.magma-payment-form,
.magma-payment-card-fields {
    display: grid;
    gap: 13px;
}

.magma-payment-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.magma-payment-field {
    min-width: 0;
    display: grid;
    gap: 7px;
}

.magma-payment-field > span {
    color: rgba(36, 22, 24, 0.76);
    font-size: 12px;
    font-weight: 800;
}

.magma-payment-field > small {
    color: rgba(36, 22, 24, 0.58);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
}

.magma-payment-field input,
.magma-payment-field textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid rgba(36, 22, 24, 0.16);
    border-radius: 0;
    outline: 0;
    background: #fffaf8;
    color: var(--ink);
    font: inherit;
}

.magma-payment-field textarea {
    min-height: 82px;
    resize: vertical;
}

.magma-payment-field input::placeholder,
.magma-payment-field textarea::placeholder {
    color: rgba(36, 22, 24, 0.38);
}

.magma-payment-field input:focus,
.magma-payment-field textarea:focus {
    border-color: var(--red-main);
    box-shadow: inset 4px 0 0 var(--red-main);
    background: #ffffff;
}

.magma-payment-consent {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 13px;
    border: 1px solid rgba(173, 32, 36, 0.16);
    background: #fff8f5;
    color: rgba(36, 22, 24, 0.72);
    font-size: 11px;
    line-height: 1.55;
}

.magma-payment-consent input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    accent-color: var(--red-main);
}

.magma-payment-consent a {
    color: #8d1117;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.magma-payment-submit {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 2px;
    border: 1px solid var(--red-main);
    border-radius: 0;
    background: var(--red-main);
    color: #ffffff;
    font-weight: 900;
    letter-spacing: 0.01em;
}

.magma-payment-submit:hover {
    border-color: #851116;
    background: #851116;
}

.magma-payment-submit:disabled {
    opacity: 0.68;
    cursor: wait;
}

.magma-payment-order-id {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px solid rgba(173, 32, 36, 0.16);
    background: #fff8f5;
}

.magma-payment-order-id strong {
    overflow-wrap: anywhere;
    color: var(--ink);
    font-family: "Oxanium", sans-serif;
    font-size: 15px;
}

.magma-payment-close:focus-visible,
.magma-payment-change:focus-visible,
.magma-payment-method:focus-visible,
.magma-payment-submit:focus-visible,
.magma-payment-consent input:focus-visible,
.magma-payment-consent a:focus-visible {
    outline: 3px solid #176aa0;
    outline-offset: 3px;
}

@media (max-width: 760px) {
    .magma-payment-flow {
        padding:
            max(8px, env(safe-area-inset-top))
            max(7px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(7px, env(safe-area-inset-left));
    }

    .magma-payment-flow__dialog,
    .magma-payment-flow.is-method-step .magma-payment-flow__dialog {
        width: calc(100vw - 14px);
        max-height: calc(100dvh - 16px);
        box-shadow:
            5px 5px 0 rgba(173, 32, 36, 0.18),
            0 24px 54px rgba(49, 7, 11, 0.28);
    }

    .magma-payment-step {
        padding: 18px 15px;
    }

    .magma-payment-head {
        gap: 12px;
        margin-bottom: 16px;
    }

    .magma-payment-head h3 {
        font-size: 23px;
    }

    .magma-payment-change {
        width: 44px;
        padding: 0;
    }

    .magma-payment-change span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .magma-payment-order {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .magma-payment-order__money {
        text-align: left;
    }

    .magma-payment-methods,
    .magma-payment-form__grid,
    .magma-payment-layout {
        grid-template-columns: 1fr;
    }

    .magma-payment-method {
        min-height: 68px;
    }

    .magma-payment-summary {
        padding: 18px;
    }

    .magma-payment-summary__price {
        margin-top: 14px;
        font-size: 28px;
    }

    .magma-payment-summary__method {
        margin-top: 16px;
        padding-top: 13px;
    }

    .magma-payment-summary__secure {
        margin-top: 16px;
    }

    .magma-payment-main {
        padding: 18px 15px;
    }
}

@media (max-width: 390px) {
    .magma-payment-head__actions {
        gap: 5px;
    }

    .magma-payment-head h3 {
        font-size: 21px;
    }

    .magma-payment-close,
    .magma-payment-change {
        min-width: 42px;
        width: 42px;
        min-height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .magma-payment-flow__backdrop,
    .magma-payment-flow__dialog,
    .magma-payment-method {
        transition: none;
    }
}
