.purchase-page {
  min-height: var(--page-stage-min);
  padding: clamp(34px, 5vw, 58px) 0 68px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-cjk);
}

.purchase-cashier {
  display: grid;
  justify-items: center;
}

.purchase-order-column {
  width: min(1520px, 100%);
  display: grid;
  gap: clamp(18px, 2.6vw, 30px);
}

.price-card,
.checkout-panel,
.order-summary,
.payment-modal-shell,
.payment-modal .payment-stage {
  position: relative;
  border: 1px solid rgba(245, 245, 240, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(245, 245, 240, 0.072), rgba(245, 245, 240, 0.026) 42%, rgba(245, 245, 240, 0.012)),
    #050505;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(245, 245, 240, 0.12);
  overflow: hidden;
}

.price-card::before,
.checkout-panel::before,
.order-summary::before,
.payment-modal-shell::before,
.payment-modal .payment-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 245, 240, 0.09), transparent 28%),
    linear-gradient(90deg, rgba(245, 245, 240, 0.045), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.28)),
    repeating-linear-gradient(112deg, transparent 0 12px, rgba(245, 245, 240, 0.01) 12px 13px, transparent 13px 24px);
  opacity: 0.82;
  pointer-events: none;
}

.price-card > *,
.checkout-panel > *,
.order-summary > *,
.payment-modal-shell > *,
.payment-modal .payment-stage > * {
  position: relative;
  z-index: 1;
}

.price-card {
  display: grid;
  gap: clamp(20px, 2.8vw, 28px);
  padding: clamp(22px, 3.2vw, 34px);
  color: inherit;
  text-decoration: none;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.price-card:hover,
.price-card:focus-visible {
  border-color: rgba(245, 245, 240, 0.52);
  transform: translateY(-2px);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.68),
    0 0 0 1px rgba(245, 245, 240, 0.18),
    inset 0 1px 0 rgba(245, 245, 240, 0.18);
}

.price-card.is-featured,
.price-card.is-selected {
  border-color: rgba(245, 245, 240, 0.36);
}

.plan-head {
  grid-area: head;
  display: grid;
  align-content: start;
  gap: 12px;
}

.plan-head span,
.plan-head small,
.order-summary span,
.form-block label,
.status-pill,
.payment-modal-head span {
  color: rgba(245, 245, 240, 0.66);
  font-family: var(--font-cjk);
  font-size: var(--fs-small);
  font-weight: 850;
  line-height: 1.45;
}

.plan-head span,
.status-pill,
.payment-modal-head span {
  width: fit-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(245, 245, 240, 0.2);
  border-radius: 999px;
  background: rgba(245, 245, 240, 0.035);
}

.plan-head strong {
  font-family: var(--font-cjk);
  font-size: clamp(44px, 5vw, 64px);
  line-height: 0.96;
  letter-spacing: 0;
  white-space: nowrap;
}

.order-card-detail {
  grid-area: detail;
  display: grid;
  gap: 16px;
  min-width: 0;
  padding-left: clamp(18px, 2.2vw, 28px);
  border-left: 1px solid rgba(245, 245, 240, 0.16);
}

.price-card p,
.order-summary p,
.status-stack p,
.checkout-panel-head p {
  margin: 0;
  color: rgba(245, 245, 240, 0.68);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.72;
}

.price-card ul {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(245, 245, 240, 0.12);
  color: rgba(245, 245, 240, 0.86);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.48;
  list-style: none;
}

.price-card li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
}

.price-card li::before {
  content: "";
  width: 6px;
  height: 10px;
  margin: 2px 0 0 4px;
  border: solid rgba(245, 245, 240, 0.9);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkout-panel {
  display: grid;
  gap: clamp(18px, 2.4vw, 26px);
  padding: clamp(20px, 3vw, 30px);
}

.payment-modal .checkout-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}

.payment-modal .checkout-panel::before {
  display: none;
}

.checkout-panel-head {
  display: grid;
  gap: 10px;
}

.checkout-panel-head strong {
  display: block;
  font-size: clamp(24px, 2.9vw, 36px);
  line-height: 1.18;
}

.checkout-modal-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1fr);
  align-items: stretch;
  gap: clamp(18px, 3vw, 28px);
  min-width: 0;
}

.checkout-form,
.payment-stage,
.status-stack,
.flow-steps {
  display: grid;
  gap: 16px;
}

.form-block {
  display: grid;
  gap: 8px;
}

.form-block input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(245, 245, 240, 0.2);
  border-radius: 6px;
  color: var(--fg);
  background: rgba(245, 245, 240, 0.045);
  font: 750 15px/1.2 var(--font-cjk);
  outline: 0;
}

.form-block input:focus {
  border-color: rgba(245, 245, 240, 0.46);
  background: rgba(245, 245, 240, 0.065);
}

.form-block input[aria-invalid="true"] {
  border-color: rgba(255, 139, 114, 0.72);
}

.form-block small {
  min-height: 18px;
  color: #ff8b72;
  font-size: 12px;
  line-height: 1.5;
}

.order-summary {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.order-summary strong {
  display: block;
  font-family: var(--font-cjk);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkout-actions[hidden] {
  display: none;
}

.primary-action {
  color: #050505;
  border-color: rgba(245, 245, 240, 0.86);
  background: var(--fg);
}

.payment-modal {
  width: min(960px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  color: var(--fg);
  background: transparent;
}

.payment-modal:not([open]) {
  display: none;
}

.payment-modal::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(10px);
}

.payment-modal-shell {
  display: grid;
  gap: clamp(18px, 2.4vw, 24px);
  max-height: inherit;
  padding: clamp(18px, 3vw, 28px);
  overflow: auto;
}

.payment-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.payment-modal-close {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(245, 245, 240, 0.2);
  border-radius: 999px;
  color: var(--fg);
  background: rgba(245, 245, 240, 0.04);
  font: 700 24px/1 var(--font-cjk);
  cursor: pointer;
}

.payment-modal-close:hover,
.payment-modal-close:focus-visible {
  border-color: rgba(245, 245, 240, 0.46);
  background: rgba(245, 245, 240, 0.08);
}

.payment-stage {
  grid-template-columns: minmax(170px, 212px) minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  padding-top: clamp(18px, 2.6vw, 24px);
  border-top: 1px solid rgba(245, 245, 240, 0.16);
}

.payment-modal .payment-stage {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  align-content: start;
  padding: clamp(18px, 2.8vw, 24px);
}

.payment-modal .status-stack {
  min-width: 0;
}

.qr-box {
  width: min(212px, 100%);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(245, 245, 240, 0.32);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(245, 245, 240, 0.11) 1px, transparent 1px),
    linear-gradient(rgba(245, 245, 240, 0.11) 1px, transparent 1px),
    #020202;
  background-size: 18px 18px;
  opacity: 0.62;
}

.qr-box.is-active {
  opacity: 1;
  animation: qrPulse 1.6s var(--ease) infinite alternate;
}

.qr-box.has-image {
  display: block;
  padding: 12px;
  background: #f8f8f4;
}

.qr-box.has-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-box.has-image span {
  display: none;
}

.qr-box span {
  border: 10px solid var(--fg);
  background: #020202;
}

@keyframes qrPulse {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}

.status-stack h3 {
  margin: 0;
  font-size: clamp(22px, 2.8vw, 34px);
  line-height: 1.2;
}

.flow-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-steps li {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 245, 240, 0.16);
  border-radius: 6px;
  color: rgba(245, 245, 240, 0.62);
  font-size: var(--fs-small);
  font-weight: 850;
}

.flow-steps li.is-active {
  color: var(--fg);
  border-color: rgba(245, 245, 240, 0.38);
  background: rgba(245, 245, 240, 0.052);
}

.flow-steps li.is-error {
  color: #ff8b72;
  border-color: rgba(255, 139, 114, 0.44);
}

@media (max-width: 980px) {
  .purchase-page {
    padding-top: 46px;
  }

  .order-card-detail {
    padding-left: 0;
    border-left: 0;
  }

  .payment-stage,
  .checkout-modal-grid,
  .payment-modal .payment-stage {
    grid-template-columns: 1fr;
  }

  .payment-modal .qr-box {
    justify-self: center;
  }

  .qr-box {
    width: min(230px, 100%);
  }
}

@media (max-width: 640px) {
  .purchase-page {
    gap: 22px;
    padding-bottom: 54px;
  }

  .purchase-order-column,
  .checkout-panel {
    gap: 16px;
  }

  .checkout-panel,
  .price-card,
  .payment-modal-shell,
  .payment-modal .payment-stage {
    padding: 18px;
  }

  .payment-modal {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .checkout-actions {
    display: grid;
  }

  .checkout-actions .detail-btn {
    width: 100%;
    justify-content: center;
  }

  .flow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .price-card,
  .qr-box.is-active {
    animation: none;
    transition: none;
  }
}
