/* "Чи чатад ямар хүн бэ?": the page is a chat. Questions arrive as incoming bubbles, answers are your replies. */
:root {
  --ground: #ededea;
  --white: #ffffff;
  --ink: #121212;
  --muted: #4a4a45;
  --bubble: #dcdcd6;
  --accent: #ff4b1f;
  --lime: #d4f25a;
  --step-small: 0.9375rem;
  --step-body: 1.0625rem;
  --step-lead: 1.25rem;
  --step-head: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  --step-title: clamp(1.75rem, 1rem + 3.4vw, 3.5rem);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 var(--step-body)/1.45 "Golos Text", system-ui, sans-serif; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header bar like a chat app: logo as the contact's avatar, name and status */
.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; background: var(--white); padding: 12px 16px; }
.bar > * { max-width: 520px; }
.back-home img { display: block; height: 44px; width: auto; margin: -6px 0; }
.bar-status { display: flex; flex-direction: column; margin-left: auto; text-align: right; line-height: 1.25; }
.bar-status b { font-weight: 600; }
.bar-status span { font-size: var(--step-small); color: var(--muted); }

main { max-width: 520px; margin: 0 auto; padding: 0 16px 64px; }
.screen { display: none; }
.screen.active { display: block; }

/* the thread */
.thread { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px 0 16px; }
.note { align-self: center; font-size: var(--step-small); font-weight: 600; color: var(--muted); margin: 4px 0 8px; }
.in {
  margin: 0; max-width: 86%; padding: 12px 18px; background: var(--bubble); border-radius: 24px 24px 24px 8px;
  font-size: var(--step-lead); line-height: 1.35;
  animation: pop .35s cubic-bezier(.2, .8, .2, 1.1) both;
}
.in:nth-child(2) { animation-delay: .1s; } .in:nth-child(3) { animation-delay: .25s; } .in:nth-child(4) { animation-delay: .4s; }
.in:nth-child(5) { animation-delay: .55s; } .in:nth-child(6) { animation-delay: .7s; }
.in-big { font: 800 var(--step-head)/1.15 "Montserrat", sans-serif; letter-spacing: -0.02em; background: var(--ink); color: var(--white); padding: 18px 22px; }
.in-lime { background: var(--lime); font-weight: 600; }
h1.in-big { font-size: var(--step-title); line-height: 1.05; max-width: 100%; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.typing { display: flex; gap: 6px; margin: 0; padding: 14px 18px; background: var(--bubble); border-radius: 24px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* replies: right-aligned orange bubbles */
.reply { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; margin-top: 8px; }
.answers { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.answers button { animation: pop .3s cubic-bezier(.2, .8, .2, 1.1) both; }
.answers button:nth-child(2) { animation-delay: .08s; }
.send, .answers button {
  min-height: 56px; padding: 14px 22px; border: 0; border-radius: 24px 24px 8px 24px; background: var(--accent); color: var(--ink);
  font-size: var(--step-lead); font-weight: 600; text-align: right; cursor: pointer; max-width: 86%;
  transition: transform .15s, background-color .15s;
}
.answers button { background: var(--white); }
.answers button:hover, .send:hover { background: var(--ink); color: var(--white); }
.answers button:active, .send:active { transform: scale(.97); }
.answers button:active { background: var(--lime); color: var(--ink); } /* the tap flashes lime: a reply, never a red "wrong" */
.ghost { min-height: 52px; padding: 12px 20px; border: 0; border-radius: 999px; background: var(--white); font-weight: 600; cursor: pointer; transition: background-color .15s; }
.ghost:hover { background: var(--ink); color: var(--white); }
.tiny { font-size: var(--step-small); color: var(--muted); margin: 4px 0 0; text-align: right; }

.progress { height: 6px; background: #d3d3cd; border-radius: 6px; overflow: hidden; margin-top: 16px; }
#bar { height: 100%; width: 0; background: var(--ink); transition: width .3s; } /* was orange: read as an error bar next to the answers */
.back { margin-top: 20px; background: none; border: 0; padding: 8px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

/* intro: on wide screens the sample card stands beside the thread */
.sample { margin: 24px 0 0; padding: 16px; background: var(--lime); border-radius: 28px; }
.sample img { display: block; width: 100%; height: auto; border-radius: 20px; animation: rise .9s .5s cubic-bezier(.2, .7, .2, 1) both; transition: transform .4s; }
.sample img:hover { transform: rotate(-1.5deg) translateY(-6px); }
.sample figcaption { margin-top: 10px; font-size: var(--step-small); color: var(--muted); text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) rotate(3deg); } }
@media (min-width: 900px) {
  main:has(.intro.active) { max-width: 1180px; }
  .intro.active { display: grid; grid-template-columns: 1fr 520px; grid-template-rows: auto 1fr; column-gap: 96px; align-items: start; padding-top: 32px; }
  .intro .thread, .intro .reply { grid-column: 1; }
  .intro .sample { grid-column: 2; grid-row: 1 / span 2; margin: 0; }
}

/* result */
#result { padding-top: 20px; }
.card-img { display: block; width: 100%; height: auto; border-radius: 20px; -webkit-touch-callout: default; }
.hint { text-align: center; font-size: var(--step-small); color: var(--muted); margin: 12px 0 20px; }
.actions { display: grid; gap: 10px; }
.actions .send { max-width: none; width: 100%; text-align: center; border-radius: 999px; }
.matches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 28px 0; }
.m { padding: 18px 16px; background: var(--white); border-radius: 20px; }
.m-good { background: var(--lime); }
.m p { margin: 0; }
.m-h { font-size: var(--step-small); font-weight: 600; }
.m-name { font-weight: 600; font-size: var(--step-lead); line-height: 1.2; margin: 6px 0 8px !important; }
.m p:last-child { font-size: var(--step-small); }
.more {
  display: flex; align-items: center; gap: 14px; margin: 8px 0 0; padding: 14px 18px 14px 14px; border-radius: 24px;
  background: #121212; color: #d4f25a; text-decoration: none; font-weight: 800; font-size: 1.125rem;
  transition: transform .2s;
}
.more:active { transform: scale(.98); }
@media (hover: hover) { .more:hover { transform: translateY(-2px); } }
.more-thumbs { display: flex; flex: none; }
.more-thumbs img { width: 44px; height: 60px; object-fit: cover; object-position: 50% 0; border-radius: 9px; border: 3px solid #121212; background: #ededea; }
.more-thumbs img + img { margin-left: -18px; transform: rotate(6deg); }
.more-thumbs img:first-child { transform: rotate(-6deg); }
.more-text { flex: 1; line-height: 1.2; }
.more-text small { display: block; font-weight: 600; font-size: .875rem; color: #ededea; }
.more-arrow { font-size: 1.5rem; }

@media (prefers-reduced-motion: reduce) { .in, .typing i, .sample img, .answers button { animation: none; } * { transition-duration: .01ms !important; } }
