:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --blue: #1769e0;
  --blue-dark: #0e56bf;
  --green: #08a657;
  --ink: #172033;
  --muted: #7c879b;
  --line: #e8ebf1;
  --surface: #ffffff;
  --page: #f4f6f8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  position: relative;
  border-inline: 1px solid rgba(23, 32, 51, 0.04);
}

.topbar {
  min-height: 70px;
  padding:
    max(14px, env(safe-area-inset-top)) 16px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.safe-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: #eaf8f1;
}

.safe-mark svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
}

.topbar-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

main {
  padding-bottom: 8px;
}

.receiver-card {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.receiver-copy h1 {
  margin: 0;
  font-size: 17px;
}

.receiver-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.verified-badge {
  margin-left: auto;
  color: var(--green);
  background: #eaf8f1;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  white-space: nowrap;
}

.amount-section {
  padding: 22px 18px 20px;
  border-top: 1px solid #f5f6f8;
  border-bottom: 1px solid var(--line);
}

.amount-section > label {
  display: block;
  color: #576176;
  font-size: 13px;
  margin-bottom: 14px;
}

.amount-display {
  border: 0;
  padding: 0;
  width: 100%;
  min-height: 52px;
  background: transparent;
  text-align: left;
  display: flex;
  align-items: baseline;
  gap: 7px;
  position: relative;
  cursor: text;
}

.currency {
  font-size: 31px;
  font-weight: 600;
}

#amount-value {
  font-size: 35px;
  font-weight: 650;
  letter-spacing: 0.3px;
}

.amount-placeholder {
  color: #a9b0bd;
  font-size: 26px !important;
  font-weight: 500 !important;
}

.cursor {
  width: 2px;
  height: 34px;
  background: var(--blue);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 17px;
}

.preset-row button {
  border: 1px solid #dfe5ef;
  background: #f9fbfd;
  color: #4f5a6f;
  border-radius: 9px;
  padding: 8px 4px;
}

.preset-row button:active {
  background: #edf4ff;
  border-color: #a9c8f8;
}

.settings-card,
.config-warning {
  margin: 14px 16px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.settings-card {
  padding: 15px;
}

.settings-card h2 {
  margin: 0 0 10px;
  font-size: 14px;
}

.payment-options {
  display: grid;
  gap: 8px;
}

.choice {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.choice.selected {
  border-color: #8bb9f5;
  background: #f3f8ff;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pay-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 750;
}

.pay-logo svg {
  width: 25px;
  height: 25px;
  color: #fff;
}

.pay-logo.wechat {
  background: #07c160;
}

.pay-logo.qq {
  background: #2d8cf0;
}

.choice span:nth-child(3) {
  display: grid;
  gap: 3px;
}

.choice strong {
  font-size: 13px;
}

.choice small {
  color: var(--muted);
  font-size: 10px;
}

.choice i {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border: 1px solid #ccd3df;
  border-radius: 50%;
  position: relative;
}

.choice.selected i {
  border-color: var(--blue);
}

.choice.selected i::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--blue);
}

.config-warning {
  padding: 12px 14px;
  color: #985d00;
  border-color: #f3d59f;
  background: #fff9ed;
  font-size: 12px;
  line-height: 1.7;
}

.keyboard-spacer {
  height: 310px;
}

.keyboard {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 440px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #e7e9ee;
  border-top: 1px solid #dde1e8;
  padding-bottom: env(safe-area-inset-bottom);
}

.keyboard > button {
  min-height: 68px;
  border: 0;
  background: rgba(255, 255, 255, 0.98);
  color: #232b3b;
  font-size: 22px;
  font-weight: 650;
}

.keyboard > button:active {
  background: #eef2f7;
}

.keyboard .pay-button {
  grid-column: 4;
  grid-row: 1 / span 4;
  min-height: 275px;
  background: var(--blue);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  justify-content: center;
}

.pay-button span {
  font-size: 19px;
}

.pay-button small {
  max-width: 75px;
  font-size: 10px;
  line-height: 1.45;
  opacity: 0.8;
  font-weight: 400;
}

.keyboard .pay-button:active {
  background: var(--blue-dark);
}

.keyboard .pay-button:disabled {
  background: #aeb5c1;
  cursor: not-allowed;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 330px;
  transform: translate(-50%, 12px);
  max-width: min(82vw, 360px);
  padding: 9px 13px;
  border-radius: 9px;
  color: #fff;
  background: rgba(21, 28, 41, 0.9);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.loading-mask {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(242, 245, 249, 0.88);
  backdrop-filter: blur(3px);
}

.loading-card {
  width: min(82vw, 330px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
}

.loading-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.browser-guard {
  position: fixed;
  z-index: 200;
  inset: 0;
  padding: 96px 20px 24px;
  background: rgba(9, 14, 24, 0.9);
  overflow-y: auto;
}

.browser-guard-arrow {
  position: absolute;
  top: 10px;
  right: 18px;
  display: grid;
  justify-items: end;
  gap: 2px;
  color: #fff;
  animation: guard-bounce 1.4s ease-in-out infinite;
}

.browser-guard-arrow svg {
  width: 46px;
  height: 62px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.browser-guard-arrow span {
  padding-right: 4px;
  font-size: 13px;
  font-weight: 600;
}

@keyframes guard-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(7px);
  }
}

.browser-guard-card {
  width: min(100%, 380px);
  margin: 24px auto 0;
  padding: 30px 24px 26px;
  border-radius: 20px;
  background: #fff;
  text-align: center;
}

.browser-guard-card h1 {
  margin: 0;
  font-size: 21px;
}

.browser-guard-card > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.75;
}

.browser-guard-card b {
  padding: 0 3px;
  color: var(--ink);
  letter-spacing: 1px;
}

.browser-steps {
  margin-top: 18px;
  border-radius: 12px;
  padding: 13px 14px;
  display: grid;
  gap: 10px;
  text-align: left;
  color: #3d4a60;
  background: #f4f7fb;
  font-size: 13px;
}

.browser-steps span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.browser-steps i {
  flex: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

#copy-browser-link {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
}

#copy-browser-status {
  display: block;
  min-height: 18px;
  margin-top: 9px;
  color: var(--green);
  font-size: 11px;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 16px;
  border: 3px solid #e6eaf0;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}

@media (min-width: 700px) {
  body {
    padding: 20px 0;
  }

  .app-shell {
    min-height: calc(100vh - 40px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 45px rgba(23, 32, 51, 0.08);
  }

  .keyboard {
    bottom: 20px;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
  }
}
