body {
    font-family: 'Inter', sans-serif;
}

#payment-feedback {
    white-space: pre-line;
}

.card-preview {
    transition: background 0.35s ease, box-shadow 0.35s ease;
}

.card-preview--default {
    background: linear-gradient(135deg, #1e40af 0%, #0052ff 55%, #38bdf8 100%);
    box-shadow: 0 20px 25px -5px rgba(0, 82, 255, 0.2);
}

.card-preview--visa {
    background: linear-gradient(135deg, #071b4f 0%, #1434a4 58%, #2563eb 100%);
    box-shadow: 0 20px 25px -5px rgba(20, 52, 164, 0.3);
}

.card-preview--visa::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    bottom: 0;
    width: 4rem;
    height: 0.25rem;
    border-radius: 0.25rem 0.25rem 0 0;
    background: #f7b600;
}

.card-preview--mastercard {
    background: linear-gradient(135deg, #111827 0%, #252b36 58%, #3b414b 100%);
    box-shadow: 0 20px 25px -5px rgba(17, 24, 39, 0.35);
}

.card-brand-mark {
    min-width: 4.5rem;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 1.9rem;
}

.card-brand-mark--visa {
    color: #fff;
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.08em;
}

.card-brand-mark--mastercard {
    min-width: 4.5rem;
    position: relative;
}

.mastercard-logo {
    position: relative;
    display: block;
    width: 3.2rem;
    height: 2rem;
}

.mastercard-logo::before,
.mastercard-logo::after {
    content: "";
    position: absolute;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
}

.mastercard-logo::before {
    left: 0;
    background: #eb001b;
}

.mastercard-logo::after {
    right: 0;
    background: #f79e1b;
    opacity: 0.95;
}

.card-preview--visa #card-preview-number,
.card-preview--mastercard #card-preview-number {
    color: #fff;
}

.card-preview--visa .card-detail-label {
    color: #bfdbfe;
}

.card-preview--mastercard .card-detail-label {
    color: #d1d5db;
}

.challenge-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.72);
}

.challenge-modal[hidden] {
    display: none;
}

body.challenge-open {
    overflow: hidden;
}

.challenge-dialog {
    display: flex;
    flex-direction: column;
    width: min(100%, 34rem);
    max-height: min(90vh, 52rem);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
}

.challenge-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.challenge-dialog-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.125rem;
    font-weight: 700;
}

.challenge-dialog-header p,
.challenge-dialog-status {
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
}

.challenge-close {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.challenge-close:hover {
    background: #e2e8f0;
}

.challenge-dialog-status {
    padding: 0 1.5rem;
    white-space: pre-line;
}

.challenge-dialog-status.is-error {
    margin: 0.75rem 1.5rem 0;
    padding: 0.875rem 1rem;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 700;
}

.challenge-cvv {
    display: grid;
    gap: 0.4rem;
    margin: 0.75rem 1.5rem 0;
}

.challenge-cvv[hidden] {
    display: none;
}

.challenge-cvv label {
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
}

.challenge-cvv input {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.625rem;
    font: inherit;
}

.challenge-cvv input:focus {
    border-color: #2563eb;
    outline: 2px solid #bfdbfe;
}

.challenge-cvv span {
    color: #64748b;
    font-size: 0.75rem;
}

.challenge-continue {
    display: inline-flex;
    min-height: 2.75rem;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 1.5rem 0;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 0.75rem;
    background: #0052ff;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.challenge-continue:hover:not(:disabled) {
    background: #1d4ed8;
}

.challenge-continue:disabled {
    cursor: wait;
    opacity: 0.7;
}

.challenge-continue[hidden] {
    display: none;
}

#challenge-iframe {
    width: 100%;
    height: min(62vh, 38rem);
    min-height: 22rem;
    flex: 1 1 auto;
    margin-top: 0.75rem;
    border: 0;
    background: #fff;
}

@media print {
    @page {
        margin: 1.5cm;
    }

    body * {
        visibility: hidden !important;
    }

    #step-4,
    #step-4 * {
        visibility: visible !important;
    }

    #step-4 {
        position: absolute !important;
        inset: 0 auto auto 0;
        display: block !important;
        width: 100%;
        padding: 0 !important;
        color: #0f172a;
        background: #fff;
    }

    #step-4 > div:first-child {
        max-width: none;
        margin-bottom: 1.5rem;
    }

    #step-4 > div:first-child > div {
        display: none;
    }

    #step-4 > div:nth-child(2) {
        margin: 0;
        padding: 1.25rem;
        border: 1px solid #cbd5e1;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
    }

    #step-4 > div:last-child {
        display: none !important;
    }
}

/* Custom Animations & Transitions */
.step-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.check-animation {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: dash 0.9s ease-in-out forwards 0.2s;
}

@keyframes dash {
    to {
        stroke-dashoffset: 0;
    }
}

.pulse-subtle {
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 82, 255, 0.3);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 82, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 82, 255, 0);
    }
}