:root {
  color: #192126;
  background: #eef2f1;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #eef2f1;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: #eef2f1;
  letter-spacing: 0;
}

body::before {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  left: 0;
  height: 182px;
  background: #155f50;
  content: "";
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    calc(22px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.brand-header {
  min-height: 138px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.brand-logo {
  width: min(230px, 58vw);
  height: auto;
  display: block;
}

.test-badge {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  color: #ffffff;
  background: rgba(8, 44, 38, 0.55);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.payment-panel {
  width: 100%;
  padding: 24px;
  border: 1px solid #d7dfdc;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(26, 49, 43, 0.14);
}

.product-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.crystal-icon {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.product-heading > div {
  min-width: 0;
}

.product-kicker {
  margin: 0 0 3px;
  color: #15806b;
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  color: #192126;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
}

h1 span {
  color: #5e6a70;
  font-size: 14px;
  font-weight: 600;
}

.product-id {
  margin: 6px 0 0;
  color: #66747a;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.amount-band {
  margin: 22px -24px 0;
  padding: 20px 24px;
  border-top: 1px solid #e1e7e4;
  border-bottom: 1px solid #e1e7e4;
  background: #f7faf9;
  text-align: center;
}

.amount-band > span {
  display: block;
  color: #68757a;
  font-size: 13px;
}

.amount-band strong {
  display: block;
  margin-top: 4px;
  color: #d95822;
  font-size: 42px;
  line-height: 1.08;
}

.amount-band strong small {
  margin-right: 3px;
  font-size: 20px;
}

.amount-band p {
  margin: 9px 0 0;
  color: #445158;
  font-size: 14px;
}

.amount-band b {
  color: #147866;
}

.order-details {
  margin: 0;
  padding: 8px 0;
}

.order-details > div {
  display: grid;
  grid-template-columns: minmax(72px, 0.35fr) minmax(0, 1fr);
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid #edf1ef;
}

.order-details > div:last-child {
  border-bottom: 0;
}

.order-details dt {
  color: #708087;
  font-size: 14px;
}

.order-details dd {
  min-width: 0;
  margin: 0;
  color: #263239;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.status-box {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #c9dfd9;
  border-radius: 6px;
  background: #edf8f5;
  color: #1c5b4f;
  font-size: 14px;
  line-height: 1.5;
}

.status-indicator {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #17826c;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.payment-method {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid #cfd9d6;
  border-radius: 6px;
  background: #ffffff;
  color: #263239;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(26, 49, 43, 0.09);
}

.payment-method img {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.payment-method--wxpay {
  border-color: #9ed9a3;
  color: #13732d;
}

.payment-method--alipay {
  border-color: #9ccced;
  color: #0a6cae;
}

.payment-method:hover {
  background: #f5f9f8;
}

.payment-method:focus-visible {
  outline: 3px solid #64cbb5;
  outline-offset: 3px;
}

.payment-method:disabled {
  background: #a6b0b3;
  border-color: #a6b0b3;
  color: #ffffff;
  box-shadow: none;
  cursor: not-allowed;
}

.payment-method:disabled img {
  filter: grayscale(1);
  opacity: 0.72;
}

.payment-unavailable {
  margin: 16px 0 0;
  color: #933a1c;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.delivery-note {
  margin: 12px 0 0;
  color: #718087;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.recharge-form {
  margin-top: 22px;
}

.form-field {
  margin-top: 16px;
}

.form-field:first-of-type {
  margin-top: 0;
}

.form-field label,
.product-options legend {
  display: block;
  margin-bottom: 7px;
  color: #445158;
  font-size: 13px;
  font-weight: 700;
}

.form-control {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #cbd6d2;
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
  color: #263239;
  font-size: 15px;
  line-height: 1.4;
}

.form-control::placeholder {
  color: #89959a;
}

.form-control:focus {
  border-color: #218b76;
  box-shadow: 0 0 0 3px rgba(33, 139, 118, 0.16);
}

.product-options {
  min-width: 0;
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.product-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.product-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.product-option-content {
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 6px;
  border: 1px solid #cfd9d6;
  border-radius: 6px;
  background: #ffffff;
  color: #657278;
  text-align: center;
}

.product-option-content strong {
  color: #2a3439;
  font-size: 20px;
  line-height: 1.1;
}

.product-option-content strong small {
  margin-right: 2px;
  font-size: 13px;
}

.product-option-content > span {
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.product-option:hover .product-option-content {
  border-color: #91bfb5;
  background: #f7faf9;
}

.product-option input:focus-visible + .product-option-content {
  outline: 3px solid #64cbb5;
  outline-offset: 2px;
}

.product-option input:checked + .product-option-content {
  border-color: #218b76;
  background: #edf8f5;
  box-shadow: inset 0 0 0 1px #218b76;
}

.product-option input:checked + .product-option-content strong {
  color: #c64e1e;
}

.recharge-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 13px 14px;
  border-top: 1px solid #e2e9e6;
  border-bottom: 1px solid #e2e9e6;
  background: #f7faf9;
}

.recharge-summary > span {
  flex: 0 0 auto;
  color: #68757a;
  font-size: 13px;
}

.recharge-summary strong {
  min-width: 0;
  color: #147866;
  font-size: 15px;
  text-align: right;
  overflow-wrap: anywhere;
}

.primary-action {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 12px 18px;
  border: 1px solid #116452;
  border-radius: 6px;
  background: #167461;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(22, 93, 78, 0.2);
}

.primary-action:hover {
  background: #105f4f;
}

.primary-action:focus-visible {
  outline: 3px solid #64cbb5;
  outline-offset: 3px;
}

.primary-action:disabled {
  border-color: #9ca9a6;
  background: #9ca9a6;
  box-shadow: none;
  cursor: not-allowed;
}

.form-message {
  margin-bottom: 16px;
  padding: 11px 12px;
  border: 1px solid #efb8a2;
  border-radius: 6px;
  background: #fff2ec;
  color: #933a1c;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

[data-state="mailed"] .status-box {
  border-color: #83c9a7;
  background: #ebf8f0;
  color: #17623d;
}

[data-state="mailed"] .payment-methods,
[data-state="expired"] .payment-methods,
[data-state="awaiting_fulfillment"] .payment-methods {
  display: none;
}

[data-state="failed"] .status-box,
[data-state="expired"] .status-box {
  border-color: #efb8a2;
  background: #fff2ec;
  color: #933a1c;
}

[data-state="failed"] .status-indicator,
[data-state="expired"] .status-indicator {
  background: #d95822;
}

[data-state="fulfilling"] .status-indicator {
  border: 2px solid #93cfc2;
  border-top-color: #176f5e;
  background: transparent;
  animation: spin 0.8s linear infinite;
}

[data-state="submitted"] .status-box,
[data-state="submitting"] .status-box,
[data-state="awaiting_payment"] .status-box {
  border-color: #e6cf9a;
  background: #fff9e8;
  color: #715518;
}

[data-state="submitted"] .status-indicator,
[data-state="submitting"] .status-indicator,
[data-state="awaiting_payment"] .status-indicator {
  background: #c09128;
}

[data-state="submitting"] .payment-method {
  opacity: 0.75;
}

.error-panel {
  padding: 44px 24px;
  text-align: center;
}

.error-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #fff0e9;
  color: #d95822;
  font-size: 30px;
  font-weight: 800;
}

.error-panel p {
  margin: 12px 0 0;
  color: #68757a;
  font-size: 14px;
  line-height: 1.6;
}

footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 18px 8px 0;
  color: #718087;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 390px) {
  .page-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-header {
    min-height: 126px;
  }

  .payment-panel {
    padding: 20px 18px;
  }

  .amount-band {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .crystal-icon {
    width: 64px;
    height: 64px;
  }

  h1 {
    font-size: 21px;
  }

  .payment-methods {
    grid-template-columns: 1fr;
  }

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

@media (min-width: 760px) {
  body::before {
    height: 205px;
  }

  .page-shell {
    padding-top: 28px;
  }

  .brand-header {
    min-height: 156px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-indicator {
    animation: none;
  }
}
