:root {
  --accent: #0e7c70;
  --accent-dark: #0a6359;
  --text: #14302e;
  --muted: #4f6b67;
  --option-text: #0f2a28;
  --card: #ffffff;
  --card-border: #d8e7e3;
  --card-selected: #e2f4ee;
  --border-selected: #0e7c70;
  --error: #c02b3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background-color: #f6f8f4;
  background-image:
    radial-gradient(ellipse 70% 55% at 50% -10%, #cdeadf 0%, rgba(205,234,223,0) 100%),
    radial-gradient(ellipse 60% 55% at 0% 105%, #d9eee3 0%, rgba(217,238,227,0) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Header ---------- */
header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 20px 0;
}
.back {
  position: absolute;
  top: 25px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  font-weight: 400;
  font-size: 16px;
  color: var(--muted);
}
.back:hover { color: var(--accent); }
.back svg { width: 16px; height: 16px; }
.logo { font-size: 30px; font-weight: 600; color: var(--option-text); line-height: 1.2; }
.logo span { color: var(--accent); }
.progress {
  width: min(442px, 100%);
  height: 4px;
  margin-top: 21px;
  background: #bcdad1;
  border-radius: 99px;
  overflow: hidden;
}
.progress div {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 99px;
  transition: width .45s cubic-bezier(.4,0,.2,1);
}

/* ---------- Screen ---------- */
main { flex: 1; padding: 38px 20px 40px; }

.step { transition: opacity .22s ease, transform .22s ease; }
.step.leave-left  { opacity: 0; transform: translateX(-36px); }
.step.leave-right { opacity: 0; transform: translateX(36px); }
.step.no-anim     { transition: none; }

.prompt {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(640px, 100%);
  margin: 0 auto;
}
.prompt.wide { width: min(800px, 100%); }   /* gives a long title room to fit in two lines */
.prompt.full { width: min(895px, 100%); }   /* one-line title, lined up with two columns of answers */
.prompt.fit { width: fit-content; max-width: 100%; }   /* one-line title, centred */
.mascot { width: 86px; height: 86px; flex: none; animation: float 3.5s ease-in-out infinite; }
.mascot .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }

h1 { font-size: 28px; font-weight: 600; line-height: 1.23; outline: none; text-wrap: balance; }
.hint { margin-top: 10px; font-size: 17px; }

/* ---------- Welcome and thank-you screens ---------- */
.message { width: min(640px, 100%); margin: 34px auto 0; display: grid; gap: 16px; }
.message p { font-size: 19px; line-height: 1.55; }
.card { border: 1px solid var(--card-border); background: var(--card); border-radius: 18px; padding: 20px 24px; }
.card strong { display: block; margin-bottom: 4px; font-size: 21px; color: var(--option-text); }
.card p { font-size: 17px; color: var(--muted); }
.message .note { font-size: 15px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 14px; }

/* ---------- Details form: two fields per row ---------- */
.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 44px;
  width: min(895px, 100%);
  margin: 30px auto 0;
}
/* mascot and "Basic details" sit in the centre of the page */
body:has(.details) .prompt { width: fit-content; max-width: 100%; }
.field { display: grid; gap: 4px; align-content: start; }
.field.wide { grid-column: 1 / -1; }
/* fields appear one after another */
.field { animation: field-in .5s cubic-bezier(.22,.8,.3,1) backwards; animation-delay: calc(var(--i) * 60ms); }
@keyframes field-in { from { opacity: 0; transform: translateY(14px); } }

.control { position: relative; }
.control input {
  width: 100%;
  height: 58px;
  padding: 18px 4px 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--option-text);
  text-overflow: ellipsis;
  background: transparent;
  border: 0;
  border-bottom: 2px solid #bcdad1;    /* the only border: one line under the field */
  border-radius: 0;
  outline: 2px solid transparent;      /* still visible in high-contrast mode */
  transition: border-color .18s;
}
.control input:hover { border-bottom-color: #8fc0b2; }
.control input[aria-invalid="true"] { border-bottom-color: var(--error); }
.control input:-webkit-autofill { -webkit-box-shadow: 0 0 0 60px #f1f7f2 inset; }

/* line that grows from the centre of the selected field */
.control::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .35s cubic-bezier(.22,.8,.3,1);
}
.control:focus-within::after { transform: scaleX(1); }
.control:has([aria-invalid="true"])::after { background: var(--error); }

/* field name: slides up and shrinks once the field is in use */
.control label {
  position: absolute;
  top: 19px;
  left: 4px;
  right: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 17px;
  line-height: 22px;
  color: var(--muted);
  pointer-events: none;
  transition: top .22s, font-size .22s, color .22s;
}
.control input:focus + label,
.control input:not(:placeholder-shown) + label { top: 2px; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.control input[aria-invalid="true"] + label { color: var(--error); }

.error { padding-left: 4px; font-size: 13px; color: var(--error); }

/* ---------- Options ---------- */
.options {
  display: grid;
  gap: 11px;
  width: min(640px, 100%);
  margin: 44px auto 0;
}
.options.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 12px;
  width: min(895px, 100%);
}

.option {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 64px;
  padding: 14px 20px;
  text-align: left;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--option-text);
  background: var(--card);
  border: 2px solid transparent;       /* the border appears only when selected */
  border-radius: 18px;
  box-shadow: 0 6px 18px -12px rgba(14,80,70,.28);
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
}
.option:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(14,80,70,.13); }
.option:active { transform: scale(.985); }
.option[aria-pressed="true"] { background: var(--card-selected); border-color: var(--border-selected); }
.option .icon { width: 26px; height: 26px; flex: none; color: var(--accent); }
.option .label { flex: 1; }

.check {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #e6efec;                 /* soft square instead of an outline */
  transition: background .18s, border-color .18s;
}
.check svg { width: 18px; height: 18px; color: #fff; opacity: 0; transform: scale(.4); transition: .18s; }
.option[aria-pressed="true"] .check { background: var(--accent); border-color: var(--accent); }
.option[aria-pressed="true"] .check svg { opacity: 1; transform: scale(1); }

/* shown only if the answers could not be sent */
.send-error { width: min(640px, 100%); margin: 18px auto 0; text-align: center; font-size: 15px; font-weight: 600; color: var(--error); }

/* ---------- Footer button ---------- */
footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 15px 20px 18px;
  background: rgba(255,255,255,.96);
}
.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(454px, 100%);
  height: 66px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(14,124,112,.28);
  transition: background .18s, opacity .18s, transform .18s;
}
.primary:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  main { padding-top: 26px; }
  .logo { font-size: 24px; }
  .back { top: 23px; left: 10px; }
  .back b { display: none; }
  .mascot { width: 60px; height: 60px; }
  .prompt { gap: 14px; }
  h1 { font-size: 21px; }
  .hint { margin-top: 6px; font-size: 15px; }
  .message { margin-top: 24px; }
  .message p { font-size: 17px; }
  .details { grid-template-columns: 1fr; gap: 18px; margin-top: 24px; }
  .control input { font-size: 16px; }
  .control label { font-size: 14px; }
  .options { margin-top: 28px; }
  .options.two { grid-template-columns: 1fr; width: min(640px, 100%); }
  .option { min-height: 58px; padding: 12px 16px; gap: 13px; font-size: 16px; }
  .primary { height: 56px; font-size: 18px; }
}

/* ---------- Welcome screen: everything centred ---------- */
body.welcome main { flex: 0 0 auto; margin-top: auto; padding: 20px 20px 0; }
body.welcome footer { position: static; margin-bottom: auto; padding: 30px 20px 36px; background: none; }
body.welcome .prompt { flex-direction: column; gap: 46px; width: 100%; text-align: center; }
body.welcome .mascot {
  width: 118px;
  height: 118px;
  margin-top: 26px;
  border-radius: 50%;
  filter: drop-shadow(0 18px 18px rgba(14,124,112,.35));   /* soft glow that follows the shape */
}
body.welcome h1 { font-size: 46px; letter-spacing: -.015em; }
body.welcome .message { width: min(610px, 100%); margin-top: 20px; gap: 12px; text-align: center; text-wrap: balance; }
body.welcome .message p { font-size: 20px; }
body.welcome .message p + p { font-size: 17px; color: var(--muted); }
body.welcome .primary { width: min(340px, 100%); gap: 12px; }
body.welcome .primary::after { content: "\2192" / ""; transition: transform .2s; }
body.welcome .primary:hover::after { transform: translateX(5px); }

/* entrance, one piece after another */
body.welcome h1,
body.welcome .message p,
body.welcome .primary { animation: field-in .6s cubic-bezier(.22,.8,.3,1) backwards; }
body.welcome h1 { animation-delay: .08s; }
body.welcome .message p { animation-delay: .18s; }
body.welcome .message p + p { animation-delay: .28s; }
body.welcome .primary { animation-delay: .4s; }

@media (max-width: 720px) {
  body.welcome .prompt { gap: 38px; }
  body.welcome .mascot { width: 92px; height: 92px; margin-top: 22px; }
  body.welcome h1 { font-size: 30px; }
  body.welcome .message p { font-size: 17px; }
  body.welcome .message p + p { font-size: 15.5px; }
  body.welcome footer { padding: 24px 20px 28px; }
}

/* ---------- Thank-you screen: centred, matching the welcome screen ---------- */
body.thanks main { flex: 0 0 auto; margin-top: auto; padding: 8px 20px 24px; }
body.thanks main:has(+ footer[hidden]) { margin-bottom: auto; }
body.thanks footer { position: static; margin-bottom: auto; padding: 0 20px 24px; background: none; }
body.thanks .prompt { flex-direction: column; gap: 24px; width: 100%; text-align: center; }
body.thanks .mascot { width: 104px; height: 104px; filter: drop-shadow(0 18px 18px rgba(14,124,112,.35)); }
body.thanks h1 { font-size: 40px; letter-spacing: -.015em; }
body.thanks .message { width: min(880px, 100%); margin-top: 16px; gap: 22px; text-align: center; }
body.thanks .message > * { justify-self: center; width: min(620px, 100%); }
body.thanks .message > p { text-wrap: balance; }
/* wider than the card below, so this paragraph fits in two lines */
body.thanks .message > p:first-child { width: 100%; font-size: 18px; color: var(--muted); }
body.thanks .card {
  padding: 26px 30px;
  border: 0;
  border-radius: 24px;
  background: linear-gradient(135deg, #0f6f64, #0a4f48);
  box-shadow: 0 22px 40px -20px rgba(10,79,72,.7);
}
body.thanks .card strong { margin-bottom: 8px; font-size: 26px; color: #fff; }
body.thanks .card p { font-size: 16px; color: #cdeee5; text-wrap: balance; }
body.thanks .message .note { padding: 0; border: 0; font-size: 14px; }
body.thanks .primary { width: min(340px, 100%); }

/* entrance, one piece after another */
body.thanks h1,
body.thanks .message > *,
body.thanks .primary { animation: field-in .6s cubic-bezier(.22,.8,.3,1) backwards; }
body.thanks h1 { animation-delay: .08s; }
body.thanks .message > :nth-child(1) { animation-delay: .18s; }
body.thanks .message > :nth-child(2) { animation-delay: .28s; }
body.thanks .message > :nth-child(3) { animation-delay: .38s; }
body.thanks .primary { animation-delay: .48s; }

@media (max-width: 720px) {
  body.thanks .prompt { gap: 18px; }
  body.thanks .mascot { width: 84px; height: 84px; }
  body.thanks h1 { font-size: 28px; }
  body.thanks .message { gap: 18px; }
  body.thanks .message > p:first-child { font-size: 16px; }
  body.thanks .card { padding: 22px 20px; }
  body.thanks .card strong { font-size: 21px; }
}

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