:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: #111111;
  background: #eeeeee;
  font-synthesis: none;
  --donation-red: #eb4a47;
  --donation-red-dark: #dc3f3c;
  --page-background: #f7f7f8;
  --field-background: #ffffff;
  --muted: #a9aaad;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #eeeeee;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input { font: inherit; }

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

.donation-page {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  background: var(--page-background);
}

.hero-banner {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 750 / 326;
  object-fit: cover;
}

.page-content { padding: 0 18px; }

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  padding-top: 20px;
  font-size: 25px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

h2,
fieldset legend {
  margin: 0 0 16px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.3;
}

.gratitude-card {
  padding: 15px 13px;
  border-radius: 6px;
  background: var(--donation-red);
  color: #ffffff;
  font-size: 16px;
  line-height: 1.55;
}

.gratitude-card p { margin-bottom: 12px; }
.gratitude-card p:last-child { margin-bottom: 0; }

.notice-section { padding-top: 21px; }

.notice-section h2 { margin-bottom: 13px; }

.notice-section p,
.form-hint {
  margin-bottom: 0;
  color: #df4b48;
  font-size: 18.5px;
  line-height: 1.62;
}

.text-link {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.donation-form { padding-top: 25px; }

.form-section {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 68px;
}

.donation-type-row {
  flex-wrap: wrap;
  gap: 16px 34px;
}

.donation-type-row .radio-option { font-size: 19px; }

.type-hint {
  margin: 12px 0 0;
  color: #df4b48;
  font-size: 14px;
  line-height: 1.5;
}

.required-mark { color: var(--donation-red); }

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

.radio-option input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--donation-red);
}

.read-only-field,
.text-field {
  width: 100%;
  min-height: 49px;
  border: 0;
  border-radius: 7px;
  outline: 0;
  background: var(--field-background);
  color: #333333;
  font-size: 18px;
}

.read-only-field {
  display: flex;
  align-items: center;
  padding: 0 18px;
}

.text-field { padding: 0 18px; }

.remark-heading {
  display: flex;
  align-items: center;
}

.remark-count {
  margin-left: auto;
  color: #a9aaad;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
}

.remark-input-wrap { position: relative; }

.remark-input-wrap .text-field { padding-right: 52px; }

.clear-remark {
  position: absolute;
  top: 50%;
  right: 18px;
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #b7b8bb;
  color: #ffffff;
  cursor: pointer;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 18px;
  place-items: center;
}

.clear-remark:active { background: #96979a; }

.clear-remark[hidden] { display: none !important; }

.text-field::placeholder { color: var(--muted); }

.text-field:focus {
  box-shadow: 0 0 0 2px rgba(235, 74, 71, 0.18);
}

.text-field.is-invalid {
  box-shadow: 0 0 0 2px rgba(235, 74, 71, 0.62);
}

.form-hint { margin-top: 14px; }

.amount-section { margin-bottom: 0; }

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

.amount-choice {
  min-height: 66px;
  padding: 8px 3px;
  border: 1.5px solid var(--donation-red);
  border-radius: 7px;
  background: #ffffff;
  color: #111111;
  cursor: pointer;
  font-size: clamp(18px, 4.7vw, 20px);
  font-weight: 400;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

.amount-choice:active:not(:disabled) { transform: scale(0.985); }

.amount-choice.is-selected {
  background: var(--donation-red);
  color: #ffffff;
}

.custom-amount {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  margin-top: 12px;
  padding: 9px 17px;
  border-radius: 7px;
  background: var(--donation-red);
  color: #ffffff;
  font-size: clamp(18px, 4.7vw, 20px);
  white-space: nowrap;
}

.custom-amount input {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 0;
  border-radius: 6px;
  outline: 0;
  background: #f1f1f1;
  color: #3a3a3a;
  font-size: 20px;
  text-align: center;
}

.custom-amount input:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.field-error {
  min-height: 22px;
  margin: 7px 2px 0;
  color: #c9322f;
  font-size: 13px;
  line-height: 1.5;
}

.amount-section > .field-error:empty {
  min-height: 0;
  margin: 12px 0 0;
}

.remark-error:empty { min-height: 0; margin-top: 0; }

.submit-button {
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 7px;
  background: var(--donation-red);
  color: #ffffff;
  cursor: pointer;
  font-size: 22px;
  font-weight: 400;
  transition: background-color 120ms ease, transform 120ms ease, opacity 120ms ease;
}

.submit-button:active:not(:disabled) {
  background: var(--donation-red-dark);
  transform: translateY(1px);
}

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

.technical-support {
  margin: 28px 0 0;
  color: #b7b8bb;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.payment-security {
  margin: 10px 0 0;
  color: #8b8b8e;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.payment-confirm-dialog {
  width: min(calc(100% - 56px), 360px);
  padding: 0;
  border: 0;
  border-radius: 17px;
  overflow: hidden;
  background: #ffffff;
  color: #222222;
}

.payment-confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

.payment-confirm-content { padding: 28px 24px 24px; }

.payment-confirm-content h2 {
  margin: 0 0 13px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.payment-confirm-content p {
  margin: 0;
  color: #696a6d;
  font-size: 16px;
  line-height: 1.42;
  text-align: left;
}

.payment-confirm-actions {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  min-height: 54px;
  border-top: 1px solid #e5e6e8;
}

.payment-confirm-actions button {
  min-width: 0;
  padding: 0 8px;
  border: 0;
  background: #ffffff;
  color: #333333;
  cursor: pointer;
  font-size: 17px;
  outline: 0 !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
}

.payment-confirm-actions button + button {
  border-left: 1px solid #e5e6e8;
  color: #ef263c;
}

.payment-confirm-actions button:disabled { opacity: 0.55; }

.payment-confirm-actions button:focus,
.payment-confirm-actions button:focus-visible {
  outline: 0 !important;
  box-shadow: none !important;
}

.payment-success-dialog {
  /* 与捐赠首页的成功提示截图一致：窄卡片、短内容区、单行确认按钮。 */
  width: min(calc(100% - 56px), 274px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  color: #222222;
}

.payment-success-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

.payment-success-content {
  padding: 23px 20px 13px;
  text-align: center;
}

.payment-success-content h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.payment-success-content p {
  margin: 10px 0 0;
  color: #747579;
  font-size: 16px;
  line-height: 1.25;
}

.payment-success-dialog > button {
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-top: 1px solid #e5e6e8;
  outline: 0;
  background: #ffffff;
  color: #ef263c;
  cursor: pointer;
  font-size: 18px;
  appearance: none;
  -webkit-appearance: none;
}

.payment-success-dialog > button:focus,
.payment-success-dialog > button:focus-visible {
  outline: 0;
  box-shadow: none;
}

.wechat-only-dialog {
  width: min(calc(100% - 56px), 274px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  color: #222222;
}

.wechat-only-dialog::backdrop { background: rgba(0, 0, 0, 0.7); }

.wechat-only-content {
  padding: 23px 20px 13px;
  text-align: center;
}

.wechat-only-content h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.wechat-only-content p {
  margin: 10px 0 0;
  color: #727276;
  font-size: 16px;
  line-height: 1.25;
}

.wechat-only-dialog > #wechat-only-confirm {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  box-sizing: border-box;
  border: 0;
  border-top: 1px solid #e5e6e8;
  background: #ffffff;
  color: #ef263c;
  cursor: pointer;
  font-size: 18px;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none;
}

/* 非微信扫码时的独立空白提示页，不渲染任何捐款首页内容。 */
.wechat-only-page {
  min-height: 100vh;
  margin: 0;
  background: #ffffff;
  color: #161616;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.wechat-only-page-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.wechat-only-page-panel {
  width: min(100%, 320px);
  text-align: center;
}

.wechat-only-page-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
}

.wechat-only-page-panel p {
  margin: 16px 0 0;
  color: #727276;
  font-size: 18px;
  line-height: 1.6;
}

.wechat-only-page-panel a {
  display: grid;
  place-items: center;
  min-height: 52px;
  margin-top: 42px;
  border-radius: 10px;
  background: #ef263c;
  color: #ffffff;
  font-size: 18px;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 支付结果页不展示首页内容，只保留独立的结果信息。 */
.payment-result-page {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #161616;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.payment-result-main {
  width: min(100%, 420px);
  padding: 24px;
  box-sizing: border-box;
}

.payment-result-panel {
  text-align: center;
}

.payment-result-panel h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.35;
}

.payment-result-panel p {
  margin: 16px 0 0;
  color: #727276;
  font-size: 18px;
  line-height: 1.6;
}

.payment-result-panel #status-description.is-success {
  color: #ef263c;
  font-size: 28px;
  line-height: 1.35;
}

.result-pending {
  width: 34px;
  height: 34px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 3px solid #ededed;
  border-top-color: #ee263d;
  animation: result-spin .8s linear infinite;
}

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

.payment-result-panel #result-confirm {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 52px;
  margin-top: 42px;
  box-sizing: border-box;
  border: 0;
  border-radius: 10px;
  background: #ef263c;
  color: #ffffff;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  text-decoration: none;
}

@media (min-width: 520px) {
  .donation-page { box-shadow: 0 0 32px rgba(0, 0, 0, 0.09); }
}

@media (max-width: 359px) {
  .page-content { padding-inline: 14px; }
  .radio-row { gap: 44px; }
  .amount-grid { gap: 9px; }
  .amount-choice { min-height: 64px; }
  .custom-amount { gap: 7px; padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
