*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f2f4f7;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pay-wrap {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    padding: 28px 24px;
    width: 100%;
    max-width: 420px;
}

/* Header */
.pay-header { text-align: center; margin-bottom: 24px; }
.pay-product { font-size: 15px; color: #666; margin-bottom: 6px; }
.pay-amount  { font-size: 32px; font-weight: 700; color: #1a1a2e; }

/* Steps */
.pay-step   { }
.pay-hidden { display: none !important; }

.step-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #444;
}

/* Method list */
.method-list { display: flex; flex-direction: column; gap: 10px; }

.method-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid #eaecf2;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: border-color .2s, background .2s, box-shadow .2s, transform .1s;
}
.method-btn:hover {
    border-color: #5b7cf6;
    background: #f5f7ff;
    box-shadow: 0 3px 16px rgba(91,124,246,.1);
}
.method-btn:active { transform: scale(.99); }

/* Icon box */
.mb-icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #eef1ff;
    color: #5b7cf6;
}
.mb-icon--sbp     { background: #e6faf3; color: #1dba7a; }
.mb-icon--card    { background: #eef1ff; color: #5b7cf6; }
.mb-icon--sberpay { background: #e8f5eb; color: #21a038; }

/* Text block */
.mb-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.mb-label {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.2;
}
.mb-sub {
    font-size: 12px;
    color: #aab0c0;
    font-weight: 400;
}

/* Arrow */
.mb-arrow {
    color: #d4d9e8;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color .2s;
}
.method-btn:hover .mb-arrow { color: #5b7cf6; }

/* Detail rows */
.pay-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.detail-label { font-size: 12px; color: #9ca3af; }
.detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.detail-value {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Карточный номер — равноширинные цифры, пробелы между группами */
.detail-value--card {
    font-family: 'SF Mono', 'Roboto Mono', 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Copy button */
.copy-btn {
    padding: 4px 10px;
    border: 1px solid #c0c8ff;
    border-radius: 6px;
    background: #f5f7ff;
    color: #5b7cf6;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.copy-btn:hover { background: #e8ecff; }
.copy-btn.copied { background: #d4edda; border-color: #6dbb7a; color: #2d7a3a; }

/* Amount notice */
.amount-notice {
    font-size: 12px;
    color: #92400e;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 7px 12px;
    margin-top: 6px;
    line-height: 1.5;
}

/* QR */
.qr-hint { font-size: 14px; color: #666; margin-bottom: 12px; text-align: center; }
#qr-img  { display: block; margin: 0 auto; max-width: 220px; border-radius: 8px; }

/* Timer */
.pay-timer {
    text-align: center;
    font-size: 13px;
    color: #888;
    margin: 16px 0 20px;
}
#timer-val { font-weight: 600; color: #e05a5a; }

/* Actions */
.pay-actions { display: flex; gap: 10px; }
.btn-primary, .btn-secondary {
    flex: 1;
    padding: 13px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.btn-primary   { background: #5b7cf6; color: #fff; }
.btn-secondary { background: #f0f0f0; color: #555; }
.btn-primary:hover, .btn-secondary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .5; cursor: default; }

/* Status message */
.pay-status-msg {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}
.pay-status-msg.msg-ok   { background: #d4edda; color: #2d7a3a; }
.pay-status-msg.msg-wait { background: #fff3cd; color: #856404; }
.pay-status-msg.msg-err  { background: #f8d7da; color: #721c24; }

/* Loader */
.loader {
    width: 40px; height: 40px;
    border: 4px solid #e0e0e0;
    border-top-color: #5b7cf6;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 24px auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result-icon {
    font-size: 48px;
    text-align: center;
    margin: 12px 0 16px;
}
.result-ok   { color: #5bb57a; }
.result-fail { color: #e05a5a; }

.pay-error { color: #e05a5a; font-size: 14px; text-align: center; }

/* ── Card Preview (визуальная карта) ──────────────────────────────────── */
.card-preview {
    background: linear-gradient(135deg, #232946 0%, #3d52a0 60%, #5b7cf6 100%);
    border-radius: 18px;
    padding: 20px 22px 18px;
    color: #fff;
    margin-bottom: 22px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(61, 82, 160, .4);
    transition: background .4s ease;
}
.card-preview::before {
    content: '';
    position: absolute;
    top: -60px; right: -40px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    pointer-events: none;
}
.card-preview::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -30px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
    pointer-events: none;
}

/* Смена градиента по типу карты */
.card-preview.brand-visa {
    background: linear-gradient(135deg, #0d2b55 0%, #1060a8 60%, #2196f3 100%);
    box-shadow: 0 12px 32px rgba(21, 96, 168, .45);
}
.card-preview.brand-mc {
    background: linear-gradient(135deg, #1a0505 0%, #8b0000 55%, #c0392b 100%);
    box-shadow: 0 12px 32px rgba(139, 0, 0, .45);
}
.card-preview.brand-mir {
    background: linear-gradient(135deg, #062d12 0%, #0a7a33 55%, #27ae60 100%);
    box-shadow: 0 12px 32px rgba(10, 122, 51, .40);
}

.card-chip {
    width: 40px; height: 30px;
    border-radius: 6px;
    background: linear-gradient(145deg, #c09020 0%, #f0c84a 45%, #c09020 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    margin-bottom: 18px;
    position: relative; z-index: 1;
}
.card-num-display {
    font-size: 18px;
    letter-spacing: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    margin-bottom: 20px;
    position: relative; z-index: 1;
    text-shadow: 0 1px 4px rgba(0,0,0,.25);
    white-space: nowrap;
}
.card-preview-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    position: relative; z-index: 1;
}
.cprev-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .8px;
    opacity: .65;
    margin-bottom: 3px;
}
.cprev-val {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.5px;
}
.cprev-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .9;
    text-align: center;
}
.cprev-brand {
    font-size: 14px;
    font-weight: 800;
    font-style: italic;
    opacity: .9;
    text-align: right;
    min-width: 52px;
    letter-spacing: .5px;
}

/* ── Card Inputs ───────────────────────────────────────────────────────── */
.ci-wrap {
    margin-bottom: 12px;
}
.ci-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 6px;
}
.ci-input {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: #f8f9fc;
    color: #1a1a2e;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.ci-input:focus {
    outline: none;
    border-color: #5b7cf6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(91, 124, 246, .12);
}
.ci-input::placeholder { color: #c8cdd8; }

.ci-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.ci-row .ci-wrap { margin-bottom: 0; }

.ci-error { text-align: left; margin-top: 4px; }

/* Waiting step */
.wait-loader { margin: 8px auto 20px; }
.wait-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin-bottom: 10px;
}
.wait-sub {
    font-size: 13px;
    color: #888;
    text-align: center;
    line-height: 1.6;
}
.wait-tm { margin-top: 20px; }

@media (max-width: 440px) {
    .pay-wrap { padding: 20px 16px; border-radius: 12px; }
    .pay-amount { font-size: 26px; }
    .card-num-display { font-size: 15px; letter-spacing: 2px; }
    .ci-row { gap: 8px; }
}

/* ── Deeplinks (bank app buttons) ────────────────────────────────────── */
#deeplinks-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
    padding: 16px;
    background: #f8fffe;
    border: 1.5px solid #d1fae5;
    border-radius: 14px;
}
.deeplinks-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 2px;
}
/* Высокая специфичность — защита от CSS партнёрского сайта */
#deeplinks-block a.deeplink-btn,
#deeplinks-block .deeplink-btn {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 14px 20px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    cursor: pointer !important;
    text-align: center !important;
    text-decoration: none !important;
    transition: opacity .2s, transform .1s;
    line-height: 1.4 !important;
    border: none !important;
    margin: 0 !important;
}
#deeplinks-block a.deeplink-btn:active,
#deeplinks-block .deeplink-btn:active { transform: scale(.98); }

#deeplinks-block a.deeplink-btn-primary,
#deeplinks-block .deeplink-btn-primary {
    background: #21a038 !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(33,160,56,.25);
}
#deeplinks-block a.deeplink-btn-primary:hover,
#deeplinks-block .deeplink-btn-primary:hover { opacity: .9; }

#deeplinks-block a.deeplink-btn-secondary,
#deeplinks-block .deeplink-btn-secondary {
    background: #f0fdf4 !important;
    color: #166534 !important;
    border: 1.5px solid #86efac !important;
}
#deeplinks-block a.deeplink-btn-secondary:hover,
#deeplinks-block .deeplink-btn-secondary:hover { background: #dcfce7 !important; }

/* ── Screenshot Popup ─────────────────────────────────────────────────── */
.sc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.sc-hidden { display: none !important; }

.sc-modal {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sc-modal-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d3461 100%);
    color: #fff;
    padding: 18px 22px;
    border-radius: 18px 18px 0 0;
}
.sc-modal-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.sc-modal-body  { padding: 20px 22px 4px; }
.sc-modal-footer { padding: 0 22px 20px; }

.sc-text {
    font-size: 13px;
    color: #555;
    line-height: 1.65;
    margin-bottom: 14px;
}

/* File drop zone */
.sc-file-zone {
    border: 2px dashed #d0d5e8;
    border-radius: 12px;
    padding: 18px 14px;
    text-align: center;
    margin-bottom: 12px;
    background: #f8f9fc;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
}
.sc-file-zone:hover { border-color: #5b7cf6; background: #f0f3ff; }

.sc-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}
.sc-file-label {
    font-size: 14px;
    font-weight: 600;
    color: #5b7cf6;
    display: block;
    pointer-events: none;
}
.sc-thumbnail {
    display: block;
    max-height: 110px;
    max-width: 100%;
    margin: 10px auto 0;
    border-radius: 8px;
    object-fit: contain;
}

/* Textarea */
.sc-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    margin-bottom: 10px;
    background: #f8f9fc;
    color: #1a1a2e;
    transition: border-color .18s;
}
.sc-textarea:focus  { outline: none; border-color: #5b7cf6; background: #fff; }
.sc-textarea::placeholder { color: #c8cdd8; }

/* Progress bar */
.sc-progress {
    height: 6px;
    background: #eef0f5;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 16px;
    margin-bottom: 20px;
}
.sc-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #5b7cf6, #8ba4ff);
    border-radius: 3px;
    transition: width 1.2s ease;
}

/* Reject view */
.sc-reject-list {
    font-size: 12px;
    color: #888;
    margin: 6px 0 16px;
    padding-left: 18px;
    line-height: 1.9;
}
.sc-reject-msg {
    font-size: 13px;
    font-weight: 600;
    color: #e05a5a;
    margin-bottom: 10px;
}

/* Full-width helper */
.sc-btn-full { width: 100%; margin-bottom: 10px; }
