/* =========================================================
   MINDD2 — App screens: shared base for Get Started, Board and the account pages (mobile-first)
   ========================================================= */

:root {
  --indigo: #151B5B;
  --purple: #5B2EFF;
  --violet: #4B45D8;
  --lime: #B8F000;
  --white: #FFFFFF;
  --muted: #626B91;

  --tint: #F6F5FF;
  --line: #E1E0F0;
  --error: #C2263B;
  --gradient: linear-gradient(135deg, #5B2EFF 0%, #4B45D8 100%);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --gutter: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  color: var(--indigo);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p, ul, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
  border-radius: 8px;
}
[tabindex="-1"]:focus { outline: none; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.app-bar {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
}
.app-logo { display: inline-flex; align-items: center; min-height: 44px; border-radius: 8px; }
.app-logo img { height: 24px; width: auto; mix-blend-mode: multiply; }

.app-main {
  flex: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 16px var(--gutter) calc(32px + env(safe-area-inset-bottom));
}
.app-main--wide { max-width: 520px; }

/* ---------- Step headings ---------- */
.step-title {
  font-size: clamp(1.375rem, 6vw, 1.75rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.step-lead {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-wrap: pretty;
}
.eyebrow {
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .14em;
  color: var(--purple);
}

/* ---------- Form ---------- */
.form { margin-top: 32px; display: flex; flex-direction: column; gap: 24px; }
.field { display: flex; flex-direction: column; gap: 8px; }

.label {
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .1em;
  color: var(--indigo);
  margin-bottom: 0;
}
legend.label { margin-bottom: 12px; }

input[type="tel"], input[type="email"], input[type="text"] {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  font: inherit;
  font-size: 1.0625rem; /* ≥16px avoids iOS zoom */
  color: var(--indigo);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input::placeholder { color: #8C93B3; opacity: 1; }
input[type="tel"]:focus, input[type="email"]:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(91, 46, 255, .14);
}
.has-error input, input[aria-invalid="true"] { border-color: var(--error); }

/* Phone: country code + number in one control */
.phone-input {
  display: flex;
  min-height: 56px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.phone-input:focus-within { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(91, 46, 255, .14); }
.has-error .phone-input { border-color: var(--error); }
.phone-input input { border: 0; min-height: 53px; border-radius: 0 16px 16px 0; padding-left: 14px; }
.phone-input input:focus { box-shadow: none; }

.cc { position: relative; flex: none; display: flex; }
.cc select {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}
.cc-display {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 18px;
  font-size: 1.0625rem;
  font-weight: 500;
  border-right: 1.5px solid var(--line);
  margin: 12px 0;
  pointer-events: none;
}
.cc-display svg { color: var(--muted); }
.cc select:focus-visible + .cc-display { outline: 3px solid var(--purple); outline-offset: 2px; border-radius: 6px; }

/* Errors: icon + text, never color alone */
.error {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: .9375rem;
  font-weight: 500;
  color: var(--error);
}
.error::before {
  content: "!";
  flex: none;
  display: grid; place-items: center;
  width: 18px; height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--error);
  color: var(--white);
  font-size: .75rem;
  font-weight: 500;
}
.form-error { justify-content: center; text-align: left; }

.status { font-size: .9375rem; color: var(--muted); min-height: 0; }
.status:empty { display: none; }

.privacy-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: .875rem;
  line-height: 1.5;
  color: var(--muted);
}
.privacy-note svg {
  flex: none;
  width: 16px; height: 16px;
  margin-top: 2px;
  fill: none; stroke: var(--violet); stroke-width: 1.5;
}

/* ---------- Buttons ---------- */
.actions { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: 56px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  font: inherit;
  font-size: .9375rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .2s var(--ease);
}
.btn-primary {
  background: var(--gradient);
  color: var(--white);
  box-shadow: 0 10px 24px -12px rgba(91, 46, 255, .6);
}
.btn-primary:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.is-loading { opacity: .7; cursor: progress; }
.btn-block { width: 100%; }

.hint { font-size: .875rem; color: var(--muted); text-align: center; }

.secondary-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.link-btn {
  min-height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  font: inherit;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--purple);
  cursor: pointer;
}
.link-btn:disabled { color: var(--muted); cursor: default; }

/* ---------- OTP ---------- */
.otp { position: relative; }
.otp input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  font-size: 16px;
  z-index: 1;
  cursor: text;
}
.otp-cells { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-cells span {
  display: grid;
  place-items: center;
  height: 60px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.otp-cells span.is-filled { border-color: #BDB7F4; }
.otp-cells span.is-active { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(91, 46, 255, .14); }
.has-error .otp-cells span { border-color: var(--error); }

/* ---------- Profile: avatars + gender ---------- */
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.avatar-option { position: relative; display: grid; place-items: center; cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.avatar-option img {
  width: 100%;
  max-width: 68px;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--white), 0 0 0 3.5px transparent;
  transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
.avatar-option input:checked + img { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--purple); }
.avatar-option input:focus-visible + img { outline: 3px solid var(--purple); outline-offset: 7px; }
.avatar-option input:checked ~ .sr-only::after { content: " (selected)"; }
/* checkmark so selection is not shown by color alone */
.avatar-option:has(input:checked)::after {
  content: "";
  position: absolute;
  right: calc(50% - 34px); bottom: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--purple) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5 7 11l5-6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
  border: 2px solid var(--white);
}

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 500;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.chip input:checked + span { border-color: var(--purple); background: var(--tint); color: var(--purple); }
.chip input:checked + span::before {
  content: "";
  width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5 6.5 12 13 4.5' fill='none' stroke='%235B2EFF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip input:focus-visible + span { outline: 3px solid var(--purple); outline-offset: 3px; }

/* ---------- The Q ---------- */
.status-block { color: var(--muted); padding: 40px 0; text-align: center; }

.q-text {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.5rem, 7vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}
#view-q .form { margin-top: 0; }
.q-fieldset legend { margin-bottom: 24px; }
.q-options { display: flex; flex-direction: column; gap: 12px; }
.q-option { position: relative; cursor: pointer; }
.q-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.q-option span {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 14px 18px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  font-size: 1.0625rem;
  font-weight: 500;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.q-option span::before {
  content: "";
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid #B4B8D1;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.q-option input:checked + span { border-color: var(--purple); background: var(--tint); }
.q-option input:checked + span::before { border: 7px solid var(--purple); }
.q-option input:focus-visible + span { outline: 3px solid var(--purple); outline-offset: 3px; }
.q-option input:disabled + span { cursor: default; }

/* ---------- Board ---------- */
.locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--indigo);
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .12em;
}
.locked-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.choice-card {
  margin-top: 24px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--indigo);
  color: var(--white);
}
.choice-label { font-size: .75rem; font-weight: 500; letter-spacing: .14em; color: var(--lime); }
.choice-value { margin-top: 4px; font-size: 1.25rem; font-weight: 500; }

.stats { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { padding: 16px; border: 1.5px solid var(--line); border-radius: 18px; }
.stat dt { font-size: .8125rem; color: var(--muted); line-height: 1.35; }
.stat dd { margin-top: 6px; font-size: 1.0625rem; font-weight: 500; line-height: 1.3; }

.sub-title {
  margin-top: 32px;
  margin-bottom: 14px;
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--muted);
}

.dist { display: flex; flex-direction: column; gap: 14px; }
.dist-head { display: flex; justify-content: space-between; gap: 12px; font-size: .9375rem; }
.dist-row.is-mine .dist-head { font-weight: 500; }
.dist-pct { font-variant-numeric: tabular-nums; color: var(--muted); }
.dist-bar { margin-top: 6px; height: 8px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.dist-bar span { display: block; height: 100%; border-radius: inherit; background: #C9C5F2; }
.dist-row.is-mine .dist-bar span { background: var(--gradient); }

.people-list { display: flex; flex-direction: column; }
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person img { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.person-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-name.is-unnamed { color: var(--muted); font-weight: 400; }
.person-tag {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--purple);
  font-size: .75rem;
  font-weight: 500;
}
#view-board .hint { text-align: left; }
#view-board .actions { margin-top: 32px; }

/* ---------- Desktop: same hierarchy, centered premium panel ---------- */
@media (min-width: 768px) {
  body.app { background: var(--tint); }
  .app-bar { height: 80px; padding: 0 40px; }
  .app-logo img { height: 28px; }
  .app-main {
    flex: 0 0 auto;
    margin: 24px auto 64px;
    padding: 48px 48px 44px;
    background: var(--white);
    border-radius: 28px;
    box-shadow: 0 24px 64px -28px rgba(21, 27, 91, .22);
    max-width: 520px;
  }
  .app-main--wide { max-width: 600px; }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -10px rgba(91, 46, 255, .7); }
  .btn:disabled:hover { transform: none; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
