:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #1a1f36;      /* headings */
  --text: #3c4257;     /* body */
  --muted: #697386;    /* secondary */
  --faint: #a3acb9;    /* placeholders */
  --fill: #f4f5f8;     /* field + chip fill */
  --fill-hover: #eceef3;
  --border: #e3e8ee;
  --border-strong: #c9d1dc;
  --brand: #635bff;
  --brand-dark: #5146e5;
  --brand-tint: #f0efff;
  --err: #df1b41;
  --ring: 0 0 0 3px rgba(99, 91, 255, 0.22);
  --shadow: 0 1px 1px rgba(10, 37, 64, 0.04), 0 2px 6px rgba(10, 37, 64, 0.05);
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ring: 0 0 0 4px rgba(99, 91, 255, 0.14);
}
* { box-sizing: border-box; }
/* !important beats the inline text-size-adjust some in-app browsers inject after load */
html, body { -webkit-text-size-adjust: 100% !important; text-size-adjust: 100% !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.bar { position: fixed; inset: 0 0 auto; height: 3px; z-index: 20; }
.bar-fill { height: 100%; background: var(--brand); transform: scaleX(0); transform-origin: 0 50%; }

.page {
  width: min(600px, 100%);
  margin: 0 auto;
  padding: calc(48px + env(safe-area-inset-top)) 16px calc(56px + env(safe-area-inset-bottom));
}

/* Reveal (below the fold only; on-screen content is shown instantly) */
.r { opacity: 0; transition: opacity 0.5s ease; }
.r.shown { opacity: 1; }
.r.instant { transition: none; }

/* Hero */
.hero {
  margin: calc(-48px - env(safe-area-inset-top)) -16px 28px;
  padding: calc(52px + env(safe-area-inset-top)) 22px 30px;
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(168, 85, 247, 0.16), transparent 70%),
    radial-gradient(80% 60% at 0% 0%, rgba(99, 91, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #f6f5ff 0%, #ffffff 100%);
  border-bottom: 1px solid #eef0f4;
}
.hero-title {
  font-size: 30px; font-weight: 700; line-height: 1.12; letter-spacing: -0.03em;
  color: var(--ink);
}
.hero-amount {
  display: block;
  font-size: clamp(48px, 14.5vw, 68px); line-height: 1.04; letter-spacing: -0.045em;
  padding: 2px 0 6px;
  background: linear-gradient(95deg, #635bff 0%, #7c5cff 45%, #a855f7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lead { margin-top: 14px; max-width: 34ch; font-size: 17px; line-height: 1.5; color: var(--muted); }
.refer-card {
  margin-top: 22px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(10, 37, 64, 0.05), 0 8px 24px -12px rgba(99, 91, 255, 0.35);
}
.refer-ico { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-tint); color: var(--brand); }
.refer-text { flex: 1; font-size: 15px; line-height: 1.4; color: var(--text); }
.refer-card strong { color: var(--ink); font-weight: 650; white-space: nowrap; }
.lead { margin-top: 12px; font-size: 17px; line-height: 1.55; color: var(--muted); }

.how-btn {
  margin-top: 18px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 600; color: var(--brand);
  background: none; border: 0; padding: 4px 0; cursor: pointer;
}
.how-btn svg { transition: transform 0.2s var(--ease); }
.how-btn:hover svg { transform: translateX(3px); }

/* How-it-works sheet — fixed to the bottom, transform-only animation */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 37, 64, 0.45);
  opacity: 0;
  transition: opacity 0.3s ease;
  touch-action: none;
}
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: 100%; max-width: 560px; margin: 0 auto;
  max-height: 85vh; max-height: 85svh;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(10, 37, 64, 0.18);
  transform: translate3d(0, 100%, 0);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: translate3d(0, 0, 0); }
.sheet-head {
  position: relative;
  padding: 22px 20px 14px;
  border-bottom: 1px solid var(--border);
}
.grab { position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--border-strong); }
.sheet-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.sheet-x {
  position: absolute; right: 12px; top: 14px;
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: #f1f4f8; color: var(--muted); cursor: pointer;
}
.sheet-x svg { width: 14px; height: 14px; }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 20px 20px 8px;
}
.sheet-lead { font-size: 16px; color: var(--muted); }
.steps { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 20px; }
.steps li { display: flex; gap: 14px; }
.steps li > span {
  flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  font-size: 14px; font-weight: 600; color: var(--brand); background: var(--brand-tint); border-radius: 50%;
}
.steps strong { display: block; font-size: 16px; font-weight: 600; color: var(--ink); margin: 2px 0 4px; }
.steps p { font-size: 15px; color: var(--muted); }
.refer-box { margin-top: 28px; padding: 16px; border-radius: 12px; background: var(--brand-tint); }
.refer-box strong { display: block; font-size: 16px; color: var(--ink); margin-bottom: 4px; }
.refer-box p { font-size: 15px; color: var(--text); }
.sheet-more { display: inline-flex; align-items: center; gap: 6px; margin: 20px 0 12px; font-size: 16px; font-weight: 600; color: var(--brand); text-decoration: none; }
.sheet-foot { padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.sheet-foot .btn { min-height: 50px; }
/* Form */
.form-title { font-size: 26px; margin-top: 8px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; color: var(--ink); padding: 0 4px; margin-bottom: 8px; }

.card { padding: 24px 4px 8px; border-top: 1px solid #eef0f4; }
.form-title + .card { border-top: 0; padding-top: 16px; }
.card-head { margin-bottom: 16px; }
.card-head h3 { font-size: 21px; font-weight: 650; color: var(--ink); letter-spacing: -0.02em; }
.card-head p { margin-top: 4px; font-size: 15px; color: var(--muted); }

.item + .item { margin-top: 14px; }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 550; color: var(--ink); margin-bottom: 6px; }
.opt { font-size: 14px; font-weight: 400; color: var(--faint); }
.hint { margin: -6px 0 12px; font-size: 14px; color: var(--muted); }

/* Fields — filled, borderless */
.input {
  display: block;
  width: 100%;
  font-size: 17px; /* >=16px prevents iOS zoom */
  line-height: 1.4;
  color: var(--ink);
  background: var(--fill);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 11px 14px;
  outline: none;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
}
textarea.input { resize: none; min-height: 84px; line-height: 1.45; }
.input::placeholder { color: var(--faint); }
@media (hover: hover) { .input:hover:not(:focus) { background: var(--fill-hover); } }
.input { transition: background 0.2s ease; }
.input:focus { background: #eeedff; border-color: transparent; box-shadow: none; }
.input:focus::placeholder { color: #a9a5e8; }
.input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--fill) inset; -webkit-text-fill-color: var(--ink); }
.input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 40px #eeedff inset; }
.stack { display: grid; gap: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Choices — soft filled pills, no outlines */
.pills, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill, .chip {
  display: inline-flex; align-items: center; gap: 0;
  min-height: 38px;
  font-size: 15px; font-weight: 500;
  color: var(--text);
  background: var(--fill);
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.12s, gap 0.2s var(--ease);
}
@media (hover: hover) { .pill:hover:not(.on), .chip:hover:not(.on) { background: var(--fill-hover); } }
.pill:active, .chip:active { transform: scale(0.96); }
.pill.on, .chip.on { color: #fff; background: var(--brand); font-weight: 550; }
.chip.on { gap: 7px; }
.tick {
  display: grid; place-items: center;
  width: 0; height: 14px; overflow: hidden;
  opacity: 0;
  transition: width 0.2s var(--ease), opacity 0.2s;
}
.tick svg { width: 13px; height: 13px; flex: none; }
.chip.on .tick { width: 14px; opacity: 1; }
.chip.own { gap: 6px; padding: 10px 8px 10px 16px; cursor: default; }
.chip.own button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; }
.chip.pop { animation: pop 0.25s var(--ease); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }

.group { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 600; color: var(--ink); margin: 18px 0 10px; }
.group span { font-size: 14px; font-weight: 400; color: var(--muted); }
.group:first-child { margin-top: 0; }
.others { display: grid; gap: 10px; }
.others:not(:empty) { margin-bottom: 10px; }
.other-row { position: relative; animation: fadein 0.2s ease both; }
.other-row .input.nudge { animation: nudge 0.6s ease; }
@keyframes nudge { 30% { background: #e4e1ff; } }
@keyframes fadein { from { opacity: 0; } }
.other-row .input { padding-right: 52px; }
.other-x {
  touch-action: manipulation;
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer;
}
.other-x:hover, .other-x:active { background: var(--fill-hover); color: var(--ink); }
.add-more {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 10px 18px 10px 14px;
  font-size: 15px; font-weight: 550; color: var(--brand);
  background: var(--brand-tint); border: 0; outline: 0; border-radius: 999px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  touch-action: manipulation;
  transition: background 0.18s;
}
.add-more svg { width: 16px; height: 16px; }
@media (hover: hover) { .add-more:hover { background: #e6e4ff; } }
.add-more:active { background: #e0ddff; }

/* Errors */
.err { margin-top: 8px; font-size: 14px; color: var(--err); }
.err:empty { display: none; }
.item.bad .input { background: #fff1f3; border-color: transparent; }
.item.bad .pill { background: #fff0f3; }

/* Submit */
.submit { padding: 22px 4px 0; border-top: 1px solid #eef0f4; margin-top: 16px; }
.btn {
  width: 100%; min-height: 56px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  color: #fff; background: var(--brand);
  border: 0; border-radius: 14px; cursor: pointer;
  box-shadow: 0 6px 18px -6px rgba(99, 91, 255, 0.55);
  transition: background 0.15s, transform 0.15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.7; }
.fine { margin-top: 12px; text-align: center; font-size: 14px; color: var(--muted); }
.submit .err { text-align: center; }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Done */
.done { text-align: center; padding: 48px 4px; animation: pop 0.4s var(--ease); }
.done .form-title { margin: 0; }
.done .lead { font-size: 16px; }
.done-mark { width: 52px; height: 52px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-tint); color: var(--brand); }
.done-mark svg { width: 24px; height: 24px; }

@media (min-width: 640px) {
  .page { padding-top: 72px; }
  .hero { margin: -40px 0 28px; border-radius: 20px; border: 0; padding: 44px 36px 34px; }
  .hero-title { font-size: 34px; }
  .card { padding-inline: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .r { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; }
}

/* Data list: app name + data volume rows */
.dhead, .drow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 36px; gap: 8px; align-items: center; }
.dhead { font-size: 14px; font-weight: 500; color: var(--muted); padding: 0 4px; margin-bottom: 8px; }
.drow { margin-bottom: 8px; animation: fadein 0.2s ease both; }
#drows:not(:empty) { margin-bottom: 12px; }
.drow .input { font-size: 16px; padding: 12px 13px; }
.drow.fixed [data-r="name"] { background: var(--brand-tint); color: #4b43d6; font-weight: 550; pointer-events: none; text-overflow: ellipsis; }
.drow .input.nudge { animation: nudge 0.6s ease; }
.row-x {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer;
  touch-action: manipulation;
}
.row-x:hover, .row-x:active { background: var(--fill); color: var(--ink); }
#q-list { margin-top: 20px; }
@keyframes fadein { from { opacity: 0; } }
@keyframes nudge { 30% { background: #e4e1ff; } }

/* Referral sits as a single field above the button */
.submit .item { margin-bottom: 18px; }
.dhead[hidden] { display: none; }

/* Inline row: title left, dropdown right */
.item.inline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.item.inline .label { margin: 0; flex: 1; }
.item.inline .err { flex-basis: 100%; }
.select-wrap { position: relative; flex: none; width: 52%; max-width: 240px; }
.select {
  width: 100%;
  font: inherit; font-size: 16px; font-weight: 500;
  color: var(--ink);
  background: var(--fill);
  border: 0; border-radius: 12px;
  padding: 11px 36px 11px 14px;
  -webkit-appearance: none; appearance: none;
  cursor: pointer; outline: none;
  transition: background 0.2s ease;
}
.select.empty { color: var(--faint); font-weight: 400; }
.select:focus { background: #eeedff; }
@media (hover: hover) { .select:hover:not(:focus) { background: var(--fill-hover); } }
.select-wrap svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.select option { color: var(--ink); }

.item.inline .select-wrap .input { text-align: left; }
.item.inline + .item.inline { margin-top: 10px; }
.pill, .chip { padding: 8px 14px; }
.chip { padding-left: 12px; }
.drow .input { padding: 11px 12px; }
.item.inline .pills { flex: none; flex-wrap: nowrap; }
.item.inline .pill { min-width: 60px; justify-content: center; }
.item.inline { flex-wrap: wrap; }

/* Checklist: real checkboxes, two columns */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.check {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 6px 0;
  font-size: 15px; font-weight: 450; line-height: 1.3; text-align: left;
  color: var(--text); background: none; border: 0; cursor: pointer;
  touch-action: manipulation;
}
.check .box {
  flex: none; width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: #fff; border: 1.5px solid #cfd5de; color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.check .box svg { width: 12px; height: 12px; }
.check.on { color: var(--ink); font-weight: 550; }
.check.on .box { background: var(--brand); border-color: var(--brand); color: #fff; }
.check:active .box { transform: scale(0.92); }
.item.bad .check .box { border-color: rgba(223, 27, 65, 0.55); }
.drow [data-r="volume"]::placeholder { font-size: 14px; }
.check .ico { flex: none; width: 17px; height: 17px; color: var(--muted); margin-right: -2px; transition: color 0.15s; }
.check.on .ico { color: var(--brand); }
#q-list .hint { margin: 0 0 12px; }

/* Referral card is a share button */
.refer-card { width: 100%; border: 0; text-align: left; font: inherit; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s ease; touch-action: manipulation; }
.refer-card:active { transform: scale(0.985); }
@media (hover: hover) { .refer-card:hover { box-shadow: 0 1px 2px rgba(10, 37, 64, 0.06), 0 10px 28px -12px rgba(99, 91, 255, 0.45); } }
.refer-share { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: var(--brand); background: none; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px;
  font-size: 15px; font-weight: 500; color: #fff; background: rgba(26, 31, 54, 0.92);
  transition: opacity 0.2s ease, transform 0.2s ease; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
/* Whole card is one tap target: children never capture the tap or start a text selection */
.refer-card { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.refer-card > * { pointer-events: none; }
.refer-card:active { transform: scale(0.98); background: #fbfaff; }

.check-note { color: var(--faint); white-space: nowrap; }
