:root {
  --color-primary: #147d69;
  --color-primary-pressed: #0d6555;
  --color-primary-dark: #173d31;
  --color-light-green: #e8f2ed;
  --color-page: #f5f8f6;
  --color-surface: #ffffff;
  --color-text: #202e29;
  --color-text-body: #4f6459;
  --color-text-muted: #6d7f74;
  --color-border: #e3ebe5;
  --color-warning: #a36313;
  --color-warning-bg: #fff4e2;
  --color-danger: #bb423f;
  --color-danger-bg: #fff0ee;
  --color-alipay: #1677ff;
  --radius-card: 18px;
  --radius-control: 12px;
  --page-padding: 20px;
  --touch-min: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page);
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #eef3f0;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.prototype-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
}

.payment-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(430px, 100vw);
  height: min(900px, 100dvh);
  min-width: 0;
  overflow: hidden;
  background: var(--color-page);
  border: 1px solid rgba(32, 46, 41, 0.08);
  box-shadow: 0 16px 48px rgba(32, 46, 41, 0.12);
}

.payment-header {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px var(--page-padding);
  background: rgba(245, 248, 246, 0.96);
  border-bottom: 1px solid rgba(227, 235, 229, 0.76);
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  color: var(--color-primary);
  background: var(--color-light-green);
  border: 1px solid rgba(20, 125, 105, 0.12);
  border-radius: 50%;
}

.brand-mark img {
  width: 23px;
  height: 23px;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.brand-copy strong {
  overflow: hidden;
  color: var(--color-primary-dark);
  font-size: 16px;
  font-weight: 720;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  color: var(--color-text-muted);
  font-size: 9px;
  font-weight: 650;
  line-height: 12px;
}

.security-badge {
  display: inline-flex;
  min-height: 28px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  color: var(--color-primary);
  background: var(--color-light-green);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 18px;
}

.security-badge > span {
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  color: var(--color-surface);
  background: var(--color-primary);
  border-radius: 50%;
  font-size: 10px;
}

.payment-content {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 17px var(--page-padding) 20px;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.payment-content::-webkit-scrollbar {
  display: none;
}

.page-heading {
  margin-bottom: 15px;
}

.page-kicker {
  margin: 0 0 5px;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.page-title {
  margin: 0;
  color: var(--color-text);
  font-size: 24px;
  font-weight: 720;
  line-height: 32px;
}

.page-description {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 21px;
}

.bill-card,
.status-card {
  width: 100%;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
}

.bill-card {
  padding: 17px;
}

.product-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.product-image {
  width: 84px;
  height: 84px;
  object-fit: cover;
  object-position: center;
  background: #f0e0cb;
  border: 1px solid #ead8c1;
  border-radius: 13px;
}

.product-copy {
  min-width: 0;
}

.product-name {
  margin: 0 0 7px;
  overflow-wrap: anywhere;
  color: var(--color-text);
  font-size: 18px;
  font-weight: 720;
  line-height: 25px;
}

.product-spec {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 21px;
}

.amount-block {
  padding: 23px 0 21px;
  text-align: center;
}

.amount-label {
  display: block;
  margin-bottom: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 18px;
}

.amount {
  color: var(--color-primary-dark);
  font-family: "DIN Alternate", "Arial Narrow", Arial, sans-serif;
  font-size: 40px;
  font-weight: 720;
  line-height: 48px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.detail-list,
.receipt-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}

.detail-row,
.receipt-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--color-border);
}

.detail-row:last-child,
.receipt-row:last-child {
  border-bottom: 0;
}

.detail-row dt,
.detail-row dd,
.receipt-row dt,
.receipt-row dd {
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 20px;
}

.detail-row dt,
.receipt-row dt {
  color: var(--color-text-muted);
}

.detail-row dd,
.receipt-row dd {
  overflow-wrap: anywhere;
  color: var(--color-text-body);
  text-align: right;
}

.verification-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 18px;
}

.verification-note::before {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  margin-top: 1px;
  content: "✓";
  color: var(--color-primary);
  background: var(--color-light-green);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}

.status-card {
  padding: 25px 20px 19px;
  text-align: center;
}

.status-spacer {
  height: 12px;
}

.status-card[data-tone="success"] {
  border-color: rgba(20, 125, 105, 0.22);
}

.status-card[data-tone="warning"] {
  border-color: rgba(163, 99, 19, 0.24);
}

.status-card[data-tone="error"] {
  border-color: rgba(187, 66, 63, 0.2);
}

.status-icon {
  display: grid;
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  place-items: center;
  color: var(--color-primary);
  background: var(--color-light-green);
  border-radius: 50%;
  font-size: 29px;
  font-weight: 750;
  line-height: 1;
}

.status-card[data-tone="warning"] .status-icon {
  color: var(--color-warning);
  background: var(--color-warning-bg);
}

.status-card[data-tone="error"] .status-icon {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.status-card[data-tone="unsupported"] .status-icon {
  color: var(--color-text-body);
  background: #eef1ef;
}

.status-icon.is-loading {
  position: relative;
  color: transparent;
}

.status-icon.is-loading::after {
  width: 24px;
  height: 24px;
  content: "";
  border: 3px solid rgba(20, 125, 105, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .status-icon.is-loading::after { animation: none; }
}

.status-title {
  margin: 0;
  color: var(--color-text);
  font-size: 23px;
  font-weight: 720;
  line-height: 31px;
}

.status-description {
  margin: 8px auto 0;
  max-width: 300px;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 22px;
}

.status-notice {
  margin: 15px 0 0;
  padding: 10px 12px;
  color: var(--color-warning);
  background: var(--color-warning-bg);
  border-radius: 10px;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
}

.status-summary {
  display: grid;
  min-width: 0;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  margin: 21px 0 16px;
  padding: 15px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.status-summary img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid #ead8c1;
  border-radius: 10px;
}

.status-summary-copy {
  min-width: 0;
}

.status-summary-copy strong,
.status-summary-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.status-summary-copy strong {
  margin-bottom: 3px;
  color: var(--color-text);
  font-size: 15px;
  line-height: 21px;
}

.status-summary-copy span {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 18px;
}

.summary-amount {
  color: var(--color-primary-dark);
  font-family: "DIN Alternate", "Arial Narrow", Arial, sans-serif;
  font-size: 18px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.responsible-drinking {
  margin: 14px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 18px;
}

.channel-guide {
  display: grid;
  margin-top: 20px;
  gap: 10px;
}

.channel-guide-row {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  color: var(--color-text-body);
  background: #f8faf9;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  font-size: 14px;
  text-align: left;
}

.channel-mark {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  color: #ffffff;
  background: var(--color-primary);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
}

.channel-mark.alipay {
  background: var(--color-alipay);
}

.action-bar {
  min-width: 0;
  padding: 13px var(--page-padding) calc(13px + env(safe-area-inset-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.action-button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 20px;
  color: #ffffff;
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius-control);
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  cursor: pointer;
}

.action-button:active {
  background: var(--color-primary-pressed);
}

.action-button[data-channel="alipay"] {
  background: var(--color-alipay);
}

.action-button[data-channel]::before {
  position: absolute;
  top: 50%;
  left: 17px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  content: "微";
  transform: translateY(-50%);
  color: var(--color-primary);
  background: #ffffff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.action-button[data-channel="alipay"]::before {
  content: "支";
  color: var(--color-alipay);
}

.action-button.secondary {
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid rgba(20, 125, 105, 0.45);
}

.action-button.secondary:active {
  background: var(--color-light-green);
}

.action-caption {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}

.waiting-footer {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 20px;
  text-align: center;
}

.preview-panel {
  position: fixed;
  top: 50%;
  left: calc(50% + 247px);
  display: grid;
  width: 210px;
  padding: 16px;
  transform: translateY(-50%);
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(32, 46, 41, 0.1);
  gap: 7px;
}

.preview-heading {
  display: grid;
  margin-bottom: 7px;
  gap: 2px;
}

.preview-heading strong {
  font-size: 14px;
  line-height: 20px;
}

.preview-heading span,
.preview-panel label {
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 17px;
}

.preview-panel label:not(:first-of-type) {
  margin-top: 5px;
}

.preview-panel select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0 10px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

@media (max-width: 960px) {
  .preview-panel {
    left: auto;
    right: 18px;
  }
}

@media (max-width: 700px) {
  .prototype-shell {
    display: block;
  }

  .payment-page {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    border: 0;
    box-shadow: none;
  }

  .preview-panel {
    display: none;
  }
}

@media (max-width: 350px) {
  :root {
    --page-padding: 16px;
  }

  .payment-header {
    min-height: 68px;
  }

  .security-badge {
    padding-right: 7px;
    padding-left: 7px;
  }

  .bill-card {
    padding: 15px;
  }

  .product-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
  }

  .product-image {
    width: 74px;
    height: 74px;
  }

  .amount {
    font-size: 36px;
    line-height: 44px;
  }

  .status-card {
    padding-right: 16px;
    padding-left: 16px;
  }

  .status-summary {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .status-summary img {
    width: 50px;
    height: 50px;
  }

  .summary-amount {
    grid-column: 2;
  }
}
