:root {
  --yellow: #E9FE0F;
  --yellow-tint-12: rgba(233, 254, 15, 0.12);
  --yellow-tint-30: rgba(233, 254, 15, 0.30);
  --yellow-hl: rgba(233, 254, 15, 0.55);
  --dark: #1C1B17;
  --cream: #F5F4F0;
  --white: #FFFFFF;
  --grey-text: #6B6B6B;
  --border: #E5E4E0;
  --muted: #A5A4A0;
  --placeholder: #9B9B9B;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --radius-card: 8px;
  --radius-pill: 100px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --gutter: 20px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--dark);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header and progress */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) var(--gutter) 14px;
}

.top img {
  display: block;
  width: 88px;
  height: auto;
}

.step-count {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-text);
}

.progress {
  position: relative;
  height: 3px;
  margin: 0 var(--gutter);
  background: var(--dark);
  border-radius: 3px;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--yellow);
  border-radius: 3px;
  transition: width 0.4s var(--ease);
}

.progress-fill::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px #E9FE0F;
}

.progress[data-empty="true"] .progress-fill::after { display: none; }

/* Screens */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding: 28px var(--gutter) 24px;
  animation: rise 0.3s var(--ease);
}

@keyframes rise {
  from { transform: translateY(6px); }
  to { transform: none; }
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 7.6vw, 36px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1:focus { outline: none; }

.hl {
  background: var(--yellow-hl);
  padding: 0 4px;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.lede {
  margin: 0 0 24px;
  color: var(--grey-text);
  font-size: 16px;
}

.card {
  background: var(--white);
  border-radius: var(--radius-card);
  padding: 4px 20px;
}

.card + .card { margin-top: 12px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-text);
}

/* Cover */

.ask-group {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.ask-group:last-child { border-bottom: 0; }

.ask-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

.ask-group li { padding: 1px 0; }

.banner {
  margin-top: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-card);
  background: var(--yellow-tint-30);
  font-size: 15px;
}

.banner strong { font-weight: 700; }

.note {
  margin: 16px 2px 0;
  font-size: 13px;
  color: var(--grey-text);
}

/* Fields */

.field {
  padding: 18px 0 14px;
  border: 0;
  margin: 0;
  min-width: 0;
}

.field + .field { border-top: 1px solid var(--border); }

.field > label,
.field > legend {
  display: block;
  padding: 0;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-text);
}

/* A legend sits on the fieldset edge by default, which drops the field's top padding. */
.field > legend {
  float: left;
  width: 100%;
}

.field > legend + * { clear: both; }

.optional {
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.control {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--border);
}

.control::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--dark);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}

.control:focus-within::after,
.field.invalid .control::after { transform: scaleX(1); }

.control input,
.control select,
.control textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--dark);
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.control textarea {
  resize: none;
  min-height: 84px;
}

.control input::placeholder,
.control textarea::placeholder {
  color: var(--placeholder);
  font-weight: 400;
}

.control input[type="date"] { min-width: 100%; text-align: left; }
.control input[type="date"]::-webkit-date-and-time-value { text-align: left; }

.control select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%231C1B17' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.control select:invalid { color: var(--placeholder); font-weight: 400; }

.affix {
  flex: none;
  padding-right: 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--grey-text);
}

.affix.suffix { padding: 0 0 0 10px; }

.hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--grey-text);
}

.err {
  display: none;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.err span {
  background: var(--yellow-hl);
  padding: 2px 6px;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.field.invalid .err { display: block; }
.field.invalid .hint { display: none; }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Choice chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.chips input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chips label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.chips input:checked + label {
  background: var(--yellow);
  border-color: var(--dark);
}

.chips input:focus-visible + label {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}

.field.invalid .chips label { border-color: var(--dark); }
.field.invalid .chips input:checked + label { border-color: var(--dark); }

/* Stepper */

.stepper {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 8px;
}

.stepper button {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  color: var(--dark);
  font-family: inherit;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.stepper button:active { background: var(--yellow); border-color: var(--dark); }
.stepper button:disabled { color: var(--muted); cursor: default; background: var(--white); border-color: var(--border); }

.stepper output {
  min-width: 28px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Review */

.review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

#review .ask-group { padding: 12px 0 8px; }

.review-head .eyebrow { margin: 0; }

.edit {
  border: 0;
  background: none;
  padding: 8px 0 8px 16px;
  color: var(--dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.rows {
  margin: 0;
  padding: 0;
}

.rows div {
  padding: 6px 0;
}

.rows dt {
  font-size: 13px;
  color: var(--grey-text);
}

.rows dd {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.send-error {
  margin-top: 12px;
  padding: 14px 20px;
  border-radius: var(--radius-card);
  border: 2px solid var(--dark);
  background: var(--white);
  font-size: 15px;
  font-weight: 600;
}

/* Done */

.done-mark {
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--yellow);
  display: grid;
  place-items: center;
}

.next-title { padding-top: 16px; }

.steps-next {
  margin: 0;
  padding: 12px 0;
  list-style: none;
  counter-reset: n;
}

.steps-next li {
  position: relative;
  padding: 8px 0 8px 36px;
  counter-increment: n;
  font-weight: 600;
}

.steps-next li::before {
  content: counter(n);
  position: absolute;
  left: 0;
  top: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--dark);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Action bar */

.bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}

.btn-primary {
  flex: 1;
  background: var(--yellow);
  color: var(--dark);
}

.btn-primary:active { background: #E2F55C; }
.btn-primary:disabled { background: var(--border); color: var(--grey-text); cursor: default; }

.btn-ghost {
  padding: 0 18px 0 6px;
  background: transparent;
  color: var(--dark);
}

.btn:focus-visible,
.edit:focus-visible,
.stepper button:focus-visible {
  outline: 2px solid var(--dark);
  outline-offset: 2px;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (min-width: 560px) {
  .shell { padding: 24px 0; }
  .screen { padding-top: 36px; }
  .bar { border-top: 0; }
}

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