:root {
  color-scheme: light;
  --ink: #0a1624;
  --muted: #576574;
  --subtle: #7d8996;
  --line: #d7dde4;
  --line-dark: #c2cad3;
  --paper: #ffffff;
  --summary: #f1f3f5;
  --blue: #0868f7;
  --blue-soft: #edf4ff;
  --green: #25b878;
  --radius: 6px;
  --radius-small: 4px;
  --font-sans: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.checkout-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 44%) minmax(540px, 56%);
}

.summary-panel {
  border-right: 1px solid var(--line);
  background: var(--summary);
}

.summary-inner {
  display: flex;
  width: min(100%, 520px);
  min-height: 100vh;
  flex-direction: column;
  margin-left: auto;
  padding: 43px 58px 32px;
}

.merchant-header {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 12px;
}

.merchant-header > a {
  font-size: 15px;
  font-weight: 760;
}

.back-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-dark);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.back-button svg,
.toggle-label svg,
.show-more-methods svg,
.pay-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.8;
}

.back-button:hover {
  border-color: #98a5b2;
  background: #e8ebee;
  color: var(--blue);
}

.order-details {
  flex: 1;
  padding-top: 118px;
}

.order-total > span {
  color: var(--muted);
  font-size: 13px;
}

.order-total h1 {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin: 7px 0 0;
  line-height: 1;
}

.order-total h1 b {
  font-size: 48px;
  font-weight: 640;
}

.order-total h1 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 660;
}

.product-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 54px;
  padding: 20px 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.product-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  grid-template-rows: 1fr auto;
  align-items: end;
  padding: 8px;
  border: 1px solid #9da9b6;
  border-radius: var(--radius-small);
  background: #dfe6ee;
}

.product-symbol span {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.product-symbol small {
  color: #526579;
  font-size: 8px;
  font-weight: 760;
}

.product-description {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.product-description strong,
.line-price {
  font-size: 13px;
  font-weight: 680;
  line-height: 1.35;
}

.product-description span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.totals-list {
  display: grid;
  gap: 11px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.totals-list div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.totals-list dt,
.totals-list dd {
  margin: 0;
}

.totals-list dd {
  color: var(--ink);
  font-weight: 640;
}

.totals-list .grand-total {
  margin-top: 5px;
  padding-top: 15px;
  border-top: 1px solid var(--line-dark);
  color: var(--ink);
  font-weight: 680;
}

.summary-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--subtle);
  font-size: 10px;
}

.summary-footer nav {
  display: flex;
  gap: 18px;
}

.summary-footer a:hover {
  color: var(--ink);
}

.mobile-summary-toggle {
  display: none;
}

.payment-panel {
  background: var(--paper);
}

.payment-inner {
  width: min(100%, 680px);
  min-height: 100vh;
  padding: 36px 58px 30px;
}

.payment-header {
  margin-bottom: 24px;
}

.step-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 10px;
  font-weight: 680;
  text-transform: uppercase;
}

.step-line span:first-child {
  color: var(--ink);
}

.payment-header h2 {
  margin: 22px 0 7px;
  font-size: 28px;
  font-weight: 660;
  line-height: 1.2;
}

.payment-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 9px;
}

.section-label h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 680;
}

.section-label > span {
  color: var(--subtle);
  font-size: 10px;
}

.methods-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-method {
  position: relative;
  display: grid;
  height: 56px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 13px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
}

.payment-method:hover {
  border-color: #adb8c4;
  background: #f7f8fa;
}

.payment-method.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  padding-right: 36px;
}

.payment-method > span:last-of-type {
  overflow: hidden;
  font-size: 12px;
  font-weight: 640;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.method-mark {
  display: inline-flex;
  width: 34px;
  height: 26px;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 10px;
  font-weight: 780;
}

.card-mark {
  justify-content: flex-start;
}

.card-mark b,
.accepted-cards b {
  color: #15359b;
  font-size: 8px;
  font-style: italic;
  font-weight: 850;
}

.card-mark i,
.accepted-cards i {
  width: 13px;
  height: 13px;
  margin-left: -3px;
  border-radius: 50%;
  background: #e92838;
}

.card-mark i:last-child,
.accepted-cards i:last-child {
  background: #f2a723;
}

.apple-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-small);
  background: #101214;
  color: #fff;
}

.google-mark {
  color: #4285f4;
  font-size: 16px;
}

.paypal-mark {
  color: #0877d1;
  font-size: 19px;
  font-style: italic;
}

.alipay-mark {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-small);
  background: #1677ff;
  color: #fff;
  font-size: 17px;
}

.wechat-mark {
  position: relative;
}

.wechat-mark i {
  position: absolute;
  width: 25px;
  height: 18px;
  border-radius: 50%;
  background: #18b748;
}

.wechat-mark i::before,
.wechat-mark i::after {
  position: absolute;
  top: 6px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.wechat-mark i::before {
  left: 7px;
}

.wechat-mark i::after {
  left: 14px;
}

.wechat-mark i:last-child {
  right: 0;
  bottom: 1px;
  width: 20px;
  height: 15px;
  border: 2px solid #fff;
}

.coin-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
}

.usdt-mark {
  background: #26a17b;
}

.usdc-mark {
  border: 2px solid #2775ca;
  background: #fff;
  color: #2775ca;
}

.klarna-mark {
  width: 30px;
  height: 22px;
  border-radius: 3px;
  background: #ffb4c8;
  color: #111;
}

.bank-mark svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #334b62;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.5;
}

.selected-check {
  position: absolute;
  right: 12px;
  display: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--blue);
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2;
}

.payment-method.is-selected .selected-check {
  display: block;
}

.show-more-methods {
  display: none;
}

.payment-detail {
  min-height: 246px;
  padding: 22px 0 14px;
}

.card-form {
  display: grid;
  gap: 16px;
}

.flat-field {
  display: grid;
}

.flat-field > label {
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 670;
  line-height: 1.35;
}

input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  outline: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}

input::placeholder {
  color: #98a2ad;
}

input:focus {
  border-color: var(--blue);
  background: #f7faff;
}

.card-number-line {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius) var(--radius) 0 0;
}

.card-number-line input {
  padding-right: 90px;
  border: 0;
  border-radius: 0;
}

.accepted-cards {
  position: absolute;
  right: 11px;
  display: flex;
  align-items: center;
}

.accepted-cards i {
  width: 17px;
  height: 17px;
}

.card-meta-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-dark);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.card-meta-line input {
  border: 0;
  border-radius: 0;
}

.card-meta-line input + input {
  border-left: 1px solid var(--line);
}

.save-card-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
}

.save-card-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.custom-checkbox {
  position: relative;
  width: 16px;
  height: 16px;
  flex: none;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-small);
}

.save-card-row input:checked + .custom-checkbox {
  border-color: var(--blue);
  background: var(--blue);
}

.save-card-row input:checked + .custom-checkbox::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 7px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  content: "";
  transform: rotate(45deg);
}

.redirect-detail {
  display: flex;
  min-height: 210px;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.redirect-detail[hidden] {
  display: none;
}

.redirect-index {
  display: grid;
  width: 48px;
  height: 48px;
  flex: none;
  place-items: center;
  border-radius: var(--radius-small);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 18px;
  font-weight: 760;
}

.redirect-detail strong {
  font-size: 13px;
}

.redirect-detail p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.pay-button {
  display: flex;
  width: 100%;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
}

.pay-button:hover {
  background: #075bd6;
}

.payment-footer {
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 13px;
  color: var(--subtle);
  font-size: 10px;
}

.payment-footer > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.payment-footer svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.6;
}

.provider-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border-radius: 2px;
  opacity: 0.3;
}

.provider-icon img {
  width: 100%;
  height: 100%;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  padding: 10px 14px;
  border-left: 3px solid #39d394;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.back-button:focus-visible,
.mobile-summary-toggle:focus-visible,
.payment-method:focus-visible,
.show-more-methods:focus-visible,
.pay-button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .checkout-layout {
    grid-template-columns: minmax(320px, 40%) minmax(500px, 60%);
  }

  .summary-inner,
  .payment-inner {
    padding-right: 40px;
    padding-left: 40px;
  }
}

@media (max-width: 780px) {
  .checkout-layout {
    display: block;
  }

  .summary-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .summary-inner {
    width: 100%;
    min-height: 0;
    padding: max(14px, env(safe-area-inset-top)) 20px 0;
  }

  .merchant-header {
    height: 42px;
    padding-bottom: 12px;
  }

  .order-details {
    display: none;
    padding: 17px 0 20px;
    border-top: 1px solid var(--line-dark);
  }

  .summary-panel.is-open .order-details {
    display: block;
  }

  .order-total {
    display: none;
  }

  .product-row {
    margin-top: 0;
  }

  .summary-footer {
    display: none;
  }

  .mobile-summary-toggle {
    display: flex;
    width: calc(100% + 40px);
    min-height: 66px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 -20px;
    padding: 11px 20px;
    border: 0;
    border-top: 1px solid var(--line-dark);
    background: #e7ebef;
    cursor: pointer;
    text-align: left;
  }

  .mobile-summary-toggle > span:first-child {
    display: grid;
    gap: 1px;
  }

  .mobile-summary-toggle small {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-summary-toggle strong {
    font-size: 20px;
    line-height: 1.2;
  }

  .toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 10px;
  }

  .summary-panel.is-open .toggle-label svg {
    transform: rotate(180deg);
  }

  .payment-inner {
    width: 100%;
    min-height: 0;
    padding: 28px 20px max(28px, env(safe-area-inset-bottom));
  }

  .methods-grid:not(.is-expanded) .payment-method:nth-child(n + 7) {
    display: none;
  }

  .show-more-methods {
    display: flex;
    width: 100%;
    height: 38px;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #31516e;
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
    margin-top: 6px;
  }

  .show-more-methods.is-expanded svg {
    transform: rotate(180deg);
  }

  .payment-detail {
    padding-top: 22px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    text-align: center;
  }
}

@media (max-width: 390px) {
  .summary-inner,
  .payment-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .mobile-summary-toggle {
    width: calc(100% + 32px);
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .payment-header h2 {
    font-size: 25px;
  }

  .payment-method {
    height: 56px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 7px;
    padding-right: 9px;
    padding-left: 9px;
  }

  .payment-method.is-selected {
    padding-right: 30px;
  }

  .selected-check {
    right: 8px;
  }

  .method-mark {
    width: 30px;
  }

  .payment-method > span:last-of-type {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
