:root {
  color-scheme: light;
  --primary: #34c759;
  --primary-dark: #23ac48;
  --text: #101119;
  --muted: #777a7d;
  --placeholder: #b9bcbe;
  --surface: #ffffff;
  --input: #f6f7f6;
  --danger: #e5484d;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 5%, rgba(90, 214, 118, 0.18), transparent 26%),
    linear-gradient(180deg, #effbf2 0, #f7f8f7 42%, #f7f8f7 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(48px, env(safe-area-inset-top)) 20px calc(26px + var(--safe-bottom));
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  content: "";
}

.app-shell::before {
  top: -94px;
  right: -112px;
  width: 270px;
  height: 270px;
  background: rgba(52, 199, 89, 0.09);
}

.app-shell::after {
  top: 95px;
  left: -68px;
  width: 136px;
  height: 136px;
  border: 24px solid rgba(52, 199, 89, 0.045);
}

.hero {
  position: relative;
  min-height: 184px;
  padding: 14px 12px 24px;
}

.merchant-badge {
  display: inline-flex;
  align-items: center;
  height: 25px;
  margin-bottom: 13px;
  padding: 0 11px;
  border: 1px solid rgba(52, 199, 89, 0.2);
  border-radius: 999px;
  color: #229342;
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(29px, 8vw, 36px);
  font-weight: 750;
  line-height: 1.38;
  letter-spacing: 0.5px;
}

.brand-sign {
  position: absolute;
  left: 106px;
  bottom: 25px;
  width: 96px;
  height: auto;
  object-fit: contain;
}

.login-card {
  padding: 25px 22px 28px;
  border: 1px solid rgba(21, 77, 35, 0.04);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 50px rgba(20, 61, 30, 0.08);
  backdrop-filter: blur(8px);
}

.login-card h2 {
  margin: 0 0 24px;
  font-size: 21px;
  line-height: 1.45;
  text-align: center;
}

.wechat-bind-description {
  margin: -13px 8px 22px;
  color: #737875;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.form-field {
  margin-bottom: 19px;
}

.form-field label {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 650;
}

.input-wrap {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--input);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
  border-color: rgba(52, 199, 89, 0.55);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.11);
}

.input-wrap.is-error {
  border-color: rgba(229, 72, 77, 0.7);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.input-wrap input::placeholder {
  color: var(--placeholder);
}

.code-wrap input {
  padding-right: 12px;
}

.send-code {
  flex: 0 0 auto;
  padding: 8px 0 8px 14px;
  border: 0;
  border-left: 1px solid #e4e6e4;
  color: var(--primary);
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.send-code:disabled {
  color: #a7aaa8;
  cursor: default;
}

.field-error {
  min-height: 16px;
  margin: 5px 2px -13px;
  color: var(--danger);
  font-size: 12px;
  line-height: 16px;
}

.login-button {
  width: 100%;
  height: 52px;
  margin-top: 24px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #3bd263, var(--primary));
  box-shadow: 0 10px 24px rgba(52, 199, 89, 0.23);
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.login-button:active {
  transform: translateY(1px);
  box-shadow: 0 6px 16px rgba(52, 199, 89, 0.19);
}

.login-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.wechat-login {
  margin-top: 24px;
}

.wechat-login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #a0a4a1;
  font-size: 12px;
}

.wechat-login-divider span {
  flex: 1;
  height: 1px;
  background: #eceeec;
}

.wechat-login-divider em {
  font-style: normal;
}

.wechat-login-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin: 18px auto 0;
  padding: 0;
  border: 0;
  color: #858986;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.wechat-login-button svg {
  width: 48px;
  height: 48px;
  fill: #20c66b;
}

.wechat-login-button circle {
  fill: #fff;
}

.wechat-login-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.agreement-row {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 0;
  color: #676a6c;
  font-size: 12px;
  line-height: 22px;
  cursor: pointer;
  user-select: none;
}

.agreement-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.checkmark {
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  place-items: center;
  border: 1.5px solid #85898b;
  border-radius: 5px;
  background: #fff;
  transition: all 140ms ease;
}

.checkmark svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
  opacity: 0;
  transform: scale(0.7);
  transition: all 140ms ease;
}

.agreement-row input:checked + .checkmark {
  border-color: var(--primary);
  background: var(--primary);
}

.agreement-row input:checked + .checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.agreement-row input:focus-visible + .checkmark {
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
}

.agreement-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  color: #269b45;
  background: transparent;
  font-size: inherit;
  cursor: pointer;
}

.modal[hidden],
.toast[hidden] {
  display: none;
}

.modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(13, 19, 15, 0.54);
  animation: fade-in 160ms ease-out;
}

.modal-panel {
  position: relative;
  width: min(100%, 520px);
  max-height: min(82dvh, 760px);
  padding-bottom: var(--safe-bottom);
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.13);
  animation: slide-up 220ms ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 20px;
  border-bottom: 1px solid #eef0ee;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #555a57;
  background: #f4f5f4;
  cursor: pointer;
}

.modal-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.modal-content {
  height: calc(min(82dvh, 760px) - 128px - var(--safe-bottom));
  min-height: 260px;
  padding: 18px 20px;
  overflow-y: auto;
  color: #3e4240;
  font-size: 14px;
  line-height: 1.85;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}

.modal-content h1,
.modal-content h2,
.modal-content h3 {
  color: var(--text);
  line-height: 1.5;
}

.modal-content img {
  max-width: 100%;
  height: auto;
}

.agreement-loading,
.agreement-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: #8a8e8b;
}

.modal-footer {
  height: 66px;
  padding: 8px 20px;
  border-top: 1px solid #eef0ee;
  background: #fff;
}

.modal-footer button {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--primary);
  font-weight: 650;
  cursor: pointer;
}

.download-modal {
  align-items: center;
  padding: 24px;
}

.download-panel {
  position: relative;
  width: min(100%, 360px);
  padding: 34px 25px 27px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: download-in 220ms ease-out;
}

.download-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 22px;
  color: var(--primary);
  background: linear-gradient(145deg, #e6fbea, #f3fff5);
  box-shadow: inset 0 0 0 1px rgba(52, 199, 89, 0.08);
}

.download-icon svg {
  width: 45px;
  height: 45px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.download-panel h2 {
  margin: 0 0 11px;
  font-size: 23px;
  line-height: 1.4;
}

.download-panel p {
  margin: 0 auto 25px;
  color: #626765;
  font-size: 15px;
  line-height: 1.75;
}

.download-panel button {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #3bd263, var(--primary));
  box-shadow: 0 10px 24px rgba(52, 199, 89, 0.23);
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}

.download-panel button:disabled {
  cursor: default;
  opacity: 0.65;
}

.bind-confirm-modal {
  align-items: center;
  padding: 24px;
}

.bind-confirm-panel {
  position: relative;
  width: min(100%, 340px);
  padding: 28px 24px 22px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: download-in 200ms ease-out;
}

.bind-confirm-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.bind-confirm-panel p {
  margin: 0;
  color: #646966;
  font-size: 14px;
  line-height: 1.7;
}

.bind-confirm-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.bind-confirm-actions button {
  flex: 1;
  height: 44px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.bind-confirm-cancel {
  border: 1px solid #dfe3e0;
  color: #5d625f;
  background: #fff;
}

.bind-confirm-submit {
  border: 0;
  color: #fff;
  background: var(--primary);
}

.download-tip {
  display: block;
  margin-top: 13px;
  color: #9a9e9b;
  font-size: 11px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 50;
  top: 46%;
  left: 50%;
  max-width: min(78vw, 320px);
  padding: 11px 16px;
  border-radius: 9px;
  color: #fff;
  background: rgba(20, 23, 21, 0.86);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  transform: translate(-50%, -50%);
  animation: toast-in 150ms ease-out;
}

noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 12px;
  border-radius: 8px;
  color: #fff;
  background: #333;
  text-align: center;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0.6; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -45%); }
}

@keyframes download-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
}

@media (min-width: 600px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100dvh - 48px);
    border: 1px solid rgba(19, 70, 31, 0.05);
    border-radius: 30px;
    background: rgba(250, 253, 250, 0.5);
    box-shadow: 0 28px 80px rgba(18, 69, 31, 0.12);
  }

  .modal {
    align-items: center;
  }

  .modal-panel {
    border-radius: 24px;
  }
}

@media (max-height: 700px) {
  .app-shell {
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .hero {
    min-height: 145px;
    padding-top: 4px;
  }

  .brand-sign {
    bottom: 18px;
  }

  .login-card {
    padding-top: 20px;
    padding-bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
