:root {
  --ink: #2a2030;
  --muted: #6f6374;
  --line: #d9cbd5;
  --blush: #fbf2f8;
  --error: #b3261e;
  --accent: #b4177a;
  --accent-deep: color-mix(in srgb, var(--accent) 80%, #000);
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, -apple-system, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 30rem;
  margin: 0 auto;
  padding: 28px 22px calc(64px + env(safe-area-inset-bottom));
}

.brand { margin: 0 0 30px; }
.wordmark {
  display: inline-block;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--accent);
}
.logo { display: block; max-width: 11rem; max-height: 4.5rem; height: auto; }

h1 {
  margin: 0 0 .5rem;
  font-size: 1.65rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
}
.intro { margin: 0 0 1.75rem; color: var(--muted); max-width: 34rem; }
.state p { color: var(--muted); }

/* Fields */
.field { margin: 0 0 1.5rem; }
.field label, .field legend {
  display: block;
  margin: 0 0 .1rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
}
.field fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.req { color: var(--accent); margin-left: .1em; }
.help { margin: 0 0 .15rem; font-size: .85rem; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=date], select, textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: .6rem 0 .55rem;
  font: inherit;
  font-size: 1.0625rem; /* 17px: stops iOS zooming on focus */
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s;
}
textarea { resize: vertical; min-height: 4.6rem; line-height: 1.45; }
select {
  padding-right: 1.6rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236f6374' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") right .2rem center no-repeat;
}
input::placeholder, textarea::placeholder { color: #b7abb3; }
input:focus, select:focus, textarea:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 1.5px 0 0 var(--accent);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-bottom-color: var(--error); box-shadow: 0 1.5px 0 0 var(--error); }

.phone { display: flex; align-items: stretch; border-bottom: 1.5px solid var(--line); transition: border-color .15s; }
.phone:focus-within { border-bottom-color: var(--accent); box-shadow: 0 1.5px 0 0 var(--accent); }
.field.has-error .phone { border-bottom-color: var(--error); box-shadow: 0 1.5px 0 0 var(--error); }
.phone .cc { display: flex; align-items: center; padding: 0 .7rem 0 0; margin-right: .7rem; border-right: 1.5px solid var(--line); color: var(--muted); font-size: 1.0625rem; }
.phone input, .phone input:focus { border: 0; box-shadow: none; }

.check { display: flex; gap: .7rem; align-items: flex-start; margin: .35rem 0; font-weight: 500 !important; font-size: .95rem !important; cursor: pointer; }
.check input { flex: none; width: 1.25rem; height: 1.25rem; margin: .12rem 0 0; accent-color: var(--accent); }
.field .check span { color: var(--ink); }
.field .check span a, .help a { color: var(--accent-deep); text-underline-offset: 2px; }

.err { min-height: 0; margin: .3rem 0 0; font-size: .85rem; color: var(--error); }
.err:empty { display: none; }
.form-err { margin: 0 0 1rem; font-size: .95rem; }

/* Note before the button */
.note {
  margin: .5rem 0 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--blush);
  border-left: 3px solid var(--accent);
  font-size: .9rem;
  line-height: 1.55;
}
.note h3 { margin: 0 0 .35rem; font-size: 1rem; letter-spacing: -0.01em; }
.note p { margin: 0 0 .55rem; color: #4a3f4f; }
.note p:last-child, .note ul:last-child, .note ol:last-child { margin-bottom: 0; }
.note ul, .note ol { margin: 0 0 .55rem; padding-left: 1.2rem; color: #4a3f4f; }
.note a { color: var(--accent-deep); }

/* Buttons */
.btn {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: .8rem 1rem;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, transform .08s;
}
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.small { width: auto; min-height: 2.75rem; padding: .6rem 1.6rem; }
.link {
  padding: .6rem .2rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-deep);
  background: none;
  border: 0;
  cursor: pointer;
}
.link[disabled] { color: var(--muted); cursor: default; font-weight: 500; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* Verification modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(42, 32, 48, .55);
}
.modal-card {
  width: 100%;
  max-width: 30rem;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.6rem 1.4rem calc(1.4rem + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 20px 20px 0 0;
  animation: sheet .2s ease-out;
}
.modal-card h2 { margin: 0 0 .3rem; font-size: 1.3rem; letter-spacing: -0.015em; }
.code-row { margin: 1.2rem 0 0; }
.code-row label { display: block; font-size: .9rem; font-weight: 600; }
input.code {
  margin-top: .3rem;
  padding: .5rem 0 .4rem .5em;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: .5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 1.4rem; }
.resend { display: block; margin: .4rem auto 0; font-size: .9rem; }
.dev { padding: .5rem .7rem; background: #fff7d6; border-radius: 8px; color: #6a5300; }

@media (min-width: 34rem) {
  .page { padding-top: 56px; }
  .modal { align-items: center; }
  .modal-card { border-radius: 18px; }
}
@keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
