* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: Tahoma, Vazirmatn, "Segoe UI", sans-serif;
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
}

/* دایره سرمه‌ای پشت کارت – دقیقا مثل تصویر */
.blue-circle {
  position: absolute;
  width: 620px;
  height: 620px;
  background: #2f4e7f;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
}

@media (max-width: 700px) {
  .blue-circle { width: 420px; height: 420px; }
}

/* کارت سفید */
.card {
  position: relative;
  z-index: 1;
  width: 430px;
  max-width: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.22), 0 5px 18px rgba(0,0,0,0.12);
  overflow: hidden;
}

/* هدر */
.card-header {
  background: #fff;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 28px;
  border-bottom: 1px solid #eee;
}
.logo { display: flex; align-items: center; }

/* بدنه خاکستری روشن */
.card-body {
  background: #f4f4f4;
  padding: 14px 22px 22px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: #555;
}
.title { font-weight: 400; color: #555; }
.timer { color: #7a6a5a; font-size: 12px; }
.timer b { color: #555; font-weight: 700; letter-spacing: 1px; }

.field { margin-bottom: 10px; }
.field label {
  display: block;
  text-align: right;
  font-size: 13px;
  color: #4a4a4a;
  margin-bottom: 5px;
}

.inp {
  width: 100%;
  height: 34px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  outline: none;
  padding: 0 10px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.inp:focus { border-color: #4a7ab5; box-shadow: 0 0 0 2px rgba(74,122,181,0.15); }
.ltr { direction: ltr; text-align: left; }

/* شماره کارت – ۴ باکس */
.card-numbers {
  display: flex;
  gap: 7px;
  direction: rtl;
}
.card-numbers .inp {
  text-align: center;
  letter-spacing: 2px;
  direction: ltr;
  font-size: 15px;
}

/* تاریخ انقضا */
.expire-row {
  display: flex;
  gap: 14px;
}
.expire-box {
  flex: 1;
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  overflow: hidden;
  height: 34px;
}
.expire-box .expire-inp {
  border: none;
  box-shadow: none;
  border-radius: 0;
  height: 100%;
  text-align: center;
  direction: ltr;
}
.expire-box .expire-inp:focus { box-shadow: none; }
.expire-box:focus-within { border-color: #4a7ab5; }
.suffix {
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7f7f7;
  border-left: 1px solid #e5e5e5;
  font-size: 13px;
  color: #555;
}

/* کپچا */
.captcha-row {
  display: flex;
  gap: 10px;
}
.captcha-inp { flex: 1; }
.captcha-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 2px 6px 2px 2px;
  height: 34px;
  overflow: hidden;
}
#captchaCanvas {
  flex: 1;
  width: 100%;
  height: 28px;
  direction: ltr;
}
.refresh {
  border: none;
  background: transparent;
  color: #3aa67a;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.refresh:hover { transform: rotate(60deg); }

/* دکمه‌ها – دقیقا مثل تصویر */
.btn-row {
  display: flex;
  gap: 14px;
  margin-top: 18px;
}
.btn {
  flex: 1;
  height: 36px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  color: #fff;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.pay { background: #3ac37d; box-shadow: 0 2px 6px rgba(58,195,125,.4); }
.pay:hover { filter: brightness(.95); }
.cancel { background: #f7315b; box-shadow: 0 2px 6px rgba(247,49,91,.35); }
.cancel:hover { filter: brightness(.95); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* --- افزوده‌های سناریوی کامل درگاه (ظاهر اصلی حفظ شده) --- */
.trans-info {
  background: #fff;
  border: 1px dashed #cfd8e3;
  border-radius: 6px;
  font-size: 12.5px;
  color: #445;
  padding: 8px 10px;
  margin-bottom: 10px;
  text-align: center;
}
.trans-info b { color: #1a7a45; }
.trans-info .tid { color: #888; font-size: 11px; }
.msg {
  background: #fde8ec;
  border: 1px solid #f5b5c1;
  color: #b3123a;
  border-radius: 6px;
  font-size: 12.5px;
  padding: 8px 10px;
  margin-bottom: 10px;
  text-align: center;
}
.msg.ok { background: #e6f7ec; border-color: #9edbaf; color: #1a7a45; }
.link-btn {
  border: none; background: none; color: #4a7ab5;
  font-size: 11.5px; font-family: inherit; cursor: pointer;
  margin-top: 4px; padding: 0;
}
.link-btn:hover { text-decoration: underline; }
.otp-row { display: flex; gap: 8px; }
.otp-row .inp { flex: 1; }
.otp-btn {
  white-space: nowrap;
  border: 1px solid #4a7ab5; background: #eef4fb; color: #2f5b94;
  border-radius: 5px; font-family: inherit; font-size: 12px;
  padding: 0 12px; cursor: pointer; height: 34px;
}
.otp-btn:disabled { opacity: .6; cursor: not-allowed; }
.otp-hint { font-size: 11.5px; color: #777; margin-top: 5px; }
.otp-code { color: #1a7a45; font-size: 15px; letter-spacing: 3px; }
#captchaImg { flex: 1; width: 100%; height: 28px; background: #fff; }
.shop-logo { color: #2f4e7f; font-size: 15px; }
.hint { font-size: 11.5px; color: #888; margin-top: 12px; text-align: center; line-height: 1.9; }
.receipt { background: #fff; border: 1px solid #e2e2e2; border-radius: 6px; padding: 6px 12px; margin-bottom: 6px; }
.r-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; color: #444; }
.r-row:last-child { border-bottom: none; }
.r-row .small { font-size: 11px; }
.link-center { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* --- پوسته شبیه درگاه ملت --- */
.card.gw { background: #fff; }
.gw-box {
  background: #eef4fb;
  border: 1px solid #c9d8ea;
  border-radius: 4px;
  overflow: hidden;
}
.gw-head {
  background: #1a6fc0;
  color: #fff;
  font-size: 13.5px;
  font-weight: bold;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gw-head-ico { font-size: 14px; }
.gw-box form { padding: 12px 14px 14px; }
.gw-row { margin-bottom: 10px; }
.gw-label {
  display: block;
  font-size: 12.5px;
  color: #333;
  margin-bottom: 4px;
}
.gw-cardnums { display: flex; gap: 6px; direction: ltr; }
.gw-cardnums .inp {
  width: 100%;
  height: 30px;
  font-size: 15px;
  text-align: center;
  letter-spacing: 1px;
}
.gw-inp { height: 30px; }
.gw-expire { display: flex; gap: 8px; }
.gw-captcha { display: flex; gap: 8px; align-items: center; }
.gw-captcha .captcha-box {
  display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #c9d8ea; border-radius: 3px;
  padding: 1px 4px 1px 1px;
}
.gw-captcha .captcha-inp { height: 30px; max-width: 130px; }
.gw-otp { display: flex; gap: 8px; align-items: center; }
.gw-otp .inp { height: 30px; flex: 1; }
.gw-otp-btn {
  background: #43a047;
  border: none;
  color: #fff;
  height: 30px;
  padding: 0 14px;
  font-size: 12.5px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.gw-otp-btn:hover { filter: brightness(.94); }
.gw-save {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #555; margin: 4px 0 12px; cursor: pointer;
}
.gw-btns { display: flex; gap: 10px; margin-top: 6px; }
.gw-pay {
  background: #1565c0;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  height: 34px; font-size: 14px;
}
.gw-cancel {
  background: #d32f2f;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  height: 34px; font-size: 14px;
}

/* --- گیت آماده‌سازی: فرم فقط وقتی کامل آماده است دیده می‌شود --- */
.card.gw { position: relative; }
.gw-gate {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(255,255,255,.96);
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; padding: 20px;
}
.gate-box { text-align: center; max-width: 320px; }
.gate-spin {
  width: 38px; height: 38px; margin: 0 auto 10px;
  border: 4px solid #c9d8ea; border-top-color: #1a6fc0; border-radius: 50%;
  animation: gatespin 0.9s linear infinite;
}
@keyframes gatespin { to { transform: rotate(360deg); } }
.gate-title { font-size: 13.5px; font-weight: bold; color: #1a6fc0; margin-bottom: 10px; }
.gate-steps { list-style: none; margin: 0 0 10px; padding: 0; font-size: 12.5px; color: #888; }
.gate-steps li { padding: 3px 0; }
.gate-steps li::before { content: '○ '; }
.gate-steps li.active { color: #1a6fc0; }
.gate-steps li.active::before { content: '◌ '; }
.gate-steps li.done { color: #2e7d32; }
.gate-steps li.done::before { content: '● '; }
.gate-steps li.fail { color: #c62828; }
.gate-steps li.fail::before { content: '✕ '; }
.gate-box .msg { margin: 8px 0; }
.gate-box .btn { width: 100%; }
