:root {
  --ink: #0F182D;
  --ink-2: #1A2542;
  --violet: #7622FF;
  --violet-dark: #5A12D6;
  --cyan: #87E8FF;
  --sand: #EEF8FD;
  --line: #E3E8F0;
  --field: #C9D1E2;
  --slate: #56607A;
  --mist: #B9C2D6;
  --soft: #D8DEEA;
  --white: #FFFFFF;
  --display: 'Outfit', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#app {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--sand);
}
a { color: var(--violet-dark); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Screen frames ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.screen.dark {
  background-color: var(--ink);
  background-image: radial-gradient(520px 360px at 95% -5%, rgba(118,34,255,0.55), transparent 60%), radial-gradient(420px 300px at -10% 105%, rgba(135,232,255,0.2), transparent 60%);
  color: var(--white);
  padding: calc(24px + var(--safe-top)) 24px calc(28px + var(--safe-bottom));
}
.screen.dark a { color: var(--cyan); }
.topbar {
  background: var(--ink);
  color: var(--white);
  padding: calc(18px + var(--safe-top)) 24px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.topbar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar .meta { font-size: 13px; font-weight: 600; color: var(--mist); }
.topbar.back { flex-direction: row; align-items: center; gap: 6px; padding-left: 12px; }
.topbar.back h1 { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--white); }
.iconbtn { width: 44px; height: 44px; border: none; background: transparent; color: var(--white); display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.logo { font-family: var(--display); font-size: 17px; font-weight: 700; letter-spacing: -0.5px; color: var(--white); }
.logo span { color: var(--cyan); }
.logo-sub { font-size: 12px; color: var(--mist); }
.bar { height: 6px; border-radius: 3px; background: var(--ink-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--cyan); }
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.steps i { height: 6px; border-radius: 3px; background: var(--ink-2); }
.steps i.done { background: var(--violet); }
.steps i.now { background: var(--cyan); }

.body { flex: 1; display: flex; flex-direction: column; padding: 20px 24px 24px; gap: 0; }
.body.tight { padding-top: 16px; }
.grow { flex: 1; min-height: 16px; }

/* ---------- Type ---------- */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--violet-dark); margin: 0 0 6px; }
.dark .eyebrow, .card.dark-card .eyebrow { color: var(--cyan); }
h1.title { margin: 0 0 8px; font-family: var(--display); font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.8px; }
.dark h1.title { font-size: 34px; }
p.lead { margin: 0; font-size: 15px; line-height: 1.55; color: var(--slate); }
.dark p.lead { font-size: 17px; color: var(--soft); }
.small { font-size: 13px; line-height: 1.45; color: var(--slate); }
.dark .small { color: var(--mist); }
.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.section-h { font-size: 15px; font-weight: 700; margin: 16px 0 8px; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 54px; padding: 0 20px; border-radius: 999px; border: none;
  background: var(--violet); color: var(--white); font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; }
.btn.sec { background: transparent; border: 1px solid var(--ink); color: var(--ink); font-size: 15px; min-height: 50px; }
.dark .btn.sec { border-color: rgba(255,255,255,0.4); color: var(--white); }
.btn.dark-btn { background: var(--ink); }
.btn.small-btn { min-height: 46px; font-size: 14px; }
.btn.cyan { background: var(--cyan); color: var(--ink); font-weight: 700; min-height: 44px; font-size: 15px; }
a.btn { color: var(--white); }
a.btn.sec { color: var(--ink); }
.linkbtn { border: none; background: transparent; color: var(--violet-dark); font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 6px; }
.dark .linkbtn { color: var(--cyan); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; margin-top: 14px; }
.input, .textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--field); border-radius: 12px; padding: 0 14px;
  font-size: 16px; background: var(--white); color: var(--ink);
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.dark .input { border-color: rgba(255,255,255,0.2); }
.hint { font-size: 13px; line-height: 1.45; color: var(--slate); margin-top: 6px; }
.error { font-size: 14px; color: #B3261E; font-weight: 600; margin-top: 8px; }
.dark .error { color: #FFB4AB; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; }
.card.dark-card { background: var(--ink); border: none; color: var(--soft); }
.card.dark-card b, .card.dark-card strong { color: var(--white); }
.list { background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; text-decoration: none; color: var(--ink); background: var(--white); width: 100%; border: none; text-align: left; }
.item .name { font-size: 15px; font-weight: 600; }
.item .sub { font-size: 13px; color: var(--slate); }
.chev { flex: none; color: var(--violet-dark); }
.tag { flex: none; min-height: 26px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; white-space: nowrap; }
.tag.coffee { background: var(--violet); color: var(--white); }
.tag.surgery { background: #E6DCFF; color: #3D0D99; }
.tag.waiting { background: var(--ink); color: var(--cyan); }
.tag.todo { border: 1px solid var(--field); color: var(--slate); }
.tag.no { background: #EEF0F4; color: var(--slate); }
.tag.follow { background: var(--ink); color: var(--cyan); }
.howlist { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.howlist li { display: flex; gap: 14px; align-items: baseline; font-size: 16px; color: var(--soft); }
.howlist li b { flex: none; width: 22px; font-family: var(--display); font-size: 17px; color: var(--cyan); }
.numbered { display: flex; gap: 12px; align-items: flex-start; }
.numbered > b { flex: none; font-family: var(--display); font-size: 16px; color: var(--violet-dark); min-width: 20px; }
.dark-card .numbered > b { color: var(--cyan); }

/* ---------- Segmented tabs ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.seg button, .seg a { min-height: 40px; border: none; border-radius: 999px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; text-decoration: none; padding: 0 6px; }
.seg .on { background: var(--ink); color: var(--white); }
.pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pills button { min-height: 40px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.25); background: transparent; color: var(--soft); font-size: 13px; font-weight: 600; padding: 2px 6px; line-height: 1.2; }
.pills button.on { background: var(--cyan); border-color: var(--cyan); color: var(--ink); font-weight: 700; }
.outcomes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.outcomes button { min-height: 46px; border-radius: 999px; border: 1px solid var(--field); background: var(--white); color: var(--ink); font-size: 14px; font-weight: 600; padding: 2px 8px; }
.outcomes button.good { background: var(--violet); border-color: var(--violet); color: var(--white); }

/* ---------- Radio options (CV matches) ---------- */
.option { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 14px 16px; cursor: pointer; }
.option.on { border: 2px solid var(--violet); padding: 13px 15px; }
.option input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--violet); flex: none; }
.option .o-title { font-size: 16px; font-weight: 700; }
.option .o-line { font-size: 14px; line-height: 1.45; color: var(--slate); margin-top: 4px; }
.option .o-line b { color: var(--ink); }

/* ---------- Dropzone ---------- */
.drop { border: 2px dashed #A9B4CC; border-radius: 20px; background: var(--white); padding: 24px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.drop.has { border-style: solid; border-color: var(--violet); }
.or { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; color: var(--slate); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: #D6DDEA; }

/* ---------- Home ---------- */
.hero { background-color: var(--ink); background-image: radial-gradient(420px 260px at 100% -20%, rgba(118,34,255,0.55), transparent 60%); color: var(--white); padding: calc(20px + var(--safe-top)) 24px 20px; display: flex; flex-direction: column; gap: 10px; }
.bignum { display: flex; align-items: baseline; gap: 10px; }
.bignum b { font-family: var(--display); font-size: 54px; line-height: 1; font-weight: 700; letter-spacing: -2px; }
.bignum span { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--mist); }
.hero .bar { height: 10px; border-radius: 5px; }
.callout { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--violet); border-radius: 16px; padding: 12px 16px; color: var(--white); text-decoration: none; }
a.callout { color: var(--white); }
.callout .sub { color: #E6DCFF; font-size: 13px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--display); font-size: 24px; font-weight: 700; }
.stat span { font-size: 12px; line-height: 1.3; color: var(--slate); }

/* ---------- Bottom menu ---------- */
.nav { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); border-top: 1px solid var(--line); padding: 6px 8px calc(10px + var(--safe-bottom)); z-index: 5; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 12px; font-weight: 600; color: var(--slate); text-decoration: none; min-height: 48px; }
.nav a.on { color: var(--violet-dark); font-weight: 700; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; top: calc(16px + var(--safe-top)); transform: translate(-50%, -140%); width: min(92vw, 460px); background: var(--ink); color: var(--white); border-radius: 16px; padding: 14px 16px; font-size: 15px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(15,24,45,0.5); transition: transform 0.3s ease; z-index: 50; display: flex; gap: 10px; align-items: center; }
#toast.show { transform: translate(-50%, 0); }
#toast .dot { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--ink-2); color: var(--cyan); font-family: var(--display); font-weight: 700; display: flex; align-items: center; justify-content: center; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--violet); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } #toast { transition: none; } }

/* Ranked ways to find people */
.rank { display: flex; flex-direction: column; gap: 6px; }
.rank.best { border: 2px solid var(--violet); }
.rank-top { display: flex; align-items: center; gap: 8px; }
.rank-top b { width: 26px; height: 26px; border-radius: 999px; background: var(--sand); color: var(--violet-dark); display: grid; place-items: center; font-family: var(--display); font-size: 14px; }
.rank.best .rank-top b { background: var(--violet); color: #fff; }
.rank-top span { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--slate); }
.rank.best .rank-top span { color: var(--violet-dark); }
.rank-title { font-family: var(--display); font-size: 19px; font-weight: 700; line-height: 1.2; margin-bottom: 4px; }
.rank .row .btn { min-height: 48px; font-size: 15px; }
.rank .field { margin-top: 0; }
ol.mini { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.5; color: var(--ink); }
ol.mini li { margin-bottom: 4px; }
.divider { height: 1px; background: var(--line); margin: 14px 0 12px; }
.item.tick { justify-content: flex-start; gap: 14px; cursor: pointer; }
.item.tick input { width: 22px; height: 22px; accent-color: var(--violet); flex: none; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.sticky-bottom { position: sticky; bottom: 0; background: var(--sand); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
