:root {
  --green: #00bf63;
  --green-dark: #07944f;
  --cream: #f7f2df;
  --yellow: #ffd34e;
  --text: #183226;
  --muted: #718078;
  --line: #dce9e0;
  --danger: #d94a44;
  color: var(--text);
  background: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(0, 191, 99, .28); outline-offset: 2px; }

.registration-page { background: var(--cream); }
.registration-shell { display: flex; width: 100%; height: 100svh; min-height: 568px; flex-direction: column; overflow: hidden; background: var(--cream); }
.registration-hero {
  position: relative;
  flex: 0 0 clamp(235px, 37svh, 330px);
  min-height: 0;
  padding: calc(22px + env(safe-area-inset-top)) 24px 54px;
  overflow: hidden;
  background: var(--cream) url("../public/invite-journey-hero.webp") center 67% / cover no-repeat;
}
.registration-hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(247, 242, 223, .92) 0%, rgba(247, 242, 223, .58) 47%, rgba(247, 242, 223, 0) 78%);
  content: "";
  pointer-events: none;
}
.hero-brand { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; color: var(--green-dark); text-decoration: none; }
.hero-brand img { width: 50px; height: 50px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 145, 75, .12); }
.hero-brand span { font-size: 29px; font-weight: 800; letter-spacing: -.08em; }
.hero-copy { position: relative; z-index: 1; margin-top: 24px; text-align: center; }
.hero-copy h1 { margin: 0; font-size: clamp(32px, 9vw, 42px); font-weight: 850; letter-spacing: -.07em; line-height: 1.1; }
.hero-copy p { margin: 10px 0 0; color: #52665a; font-size: 15px; font-weight: 600; letter-spacing: .08em; }

.registration-panel {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  margin-top: -28px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 28px 28px 0 0;
}
.registration-content { width: 100%; max-width: 430px; margin: auto; }

#registration-form { display: grid; gap: 13px; }
.form-fields { display: grid; gap: 13px; }
.field { display: grid; gap: 6px; color: #283d32; font-size: 13px; font-weight: 750; }
.input-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; min-height: 58px; padding: 0 15px; background: #fff; border: 1px solid #d7e0da; border-radius: 15px; }
.input-row > img { width: 20px; height: 20px; margin-right: 12px; opacity: .64; }
.field input {
  width: 100%;
  min-width: 0;
  height: 54px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  font-size: 16px;
  outline: 0;
}
.input-row:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(0, 191, 99, .08); }
.field input::placeholder { color: #a7b0aa; }
.verification-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.text-button { min-width: 98px; height: 38px; padding: 0 10px; color: var(--green-dark); background: #fff; border: 0; border-left: 1px solid #dce5df; font-size: 13px; font-weight: 750; cursor: pointer; }
.text-button:disabled { color: #87928b; background: #f1f4f2; cursor: default; }
.readonly-invite { grid-template-columns: minmax(0, 1fr) auto; color: #244035; background: #f5f5f5; }
.readonly-invite strong { min-width: 0; padding: 12px 0; font-size: 19px; letter-spacing: .07em; overflow-wrap: anywhere; }
.readonly-invite > img { margin: 0; opacity: .62; }
.agreement { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; margin-top: 8px; color: #7c8881; font-size: 12px; line-height: 1.55; }
.agreement input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--green); }
.agreement a { color: var(--green-dark); text-decoration: none; }
.form-message { min-height: 18px; margin: -2px 0 -4px; color: var(--danger); font-size: 12px; text-align: center; }
.form-message[data-type="success"] { color: var(--green-dark); }
.form-message[data-type="notice"] { color: #8b6b13; }
.primary-button { width: 100%; height: 54px; color: #fff; background: var(--green); border: 0; border-radius: 999px; box-shadow: 0 10px 22px rgba(0, 191, 99, .2); font-size: 16px; font-weight: 750; cursor: pointer; }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { background: #b9c9c0; box-shadow: none; cursor: default; }
.existing-user { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 40px 0 0; color: #879189; font-size: 13px; text-align: center; }
.existing-user::before, .existing-user::after { width: 38px; height: 1px; margin: 0 6px; background: #dfe7e2; content: ""; }
.existing-user a { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.existing-user-dialog { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(21, 47, 34, .38); }
.existing-user-dialog[hidden] { display: none; }
.existing-user-dialog__card { display: grid; justify-items: stretch; width: min(100%, 320px); padding: 26px 22px 18px; background: #fff; border-radius: 22px; box-shadow: 0 20px 60px rgba(20, 50, 35, .2); text-align: center; }
.existing-user-dialog__card h2 { margin: 0 0 22px; color: var(--text); font-size: 18px; font-weight: 750; line-height: 1.55; }
.existing-user-dialog__primary { display: flex; align-items: center; justify-content: center; height: 48px; color: #fff; background: var(--green); border-radius: 999px; font-size: 15px; font-weight: 750; text-decoration: none; }
.existing-user-dialog__secondary { height: 42px; margin-top: 6px; color: #78857e; background: transparent; border: 0; font-size: 13px; cursor: pointer; }

.download-page { background: #fff; }
.download-shell { display: flex; flex-direction: column; width: 100%; min-height: 100svh; background: #fff; }
.download-hero {
  position: relative;
  flex: 0 0 clamp(172px, 29svh, 248px);
  padding: calc(16px + env(safe-area-inset-top)) 20px 0;
  overflow: hidden;
  background: #e7f0e6 url("../public/invite-journey-hero.webp") center 62% / cover no-repeat;
}
.download-hero::after { position: absolute; inset: 0; background: rgba(239, 245, 229, .08); content: ""; pointer-events: none; }
.hero-brand--compact { z-index: 1; color: #16784a; }
.hero-brand--compact img { width: 40px; height: 40px; border-radius: 11px; }
.hero-brand--compact span { font-size: 23px; }
.download-panel { position: relative; z-index: 2; display: flex; flex: 1 1 auto; align-items: center; justify-content: center; min-height: 0; margin-top: -22px; padding: 18px 20px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-radius: 28px 28px 0 0; }
.download-content { --download-section-gap: 20px; display: grid; justify-items: center; width: 100%; max-width: 430px; gap: var(--download-section-gap); padding: 24px 0; }
.success-copy { text-align: center; }
.success-copy h1 { margin: 0; font-size: clamp(29px, 8vw, 36px); font-weight: 850; letter-spacing: -.05em; }
.success-copy p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.download-page [hidden] { display: none !important; }
.download-help { margin: 4px 0 0; color: #8a958f; font-size: 11px; line-height: 1.55; text-align: center; }
.download-help a { color: #66756d; text-decoration: none; }

@media (min-width: 560px) {
  body { background: #e7eee9; }
  .registration-shell, .download-shell { max-width: 480px; margin: 0 auto; box-shadow: 0 0 56px rgba(35, 74, 52, .12); }
}

@media (min-width: 811px) {
  html[data-platform="desktop"] .download-shell { max-width: 720px; }
  html[data-platform="desktop"] .download-content { max-width: 560px; }
}

@media (max-height: 720px) {
  .registration-shell { min-height: 0; }
  .registration-hero { flex-basis: clamp(160px, 30svh, 190px); padding-top: calc(12px + env(safe-area-inset-top)); }
  .registration-hero .hero-brand img { width: 42px; height: 42px; border-radius: 12px; }
  .registration-hero .hero-brand span { font-size: 25px; }
  .registration-hero .hero-copy { margin-top: 13px; }
  .registration-hero .hero-copy h1 { font-size: 29px; }
  .registration-hero .hero-copy p { margin-top: 5px; font-size: 12px; }
  .registration-panel { margin-top: -24px; padding-top: 24px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  #registration-form { gap: 9px; }
  .form-fields { gap: 8px; }
  .field { gap: 4px; font-size: 11px; }
  .input-row { min-height: 50px; padding-right: 12px; padding-left: 12px; border-radius: 13px; }
  .input-row > img { width: 18px; height: 18px; margin-right: 9px; }
  .field input { height: 46px; font-size: 15px; }
  .text-button { min-width: 88px; height: 34px; padding-right: 7px; padding-left: 9px; font-size: 12px; }
  .readonly-invite strong { font-size: 17px; }
  .readonly-invite > img { margin: 0; }
  .agreement { gap: 7px; margin-top: 7px; font-size: 11px; line-height: 1.45; }
  .agreement input { width: 16px; height: 16px; }
  .form-message { min-height: 14px; margin-bottom: -3px; font-size: 11px; }
  .primary-button { height: 48px; font-size: 15px; }
  .existing-user { font-size: 12px; }
  .download-hero { flex-basis: 156px; }
  .download-panel { margin-top: -18px; padding-top: 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .success-copy h1 { font-size: 27px; }
  .success-copy p { margin-top: 4px; font-size: 12px; }
  .download-help { margin-top: 1px; font-size: 10px; }
}

@media (max-width: 350px) {
  .registration-panel, .download-panel { padding-right: 15px; padding-left: 15px; }
  .verification-row { gap: 6px; }
  .text-button { min-width: 96px; padding: 0 8px; }
}

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