:root {
    --bg: #faf8f5;
    --bg2: #f7f3eb;
    --card: #ffffff;
    --card2: #fdfaf3;
    --line: rgba(197, 160, 89, .28);
    --line2: rgba(197, 160, 89, .45);
    --gold: #96762f;
    --gold-2: #c5a059;
    --gold-soft: #96762f;
    --gold-glow: rgba(197, 160, 89, .35);
    --grad-gold: linear-gradient(120deg, #d4af37, #b8913d 45%, #96762f);
    --text: #1a1a1a;
    --muted: #6d685a;
    --faint: #8a8574;
    --ok: #0f9d6e;
    --err: #cf1020;
    --warn: #b7791f;
    --radius: 22px;
    --shadow: 0 2px 6px rgba(23, 19, 8, .05), 0 14px 32px rgba(23, 19, 8, .08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 500px at 85% -8%, rgba(197, 160, 89, .13), transparent 60%),
        radial-gradient(900px 460px at 6% 14%, rgba(197, 160, 89, .08), transparent 55%),
        radial-gradient(760px 520px at 50% 112%, rgba(150, 118, 47, .08), transparent 60%);
    background-attachment: fixed;
    color: var(--text);
    font-family: Vazirmatn, system-ui, -apple-system, Tahoma, sans-serif;
    font-size: 15px;
    line-height: 1.95;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: rgba(197, 160, 89, .35); color: #1a1a1a; }


.wrap {
    max-width: 700px;
    margin: 0 auto;
    padding: 28px 16px 48px;
}

/* ------------------------------------------------------------------ brand */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.brand-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    background: var(--grad-gold);
    box-shadow: 0 8px 18px rgba(150, 118, 47, .28), inset 0 0 0 2px rgba(255, 255, 255, .25);
    position: relative;
}

.brand-mark::after {
    content: "SM";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.5; }
.brand-text strong { font-size: 16px; font-weight: 900; }
.brand-text span { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------------- card */

.card {
    background: linear-gradient(160deg, var(--card) 0%, var(--card2) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px 22px;
    box-shadow: var(--shadow);
}

.card, .result { position: relative; overflow: hidden; }
.card::before, .result::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: var(--grad-gold);
}

.card-head h1 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.card-head p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; }

.price-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--line2);
    border-radius: 16px;
    background: linear-gradient(160deg, var(--card2), var(--bg2));
}

.price-box span { color: var(--muted); font-size: 13px; }
.price-box strong { font-size: 22px; font-weight: 900; color: var(--gold); }
.price-box small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ------------------------------------------------------------------ alert */

.alert {
    list-style: none;
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(238, 43, 43, .35);
    background: rgba(238, 43, 43, .07);
    color: var(--err);
    font-size: 13.5px;
}

.alert li + li { margin-top: 4px; }

/* ------------------------------------------------------------------ form */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field label em { color: #ee2b2b; font-style: normal; }

.field input,
.field select {
    width: 100%;
    padding: 11px 13px;
    border-radius: 13px;
    border: 1px solid var(--line2);
    background: var(--card2);
    color: var(--text);
    font-family: inherit;
    font-size: 14.5px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.field input::placeholder { color: var(--faint); }

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--gold-2);
    background: #fff;
    box-shadow: 0 0 0 4px var(--gold-glow);
}

.field input.invalid,
.field select.invalid {
    border-color: rgba(238, 43, 43, .7);
    box-shadow: 0 0 0 4px rgba(238, 43, 43, .12);
}

.hint { font-size: 11.5px; color: var(--muted); }

/* ---------------------------------------------------------- انتخاب درگاه */

.gateways {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.gateways.invalid {
    border-radius: 14px;
    box-shadow: 0 0 0 3px rgba(238, 43, 43, .14);
}

.gateway {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card2);
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.gateway:hover { border-color: var(--line2); }

.gateway input {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    position: relative;
    border: 1px solid var(--line2);
    border-radius: 50%;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.gateway input::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--gold-2);
    transform: scale(0);
    transition: transform .16s ease;
}

.gateway input:checked { border-color: var(--gold-2); }

.gateway input:checked::after { transform: scale(1); }

.gateway input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.gateway:has(input:checked) {
    border-color: var(--gold-2);
    background: #fff;
    box-shadow: 0 0 0 3px var(--gold-glow);
}

.gateway-body { display: flex; flex-direction: column; gap: 3px; }

.gateway-body strong { font-size: 14px; font-weight: 600; color: var(--text); }

.gateway-body small { font-size: 11.5px; line-height: 1.7; color: var(--muted); }

.sep {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 20px 0 18px;
}

/* ------------------------------------------------------------------ button */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 22px;
    padding: 14px 20px;
    border: 0;
    border-radius: 99px;
    background: linear-gradient(135deg, #ff6b6b, #ee2b2b 55%, #cf1020);
    color: #fff;
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}

.btn { box-shadow: 0 10px 24px rgba(238, 43, 43, .28); }
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 30px rgba(238, 43, 43, .34); }

.btn:disabled {
    filter: grayscale(.5) brightness(.8);
    cursor: progress;
    transform: none;
    box-shadow: none;
}

.btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line2);
    box-shadow: none;
    font-weight: 700;
}

.btn.ghost:hover { box-shadow: none; filter: none; border-color: var(--gold-2); color: var(--gold); }

.note { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------------ result */

.result {
    background: linear-gradient(160deg, var(--card) 0%, var(--card2) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 22px;
    text-align: center;
    box-shadow: var(--shadow);
}

.result-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
}

.result.ok .result-icon {
    background: rgba(15, 157, 110, .1);
    color: var(--ok);
    border: 1px solid rgba(15, 157, 110, .35);
}

.result.bad .result-icon {
    background: rgba(238, 43, 43, .08);
    color: var(--err);
    border: 1px solid rgba(238, 43, 43, .35);
}

.result h1 { margin: 0 0 10px; font-size: 19px; font-weight: 900; }
.result > p { margin: 0; color: var(--muted); font-size: 14px; }
.result .detail {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--faint);
    direction: rtl;
    word-break: break-word;
}

.summary {
    text-align: right;
    margin: 22px 0 4px;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--card);
}

.summary .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 15px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--line);
}

.summary .row:last-child { border-bottom: 0; }
.summary .row span { color: var(--muted); flex: 0 0 auto; }
.summary .row b { font-weight: 600; text-align: left; }

.summary .row b.code {
    font-family: "JetBrains Mono", Consolas, monospace;
    direction: ltr;
    letter-spacing: 1px;
    color: var(--gold);
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.actions .btn { margin-top: 0; }

/* ------------------------------------------------------------------ footer */

.foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    font-size: 12.5px;
    color: var(--muted);
}

.foot a { color: var(--gold); font-weight: 700; text-decoration: none; border-bottom: 1px dotted var(--gold-2); }
.foot a:hover { color: var(--gold-2); }

/* --------------------------------------------------------------- responsive */

@media (max-width: 600px) {
    .grid { grid-template-columns: 1fr; }
    .card, .result { padding: 20px 16px; }
    .actions { flex-direction: column; }
}

/* ==========================================================================
   صفحه‌ی موفقیت پرداخت: نشان متحرک، کد رهگیری، کانفتی
   ========================================================================== */

.sr-copy { position: fixed; top: -200px; opacity: 0; }

.result.ok { animation: cardRise .7s cubic-bezier(.2, .8, .2, 1) both; padding-top: 34px; }

.success-badge {
    position: relative;
    width: 92px;
    height: 92px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, rgba(15, 157, 110, .1) 100%);
    box-shadow: 0 10px 28px rgba(15, 157, 110, .22);
    animation: badgePop .6s cubic-bezier(.2, 1.3, .4, 1) .1s both;
}

.success-badge::before,
.success-badge::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(15, 157, 110, .45);
    animation: ringOut 2.4s ease-out 1s infinite;
}

.success-badge::after { animation-delay: 1.8s; }

.success-badge svg { position: relative; display: block; }

.sb-circle {
    stroke: var(--ok);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    transform-origin: center;
    transform: rotate(-90deg);
    animation: drawLine .75s cubic-bezier(.65, 0, .35, 1) .25s forwards;
}

.sb-check {
    stroke: var(--ok);
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: drawLine .5s cubic-bezier(.65, 0, .35, 1) .9s forwards;
}

.result.ok h1 { animation: fadeUp .6s ease .5s both; }
.result.ok > p { animation: fadeUp .6s ease .6s both; }

/* کارت کد رهگیری */
.code-card {
    position: relative;
    overflow: hidden;
    margin: 22px 0 4px;
    padding: 16px 16px 14px;
    border: 1px dashed var(--gold-2);
    border-radius: 18px;
    background: linear-gradient(160deg, var(--card2), var(--bg2));
    animation: fadeUp .6s ease .75s both;
}

.code-card::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .75), rgba(255, 255, 255, 0));
    transform: translateX(-220%) skewX(-18deg);
    animation: sheen 4.5s ease-in-out 1.6s infinite;
}

.code-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }

.code-value {
    display: block;
    margin: 4px 0 10px;
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: clamp(18px, 5vw, 24px);
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--gold);
    user-select: all;
    cursor: pointer;
}

.copy-btn {
    padding: 7px 20px;
    border: 1px solid var(--line2);
    border-radius: 99px;
    background: var(--card);
    color: var(--gold);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s, transform .15s;
}

.copy-btn:hover { border-color: var(--gold-2); transform: translateY(-1px); }
.copy-btn.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }

/* ردیف‌های خلاصه با ورود پله‌ای */
.result.ok .summary .row { animation: fadeUp .5s ease both; }
.result.ok .summary .row:nth-child(1) { animation-delay: .9s; }
.result.ok .summary .row:nth-child(2) { animation-delay: 1s; }
.result.ok .summary .row:nth-child(3) { animation-delay: 1.1s; }
.result.ok .summary .row:nth-child(4) { animation-delay: 1.2s; }
.result.ok .summary .row:nth-child(5) { animation-delay: 1.3s; }
.result.ok .summary .row:nth-child(6) { animation-delay: 1.4s; }
.result.ok .summary .row:nth-child(n+7) { animation-delay: 1.5s; }
.result.ok .note { animation: fadeUp .6s ease 1.5s both; }
.result.ok .actions { animation: fadeUp .6s ease 1.6s both; }

/* کانفتی */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.confetti i {
    position: absolute;
    top: -14px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    background: var(--gold-2);
    animation: confettiFall 2.8s cubic-bezier(.3, .6, .4, 1) forwards;
}

.confetti i:nth-child(3n)   { background: #ee2b2b; width: 7px; height: 7px; border-radius: 50%; }
.confetti i:nth-child(3n+1) { background: #d4af37; }
.confetti i:nth-child(3n+2) { background: var(--ok); height: 10px; }

.confetti i:nth-child(1)  { left: 6%;  animation-delay: .35s; }
.confetti i:nth-child(2)  { left: 14%; animation-delay: .55s; }
.confetti i:nth-child(3)  { left: 22%; animation-delay: .4s; }
.confetti i:nth-child(4)  { left: 31%; animation-delay: .7s; }
.confetti i:nth-child(5)  { left: 40%; animation-delay: .45s; }
.confetti i:nth-child(6)  { left: 48%; animation-delay: .8s; }
.confetti i:nth-child(7)  { left: 56%; animation-delay: .5s; }
.confetti i:nth-child(8)  { left: 64%; animation-delay: .75s; }
.confetti i:nth-child(9)  { left: 72%; animation-delay: .4s; }
.confetti i:nth-child(10) { left: 80%; animation-delay: .65s; }
.confetti i:nth-child(11) { left: 88%; animation-delay: .5s; }
.confetti i:nth-child(12) { left: 94%; animation-delay: .85s; }
.confetti i:nth-child(13) { left: 36%; animation-delay: 1s; }
.confetti i:nth-child(14) { left: 68%; animation-delay: .95s; }

@keyframes cardRise { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes badgePop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes ringOut { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes confettiFall {
    0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
    12%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(380px) translateX(24px) rotate(540deg); }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes sheen {
    0%   { transform: translateX(-220%) skewX(-18deg); }
    60%  { transform: translateX(320%) skewX(-18deg); }
    100% { transform: translateX(320%) skewX(-18deg); }
}

@media (prefers-reduced-motion: reduce) {
    .result.ok, .result.ok *, .success-badge, .success-badge::before, .success-badge::after,
    .sb-circle, .sb-check, .code-card, .code-card::after, .confetti i {
        animation: none !important;
    }
    .sb-circle, .sb-check { stroke-dashoffset: 0; }
    .confetti { display: none; }
}