:root {
  color-scheme: light;
  --alipay: #1677ff;
  --ink: #172033;
  --muted: #697386;
  --line: #d8dee8;
  --surface: #ffffff;
  --page: #eef3f8;
  --success: #138a4a;
  --danger: #c2342d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.cashier {
  width: min(100%, 560px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(31, 42, 68, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.mode-badge {
  margin-left: auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.mode-badge.debug {
  border-color: #f0b429;
  background: #fff8db;
  color: #7a4d00;
}

.platform-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.platform-bar img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.platform-bar div {
  display: grid;
  gap: 3px;
}

.platform-bar span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.brand-mark,
.alipay-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--alipay);
  color: white;
  font-weight: 800;
  flex: 0 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

.brand p,
.fineprint,
.label,
.method small {
  color: var(--muted);
}

.summary {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  display: grid;
  gap: 14px;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
}

.summary strong {
  text-align: right;
  overflow-wrap: anywhere;
}

.amount {
  color: #d4380d;
  font-size: 28px;
}

.pay-methods {
  margin-top: 24px;
}

.pay-methods h2 {
  font-size: 17px;
  margin-bottom: 12px;
}

.method {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.method.selected {
  border-color: var(--alipay);
  background: #f3f8ff;
}

.method input {
  width: 18px;
  height: 18px;
  accent-color: var(--alipay);
}

.method span:last-child {
  display: grid;
  gap: 4px;
}

.primary,
.secondary {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  border: 0;
  border-radius: 8px;
  background: var(--alipay);
  color: white;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary {
  background: #2f3b52;
}

.secondary.compact {
  min-height: 42px;
  margin-top: 10px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.qr-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 80;
  width: min(92vw, 380px);
  margin: 0;
  padding: 24px 22px 20px;
  display: grid;
  justify-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(20, 29, 48, 0.32), 0 0 0 9999px rgba(15, 23, 42, 0.42);
  transform: translate(-50%, -50%);
}

.qr-panel canvas,
.qr-panel img {
  width: min(72vw, 320px);
  height: min(72vw, 320px);
}

.qr-panel p {
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

.qr-open-link {
  border: 0;
  background: transparent;
  color: var(--alipay);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.qr-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}

.fineprint {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.state {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff7e6;
  color: #8a4b00;
  line-height: 1.5;
}

.state.success {
  background: #eaf8f0;
  color: var(--success);
}

.state.error {
  background: #fff1f0;
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.result .state {
  margin: 20px 0 0;
}

.success-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 34px 16px;
  text-align: center;
}

.success-panel h2 {
  font-size: 24px;
}

.success-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e7f7ef;
  color: var(--success);
  font-size: 34px;
  font-weight: 800;
}

@media (max-width: 640px) {
  .shell {
    display: block;
    padding: 0;
    background: var(--surface);
  }

  .cashier {
    min-height: 100vh;
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 22px 18px;
  }

  h1 {
    font-size: 22px;
  }

  .summary div {
    display: grid;
    gap: 6px;
  }

  .summary strong {
    text-align: left;
  }

  .amount {
    font-size: 32px;
  }
}
