:root {
  color-scheme: light;
  --ink: #192e25;
  --green: #174c39;
  --deep: #142f28;
  --muted: #54665c;
  --line: #d8e3da;
  --paper: #f5f8f5;
  --gutter: max(18px, env(safe-area-inset-left), env(safe-area-inset-right));
  --heading: 'Songti SC', 'STSong', 'Noto Serif CJK SC', SimSun, serif;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.55 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
:root:lang(en) { --heading: Georgia, 'Times New Roman', serif; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, p { margin: 0; }
body { min-height: 100vh; min-height: 100svh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #a15e25; outline-offset: 3px; }
.mast {
  padding-top: env(safe-area-inset-top);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.mast-inner {
  width: min(1080px, 100% - 2 * var(--gutter));
  min-height: 66px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand { color: var(--deep); display: flex; align-items: center; gap: 9px; line-height: 1.2; }
.brand strong { font-size: 1.08rem; font-weight: 700; }
.back, .text-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  margin: 0 -6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--green);
  font-size: .92rem;
  font-weight: 630;
}
.back:hover, .text-button:not(:disabled):hover { text-decoration: underline; text-underline-offset: .24em; }
.registration {
  width: min(100% - 2 * var(--gutter), 468px);
  margin-inline: auto;
  padding: clamp(36px, 11vh, 108px) 0 max(24px, env(safe-area-inset-bottom));
}
.registration-panel {
  padding: clamp(23px, 5vw, 39px);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}
h1 {
  font-family: var(--heading);
  font-size: clamp(2rem, 5.5vw, 2.55rem);
  font-weight: 650;
  color: var(--deep);
  line-height: 1.17;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
  text-wrap: balance;
  margin-bottom: 22px;
}
:lang(en) h1 { font-weight: 550; }
a { text-decoration: none; }
.brand img { border-radius: 6px; }
.support-actions { display: flex; align-items: center; gap: 20px; }
.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #747775;
  border-radius: 5px;
  color: #1f1f1f;
  font: 500 15px/20px Roboto, system-ui, sans-serif;
}
.google-button:hover { background: #f8fafd; }
.google-button svg { width: 18px; height: 18px; }
.buyer-or {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 13px 0;
  color: var(--muted);
  font-size: .84rem;
}
.buyer-or::before, .buyer-or::after { content: ''; border-top: 1px solid var(--line); flex: 1; }
label { display: block; margin-bottom: 6px; font-size: .95rem; font-weight: 650; }
input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 11px 12px;
  border: 1px solid #aebfb3;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
}
input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: #a43c2e; }
#buyer-code { font-size: 1.5rem; letter-spacing: .4em; font-variant-numeric: tabular-nums; direction: ltr; }
.primary {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  margin-top: 13px;
  padding: 9px 14px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 650;
  text-align: center;
}
.primary:not(:disabled):hover { background: var(--deep); border-color: var(--deep); }
.primary:disabled { opacity: .64; }
.form-error:not(:empty), .status:not(:empty) { margin-top: 7px; font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-error { color: #a23223; }
.status { color: var(--muted); }
.code-description { margin: -8px 0 18px; color: var(--muted); overflow-wrap: anywhere; }
.code-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 7px; }
.text-button:disabled { color: var(--muted); font-weight: 500; }
.registration footer { text-align: center; margin-top: 12px; }
.registration footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-underline-offset: .26em; font-size: .88rem; }
@media (max-width: 480px) {
  .mast-inner { min-height: 58px; }
  .registration { padding-top: 32px; }
  .registration-panel { padding: 22px 18px; }
  h1 { margin-bottom: 19px; }
}

.registration footer a { text-decoration: underline; }
.muted, .intro { color: var(--muted); font-size: .92rem; }
.status[data-error="true"] { color: #a23223; }
#registration-target { padding: 12px 14px; margin-bottom: 18px; background: var(--paper); border-radius: 8px; overflow-wrap: anywhere; }
#registration-buyer-label, #registration-buyer { color: var(--muted); font-size: .88rem; }
#registration-product { display: block; margin-top: 3px; font-weight: 650; }
#support-section { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
#support-section:has(summary[hidden]) { border: 0; margin-top: 0; padding-top: 0; }
#support-section summary { cursor: pointer; color: var(--green); padding-block: 10px; font-size: .92rem; }
#support-qr { margin: 16px 0 0; }
#support-qr img { display: block; width: min(100%, 304px); height: auto; object-fit: contain; -webkit-touch-callout: default; }
#support-qr figcaption { margin-top: 10px; color: var(--muted); font-size: .88rem; }
@media (max-width: 360px) {
  .support-actions { gap: 14px; }
  .brand { gap: 6px; }
  .brand strong { font-size: .95rem; }
}

#buyer-google-popup { height: 44px; display: grid; grid-template-columns: minmax(0,1fr); place-items: center; }
#google-slot { min-width: 0; width: 100%; max-width: 400px; }
#google-slot:empty { display:none; }
/* Keep the SDK's temporary button stable until Google's own styles arrive.
   Unlayered Google rules take precedence over this fallback. */
@layer google-fallback {
  #google-slot [role="button"] {
    display: grid;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: white;
    color: #3c4043;
    cursor: pointer;
    font: 400 14px/20px Arial, sans-serif;
  }
  #google-slot [role="button"] > div:empty { position: absolute; }
  #google-slot [role="button"] > div:has(svg) { display: flex; align-items: center; gap: 8px; }
  #google-slot [role="button"] span:not([id]) { flex: 1; text-align: center; }
  #google-slot [role="button"] span[id] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #google-slot svg { display: block; width: 18px; height: 18px; }
}
#google-slot svg, #google-slot img { max-width: 20px; max-height: 20px; }
#google-retry { width: 100%; margin: 0; border: 1px solid var(--line); }
