/* mustmatch: хар цагаан суурь дээр ганц тод ягаан, бага зэрэг шар.
   Дугуй булан, гар бичмэл тэмдэглэл, наалт шиг жижиг деталиуд.
   Хамгийн тод хэсэг нь хамгийн их таарсан хүний ягаан блок. */
:root {
  --bg: #FFFFFF;
  --fg: #111111;
  --muted: #6B6B6B;
  --line: #E7E7E7;
  --field: #F4F4F4;
  --accent: #FF3E7F;
  --accent-ink: #111111;      /* ягаан дээрх бичээс */
  --accent-soft: #FFE6EE;
  --pop: #FFD84A;
  --pop-ink: #111111;
  --f-display: "Geologica", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-hand: "Caveat", "Segoe Script", cursive;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0B0B;
    --fg: #F5F5F5;
    --muted: #A0A0A0;
    --line: #2B2B2B;
    --field: #191919;
    --accent: #FF5C93;
    --accent-soft: #33131F;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-right, 0px)) 64px max(20px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 48px;
}
h1, h2, h3, p, ol, ul { margin: 0; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 6.4vw, 3.4rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; }
h1 em { font-style: normal; color: var(--accent); text-decoration: underline wavy; text-decoration-thickness: .06em; text-underline-offset: .14em; }
h2 { font-size: clamp(1.3rem, 4.2vw, 1.8rem); line-height: 1.2; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
h1:focus, h2:focus { outline: none; }
a { color: inherit; text-underline-offset: 3px; }
.hand, .tag-example { font-family: var(--f-hand); font-size: 1.35rem; line-height: 1.1; color: var(--accent); }
.tag-example { display: inline-block; transform: rotate(-4deg); }
.muted { color: var(--muted); }
.status { text-align: center; padding: 96px 0; color: var(--muted); }

/* top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; line-height: 1; }
.brand svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.steps { list-style: none; padding: 0; display: flex; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.steps li { padding: 6px 13px; border-radius: 999px; white-space: nowrap; }
.steps li[aria-current="step"] { background: var(--fg); color: var(--bg); }

/* shared pieces */
.card { border: 1px solid var(--line); border-radius: 22px; padding: 24px; min-width: 0; }
.btn {
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; text-decoration: none; text-align: center;
  display: inline-block; padding: 15px 26px; border-radius: 999px;
  border: 1.5px solid var(--fg); background: var(--fg); color: var(--bg);
  transition: background-color .16s, color .16s, border-color .16s, transform .16s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover { background: transparent; color: var(--fg); border-color: var(--fg); }
.btn-small { padding: 9px 16px; font-size: .85rem; }
.btn-danger { background: transparent; color: var(--muted); border-color: transparent; text-decoration: underline; text-underline-offset: 4px; padding-left: 6px; padding-right: 6px; }
.btn-danger:hover { background: transparent; border-color: transparent; color: var(--fg); transform: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.chips li { font-size: .85rem; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; }
.chips b { font-weight: 700; }
.pct { font-family: var(--f-display); font-weight: 800; font-variant-numeric: lining-nums tabular-nums; line-height: .95; letter-spacing: -0.05em; color: var(--accent); }
.badge { font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--pop); color: var(--pop-ink); white-space: nowrap; }
.note { font-size: .88rem; border: 1.5px dashed var(--line); border-radius: 16px; padding: 12px 16px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; color: var(--muted); }
.err { font-size: .82rem; font-weight: 700; color: var(--accent); }
.fineprint { font-size: .82rem; color: var(--muted); }
.who { font-weight: 700; overflow-wrap: anywhere; }
.meta { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.section { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 48px; }

/* landing */
.landing { display: grid; gap: 36px; align-items: start; }
.hero { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.hero .lead { font-size: 1.05rem; max-width: 32em; color: var(--muted); }
.how { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: .95rem; }
.how li { display: flex; gap: 12px; align-items: center; }
.how .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--fg); font-weight: 700; font-size: .82rem; }
.joined { font-weight: 700; }
.sample { display: flex; flex-direction: column; gap: 12px; max-width: 420px; transform: rotate(-1.5deg); }
.sample-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sample .pct { font-size: 2.8rem; }

form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: .88rem; font-weight: 700; }
/* хүйс: хоёр сонголттой товч */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-btn { font: inherit; font-weight: 600; cursor: pointer; padding: 12px 10px; border: 1.5px solid transparent; border-radius: 14px; background: var(--field); color: var(--fg); transition: background-color .15s, border-color .15s; }
.seg-btn:hover { border-color: var(--fg); }
.seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.field input, .share-row input {
  font: inherit; font-size: 16px; width: 100%; min-width: 0;
  padding: 12px 14px; border: 1.5px solid transparent; border-radius: 14px;
  background: var(--field); color: var(--fg);
}
.field input::placeholder { color: var(--muted); opacity: .6; }
.field input:focus-visible, .share-row input:focus-visible { outline: none; border-color: var(--fg); }
.field input[aria-invalid="true"] { border-color: var(--accent); }
.with-prefix { display: flex; align-items: stretch; }
.with-prefix span { flex: none; display: grid; place-items: center; padding: 0 2px 0 14px; border-radius: 14px 0 0 14px; background: var(--field); color: var(--muted); }
.with-prefix input { border-radius: 0 14px 14px 0; padding-left: 4px; border-left: 0; }
.row2 { display: grid; grid-template-columns: 1fr 92px; gap: 12px; }

@media (min-width: 860px) {
  .landing { grid-template-columns: 1.15fr 1fr; grid-template-areas: "hero form" "sample form"; column-gap: 64px; }
  .hero { grid-area: hero; padding-top: 8px; }
  .formcard { grid-area: form; padding: 32px; }
  .sample { grid-area: sample; }
}

/* quiz */
.quiz { max-width: 640px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.qcount { font-size: .82rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--accent-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cells { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.cells span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.cells span.done { background: var(--fg); }
.cells span.now { background: var(--accent); transform: scale(1.5); }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  font: inherit; text-align: left; cursor: pointer; width: 100%;
  display: flex; gap: 14px; align-items: center;
  padding: 15px 18px; border: 1.5px solid var(--line); border-radius: 16px;
  background: transparent; color: var(--fg);
  transition: background-color .15s, border-color .15s, transform .15s;
}
.opt:hover { border-color: var(--fg); transform: translateY(-1px); }
.opt:active { transform: scale(.98); }
.opt-letter { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--field); font-size: .8rem; font-weight: 700; }
.opt-text { min-width: 0; }
.opt-sub { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.opt[aria-pressed="true"] .opt-letter { background: var(--accent-ink); color: var(--accent); }
.opt[aria-pressed="true"] .opt-sub { color: inherit; opacity: .7; }
/* орд, MBTI: олон сонголттой тул тор хэлбэрээр */
.opts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.opt-compact { flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; text-align: center; }
.qnav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* waiting room */
.wait { display: flex; flex-direction: column; gap: 18px; border: 1.5px solid var(--fg); padding: 28px 24px; }
.wait-count { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.wait-count .pct { font-size: clamp(4rem, 18vw, 7rem); }
.wait-count .of { color: var(--muted); font-weight: 600; }
.wait .cells span { width: 12px; height: 12px; }
.wait .cells span.done { background: var(--accent); }
.share { display: flex; flex-direction: column; gap: 14px; background: var(--accent-soft); border-color: transparent; }
.share-row { display: flex; gap: 10px; align-items: center; }
.share-row input { background: var(--bg); }
.share-row .btn { flex: none; }

/* results: хамгийн их таарсан хүн ягаан блокт */
.top-match { position: relative; display: grid; gap: 24px; border: 0; border-radius: 28px; padding: 32px 24px; background: var(--accent); color: var(--accent-ink); }
.top-match::before {
  content: "№1"; position: absolute; top: -20px; right: 22px;
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pop); color: var(--pop-ink);
  font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; letter-spacing: -0.03em;
  transform: rotate(12deg);
}
.top-match .pct { font-size: clamp(4.5rem, 20vw, 8rem); color: inherit; }
.top-match .muted, .top-match .meta { color: inherit; opacity: .72; }
.top-match .tag-example { color: inherit; }
.top-match .chips li { border-color: rgba(17, 17, 17, .28); }
.top-match .badge { background: var(--accent-ink); color: #FFFFFF; }
.top-match .btn { background: var(--accent-ink); color: #FFFFFF; border-color: var(--accent-ink); }
.top-match .btn:hover { background: #FFFFFF; color: var(--accent-ink); border-color: #FFFFFF; }
.top-match :focus-visible { outline-color: var(--accent-ink); }
.top-score { display: flex; flex-direction: column; gap: 8px; font-weight: 600; }
.top-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; align-items: flex-start; }
.name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.top-body .who { font-family: var(--f-display); font-weight: 700; font-size: 1.45rem; letter-spacing: -0.02em; line-height: 1.2; }
@media (min-width: 700px) {
  .top-match { grid-template-columns: auto 1fr; column-gap: 48px; align-items: start; padding: 44px; }
}
.others { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.other { display: flex; flex-direction: column; gap: 12px; padding: 20px; align-items: flex-start; }
.other-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
.other-head > div { min-width: 0; }
.other .pct { font-size: 2.2rem; }
details summary { cursor: pointer; font-size: .88rem; font-weight: 700; }
details .chips { margin-top: 10px; }
.me { display: flex; flex-direction: column; gap: 18px; }
.me dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; font-size: .95rem; }
.me dt { color: var(--muted); }
.me dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

footer { font-size: .8rem; color: var(--muted); }

@media (max-width: 480px) {
  .steps li { padding: 5px 9px; }
  .share-row { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Зөвхөн байрлалыг хөдөлгөнө: анимэйшн зогссон ч агуулга үргэлж харагдана. */
  .view { animation: rise .35s ease-out; }
  @keyframes rise { from { transform: translateY(8px); } to { transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .opt { transition: none; }
  .btn:hover, .opt:hover { transform: none; }
}

/* цаг тоологч ба бүртгүүлсэн хүний тоо */
.eyebrow { font-size: .88rem; font-weight: 700; }
.live { display: flex; flex-direction: column; gap: 14px; }
.countdown { display: flex; gap: 8px; flex-wrap: wrap; }
.cd-unit { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 68px; padding: 12px 8px 10px; border-radius: 16px; background: var(--field); }
.cd-num { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.7rem, 7vw, 2.5rem); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.cd-label { font-size: .74rem; font-weight: 600; color: var(--muted); }
.cd-unit:last-child .cd-num { color: var(--accent); }
.stats { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.stat-total { display: flex; align-items: baseline; gap: 10px; }
.stat-total .pct { font-size: clamp(2.4rem, 9vw, 3.4rem); }
.stat-total .of { font-weight: 600; color: var(--muted); }
.stat-split { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: .88rem; padding: 6px 13px; border-radius: 999px; background: var(--field); white-space: nowrap; }
.pill b { font-weight: 800; }
.pill-f { background: var(--accent-soft); }
