/* Recharge modal: a compact value-comparison surface for API developers. */
.recharge-modal {
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.recharge-content {
    width: min(94vw, 960px);
    max-width: 960px;
    max-height: calc(100vh - 40px);
    padding: 30px 32px 28px;
    border: 1px solid #dbe7f5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .18), 0 4px 14px rgba(37, 99, 235, .08);
}

.recharge-heading {
    padding: 0 42px 22px;
    text-align: center;
}

.recharge-eyebrow {
    display: block;
    margin-bottom: 7px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: uppercase;
}

.recharge-content h2 {
    margin: 0 0 7px;
    color: #172033;
    font-size: 28px;
    font-weight: 780;
    letter-spacing: 0;
    line-height: 1.2;
}

.recharge-tip {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.package-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.package-item {
    position: relative;
    min-height: 214px;
    padding: 21px 17px 15px;
    overflow: hidden;
    border: 2px solid #e5edf6;
    border-radius: 9px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
    color: #172033;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.package-item:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 24px rgba(37, 99, 235, .1);
    transform: translateY(-2px);
}

.package-item:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .25);
    outline-offset: 2px;
}

.package-item.active {
    border-color: #3b82f6;
    background: linear-gradient(180deg, #f1f7ff 0%, #f8fbff 100%);
    box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
}

/* The legacy theme also paints a checkmark; keep the dedicated mark as the single indicator. */
.package-item.active::after {
    content: none;
    display: none;
}

.package-selection-mark {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    transform: scale(.7);
    transition: opacity .18s ease, transform .18s ease;
}

.package-item.active .package-selection-mark {
    opacity: 1;
    transform: scale(1);
}

.package-amount {
    min-height: 32px;
    margin: 0 22px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #172033;
    font-size: 24px;
    font-weight: 780;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.package-jindou-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    object-fit: contain;
}

.package-bonus {
    min-height: 25px;
    margin-bottom: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.package-bonus-empty {
    visibility: hidden;
}

.package-total {
    min-height: 36px;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.3;
}

.package-total strong {
    color: #1e293b;
    font-size: 18px;
    font-weight: 760;
    font-variant-numeric: tabular-nums;
}

.package-total-label {
    color: #64748b;
}

.package-price {
    width: 100%;
    min-height: 39px;
    margin-top: auto;
    padding-top: 11px;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 3px;
    border-top: 1px solid #e8eef5;
    color: #2563eb;
    line-height: 1;
}

.package-price strong {
    font-size: 25px;
    font-weight: 780;
    font-variant-numeric: tabular-nums;
}

.package-currency {
    font-size: 13px;
    font-weight: 750;
}

.package-value {
    margin-top: 8px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
    white-space: nowrap;
}

.package-selection-summary {
    min-height: 46px;
    margin: 0 0 22px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fbff;
}

.package-selection-summary-label {
    flex: 0 0 auto;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
}

.package-selection-summary-value {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.payment-methods {
    gap: 10px;
    margin-bottom: 18px;
}

.payment-method {
    max-width: 180px;
    min-height: 66px;
    padding: 10px 14px;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    border: 2px solid #e5edf6;
    border-radius: 8px;
}

.payment-method:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .2);
    outline-offset: 2px;
}

.payment-method img {
    width: 28px;
    height: 28px;
}

.payment-method span {
    font-size: 13px;
    font-weight: 650;
}

.payment-method.active {
    border-color: #3b82f6;
    background: #f1f7ff;
}

.recharge-content.payment-request-pending .package-item,
.recharge-content.payment-request-pending .payment-method {
    cursor: wait;
    opacity: .7;
    pointer-events: none;
}

.payment-btn,
.primary-btn {
    min-height: 46px;
    border-radius: 8px;
    background: #2563eb;
    box-shadow: 0 8px 16px rgba(37, 99, 235, .2);
}

.payment-btn:hover,
.primary-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 10px 20px rgba(37, 99, 235, .25);
}

.modal-close {
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    font-size: 24px;
}

/* Keep the QR-code step focused regardless of the legacy modal stylesheet. */
.recharge-content.payment-qrcode-visible > .recharge-heading,
.recharge-content.payment-qrcode-visible > .package-list,
.recharge-content.payment-qrcode-visible > .package-selection-summary,
.recharge-content.payment-qrcode-visible > .payment-methods,
.recharge-content.payment-qrcode-visible > .payment-btn {
    display: none;
}

.recharge-content.payment-qrcode-visible .qrcode-container {
    margin-top: 0;
}

@media (max-width: 900px) and (min-width: 769px) {
    .recharge-content {
        padding: 26px 24px 24px;
    }

    .package-list {
        gap: 10px;
    }

    .package-item {
        padding-inline: 12px;
    }

    .package-amount {
        font-size: 21px;
    }
}

@media (max-width: 768px) {
    .recharge-modal {
        align-items: flex-start;
        overflow-y: auto;
        padding: 12px 0;
    }

    .recharge-content {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        margin: 0 auto;
        padding: 24px 16px 18px;
        border-radius: 12px;
    }

    .recharge-heading {
        padding: 0 26px 18px;
    }

    .recharge-content h2 {
        font-size: 24px;
    }

    .recharge-tip {
        font-size: 12px;
    }

    .package-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .package-item {
        min-height: 210px;
        padding: 18px 9px 13px;
    }

    .package-amount {
        margin-inline: 15px;
        font-size: 19px;
        gap: 5px;
    }

    .package-jindou-icon {
        width: 17px;
        height: 17px;
    }

    .package-total strong {
        font-size: 16px;
    }

    .package-price strong {
        font-size: 21px;
    }

    .package-value {
        font-size: 10px;
    }

    .package-selection-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        margin-bottom: 18px;
    }

    .package-selection-summary-value {
        text-align: left;
    }

    .payment-methods {
        flex-direction: row;
    }

    .payment-method {
        min-width: 0;
        max-width: none;
        padding-inline: 8px;
    }
}

@media (max-width: 360px) {
    .package-item {
        min-height: 202px;
        padding-inline: 6px;
    }

    .package-amount {
        font-size: 17px;
    }

    .package-bonus {
        padding-inline: 6px;
        font-size: 11px;
    }

    .package-value {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .package-item,
    .package-selection-mark,
    .payment-btn,
    .primary-btn {
        transition: none;
    }
}
