/* Амьдралын E-Barimt: a playful quiz app. The receipt (paper, zigzag, Montserrat) stays as the prize,
   the screens around it are loose and colourful. Motion is transform/opacity only. */
:root {
  --ground: #ededea;
  --paper: #ffffff;
  --ink: #121212;
  --muted: #4b4b48;
  --accent: #ff4b1f;
  --lime: #d4f25a;
  --sky: #bfe3ff;
  --r: 999px;
  --rc: 26px;
  --step-small: 0.9375rem;
  --step-body: 1.0625rem;
  --step-lead: 1.25rem;
  --step-head: clamp(1.9rem, 1.3rem + 2.6vw, 2.75rem);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 var(--step-body)/1.5 "Montserrat", system-ui, sans-serif; overflow-x: hidden; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
: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); }

.bar { display: flex; align-items: center; gap: 16px; max-width: 1040px; margin: 0 auto; padding: 18px 16px; }
.mark { display: block; }
.mark img { display: block; height: 44px; width: auto; margin: -4px 0 -4px -6px; }
.bar-title { margin-left: auto; font-size: var(--step-small); font-weight: 600; }

main { max-width: 520px; margin: 0 auto; padding: 0 16px 64px; }
main:has(#intro.active) { max-width: 1040px; }
.screen { display: none; }
.screen.active { display: block; animation: up .45s var(--ease); }
@keyframes up { from { opacity: 0; transform: translateY(16px); } }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 60px; padding: 0 24px; border: 0;
  border-radius: var(--r); background: var(--paper); color: var(--ink); font-weight: 800; font-size: var(--step-lead); cursor: pointer;
  transition: transform .18s var(--spring);
}
.btn:active { transform: scale(.95); }
.btn-go { background: var(--accent); box-shadow: 0 6px 0 var(--ink); }
.btn-go:active { transform: translateY(4px) scale(.98); box-shadow: 0 2px 0 var(--ink); }
.btn-go:not(:active) { animation: nudge 2.6s 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-2deg) scale(1.03); } 96% { transform: rotate(2deg) scale(1.03); } }

/* ---------- intro ---------- */
#intro.active { display: grid; gap: 32px; padding-top: 8px; }
.intro-top { position: relative; }
.bubble {
  display: inline-block; background: var(--ink); color: var(--lime); font-weight: 800; padding: 14px 18px; border-radius: 22px 22px 22px 6px;
  margin: 0 0 18px; animation: pop .6s .2s var(--spring) both;
}
.bubble[hidden] { display: none; }
.stickers { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.st {
  display: inline-block; padding: 10px 14px; border-radius: 14px; font-weight: 800; font-size: var(--step-small);
  background: var(--paper); animation: pop .55s var(--spring) both, bob 3.2s ease-in-out infinite;
}
.st1 { background: var(--lime); transform: rotate(-4deg); animation-delay: .1s, .7s; }
.st2 { transform: rotate(3deg); animation-delay: .2s, 1.2s; }
.st3 { background: var(--accent); transform: rotate(-2deg); animation-delay: .3s, 0s; }
.st4 { background: var(--sky); transform: rotate(4deg); animation-delay: .4s, 1.8s; }
@keyframes pop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
h1 { font: 800 var(--step-head)/1.06 "Montserrat", sans-serif; letter-spacing: -0.03em; margin: 0 0 14px; }
h1 .em { display: inline-block; animation: wiggle 2.2s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.lead { margin: 0 0 18px; font-size: var(--step-lead); line-height: 1.4; }
.chips { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--paper); border-radius: var(--r); padding: 8px 14px; font-weight: 600; font-size: var(--step-small); }
.tiny { font-size: var(--step-small); color: var(--muted); margin: 18px 0 0; text-align: center; }
.sample { margin: 0; }
.sample img { display: block; width: 100%; height: auto; transform: rotate(-2deg); animation: tilt 1.1s .3s var(--ease) both; }
@keyframes tilt { from { opacity: 0; transform: translateY(40px) rotate(4deg); } }
.sample figcaption { font-size: var(--step-small); margin-top: 16px; font-weight: 600; }
@media (min-width: 900px) {
  #intro.active { grid-template-columns: 1fr 0.8fr; gap: 64px; align-items: center; padding-top: 24px; }
  .sample { max-width: 400px; justify-self: center; }
}

/* ---------- quiz ---------- */
/* the till: a count and a barcode that fills bar by bar, one bar per answered question */
.till { position: relative; display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--paper); border-radius: 18px; padding: 12px 16px; margin: 4px 0 18px; }
.till-count { font-weight: 800; font-size: var(--step-lead); font-variant-numeric: tabular-nums; min-width: 3.2em; }
.till-count b { color: var(--lime); display: inline-block; }
.till-count b.tick { animation: tick .35s var(--spring); }
@keyframes tick { from { transform: translateY(-60%) scale(1.4); opacity: 0; } }
.bars { flex: 1; display: flex; align-items: stretch; gap: 3px; height: 28px; }
.bars i { flex: 1; background: #3a3a36; border-radius: 2px; transform-origin: bottom; }
.bars i.on { background: var(--lime); animation: barIn .35s var(--spring); }
.bars i:nth-child(3n).on { background: var(--paper); }
@keyframes barIn { from { transform: scaleY(0); } }
.toast {
  position: absolute; left: 50%; top: calc(100% + 8px); translate: -50% 0; white-space: nowrap; z-index: 5;
  background: var(--paper); color: var(--ink); font-weight: 800; font-size: var(--step-small); padding: 8px 14px; border-radius: var(--r);
  opacity: 0; transform: translateY(-6px) scale(.9); transition: opacity .25s, transform .3s var(--spring); pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

.stage { position: relative; }
.stage.out { animation: outLeft .28s var(--ease) forwards; }
.stage.in { animation: inRight .42s var(--spring); }
.stage.back-in { animation: inLeft .42s var(--spring); }
@keyframes outLeft { to { opacity: 0; transform: translateX(-36%) rotate(-4deg); } }
@keyframes inRight { from { opacity: 0; transform: translateX(36%) rotate(4deg); } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-36%) rotate(-4deg); } }

.qcard { background: var(--paper); border-radius: var(--rc); padding: 22px 22px 26px; margin: 26px 0 16px; position: relative; }
.qemoji { position: absolute; top: -26px; right: 18px; font-size: 52px; line-height: 1; display: inline-block; animation: pop .5s .1s var(--spring) both; }
#qtext { font: 800 clamp(1.55rem, 1.2rem + 1.6vw, 2rem)/1.15 "Montserrat", sans-serif; letter-spacing: -0.02em; margin: 0; padding-right: 48px; }
.answers { display: grid; gap: 12px; }
.answers button {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 84px; text-align: left; padding: 16px 18px; border: 0; border-radius: var(--rc);
  font-size: var(--step-lead); font-weight: 800; line-height: 1.25; cursor: pointer; overflow: hidden;
  transition: transform .18s var(--spring);
  animation: pop .45s var(--spring) both;
}
/* answers stay neutral (white / sky): orange read as "wrong" to testers (2026-11-30). Lime + ink border = the pick. */
.answers button { border: 3px solid transparent; }
.answers button:nth-child(1) { background: var(--paper); animation-delay: .08s; }
.answers button:nth-child(2) { background: var(--sky); animation-delay: .16s; }
.answers button:nth-child(1) .ae { background: var(--ground); }
.answers button .ae { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--paper); font-size: 30px; transition: transform .3s var(--spring); }
.answers button:active { transform: scale(.94); }
.answers button:active { background: var(--lime); }
.answers button.picked { background: var(--lime); border-color: var(--ink); animation: picked .42s var(--spring); transform: scale(1.03) rotate(-1deg); }
@keyframes picked { 0% { transform: scale(.94); } 55% { transform: scale(1.07) rotate(-1.5deg); } 100% { transform: scale(1.03) rotate(-1deg); } }
.answers button.picked .ae { transform: rotate(-14deg) scale(1.15); }
.answers button.dim { opacity: .45; transform: scale(.97); transition: opacity .2s, transform .2s; }
/* stamp on the picked answer */
/* the pick: a ✓ stamped over the answer's emoji tile, so it never covers the text */
.stamp {
  position: absolute; left: 15px; top: calc(50% - 26px); width: 52px; height: 52px; display: grid; place-items: center;
  font: 800 1.75rem/1 "Montserrat", sans-serif; color: var(--lime); background: var(--ink); border-radius: 16px;
  animation: stamp .38s var(--spring) both;
}
@keyframes stamp { from { opacity: 0; transform: scale(2.2) rotate(-18deg); } to { transform: rotate(-10deg); } }
/* the basket: every picked answer drops its emoji here, a little receipt of the run so far */
.cart {
  margin-top: 22px; background: var(--paper); padding: 16px 18px 26px;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), 95% 100%, 90% calc(100% - 10px), 85% 100%, 80% calc(100% - 10px), 75% 100%, 70% calc(100% - 10px), 65% 100%, 60% calc(100% - 10px), 55% 100%, 50% calc(100% - 10px), 45% 100%, 40% calc(100% - 10px), 35% 100%, 30% calc(100% - 10px), 25% 100%, 20% calc(100% - 10px), 15% 100%, 10% calc(100% - 10px), 5% 100%, 0 calc(100% - 10px));
}
.cart-h { margin: 0 0 10px; font-weight: 800; font-size: var(--step-small); }
.cart-items { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; }
.cart-items span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--ground); font-size: 22px; }
.cart-items span.new { animation: drop .45s var(--spring); }
@keyframes drop { from { transform: translateY(-40px) scale(.5) rotate(-30deg); opacity: 0; } }
.back { margin-top: 18px; min-height: 48px; background: none; border: 0; padding: 8px 4px; font-weight: 800; cursor: pointer; }

/* emoji burst (confetti) */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.fx span { position: absolute; font-size: 26px; will-change: transform, opacity; animation: burst .8s var(--ease) forwards; }
@keyframes burst { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; } }

/* ---------- result ---------- */
.printing { text-align: center; font-weight: 800; font-size: var(--step-lead); margin: 6px 0 12px; transition: opacity .3s; }
.printing.done { opacity: 0; height: 0; margin: 0; overflow: hidden; }
.till-slot { height: 22px; background: var(--ink); border-radius: 12px; margin: 0 -6px; position: relative; z-index: 2; }
.till-slot::after { content: ""; position: absolute; left: 6%; right: 6%; top: 9px; height: 4px; background: #3a3a36; border-radius: 4px; }
.paper-out { overflow: hidden; margin-top: -11px; position: relative; z-index: 1; }
.card-img { display: block; width: 100%; height: auto; -webkit-touch-callout: default; user-select: auto; transform: translateY(-101%); }
.card-img.print { animation: printOut 1.8s cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes printOut {
  0% { transform: translateY(-101%); } 20% { transform: translateY(-82%); } 28% { transform: translateY(-80%); }
  55% { transform: translateY(-40%); } 62% { transform: translateY(-38%); } 100% { transform: translateY(0); }
}
.after { opacity: 0; transform: translateY(18px); transition: opacity .5s var(--ease), transform .5s var(--ease); pointer-events: none; }
.after.show { opacity: 1; transform: none; pointer-events: auto; }
.you-are { display: none; font: 800 var(--step-head)/1.08 "Montserrat", sans-serif; letter-spacing: -0.02em; text-align: center; margin: 4px 0 14px; }
.you-are.show { display: block; animation: pop .55s var(--spring); }
.you-are small { display: block; font-size: var(--step-lead); font-weight: 600; margin-bottom: 4px; }
.hint { text-align: center; font-size: var(--step-small); color: var(--muted); margin: 8px 0 18px; }
.actions { display: grid; gap: 12px; }
.matches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 28px 0; }
.m { padding: 18px 16px; background: var(--paper); border-radius: var(--rc); }
.m-good { background: var(--lime); }
.m-bad { background: var(--ink); color: var(--paper); }
.m p { margin: 0; }
.m-h { font-size: var(--step-small); font-weight: 800; }
.m-name { font-weight: 800; font-size: var(--step-lead); line-height: 1.15; 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 (hover: hover) {
  .btn:hover { transform: translateY(-2px) rotate(-.5deg); }
  .answers button:hover { transform: scale(1.02) rotate(-.4deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .card-img { transform: none; }
  .fx { display: none; }
}

/* ---------- Match: name field, board peek, my board, friend reveal ---------- */
.name-field { display: block; margin: 0 0 14px; }
.name-field span { display: block; font-weight: 800; font-size: var(--step-small); margin: 0 0 8px; }
.name-field input {
  width: 100%; min-height: 60px; padding: 0 20px; border: 3px solid var(--ink); border-radius: 18px; background: var(--paper);
  font: 800 var(--step-lead) "Montserrat", sans-serif; color: var(--ink); transition: transform .2s var(--spring);
}
.name-field input:focus { outline: none; box-shadow: 0 5px 0 var(--ink); transform: translateY(-2px); }
.name-field input.bad { border-color: var(--accent); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.err { color: #b3260b; font-weight: 800; font-size: var(--step-small); margin: -4px 0 14px; }
.my-board { display: block; margin-top: 16px; min-height: 48px; line-height: 48px; text-align: center; font-weight: 800; color: var(--ink); text-underline-offset: 4px; }

.board-peek { background: var(--ink); color: var(--paper); border-radius: var(--rc); padding: 18px 18px 14px; margin: 0 0 18px; animation: pop .55s var(--spring) both; }
.peek-hi { margin: 0 0 10px; font-weight: 800; font-size: var(--step-lead); line-height: 1.25; color: var(--lime); }

.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mlist li { display: grid; grid-template-columns: 2.2em 1fr auto; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 14px; background: var(--paper); color: var(--ink); font-weight: 600; animation: pop .4s var(--spring) both; }
.mlist li .rk { font-weight: 800; text-align: center; }
.mlist li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist li .pc { font-weight: 800; font-variant-numeric: tabular-nums; }
.mlist li:first-child { background: var(--lime); }
.mlist li.me { background: var(--accent); }
.mlist-mini li { min-height: 40px; background: #24241f; color: var(--paper); }
.mlist-mini li:first-child { background: var(--lime); color: var(--ink); }

.mboard { background: var(--paper); border-radius: var(--rc); padding: 20px 18px; margin: 24px 0; }
.mboard h3 { font: 800 var(--step-lead)/1.2 "Montserrat", sans-serif; margin: 0 0 6px; }
.mb-sub { margin: 0 0 14px; font-size: var(--step-small); }
.mboard .mlist li { background: var(--ground); }
.mboard .mlist li:first-child { background: var(--lime); }
.mboard .mlist li.me { background: var(--accent); }
.mb-empty { margin: 4px 0 14px; font-weight: 600; color: var(--muted); }
.mboard .btn { margin-top: 14px; }

.reveal { text-align: center; padding: 26px 0 10px; }
.rv-names { font: 800 var(--step-lead)/1.2 "Montserrat", sans-serif; margin: 0; }
.rv-pct { font: 800 clamp(6rem, 3rem + 18vw, 9rem)/1 "Montserrat", sans-serif; letter-spacing: -0.04em; margin: 6px 0; font-variant-numeric: tabular-nums; }
.rv-label { font: 800 var(--step-head)/1.1 "Montserrat", sans-serif; margin: 0; opacity: 0; transform: scale(.6); transition: opacity .4s, transform .5s var(--spring); }
#match.revealed .rv-label { opacity: 1; transform: none; }
#match.revealed .rv-pct { animation: thump .5s var(--spring); }
@keyframes thump { 40% { transform: scale(1.12); } }
.match-img { display: block; width: 100%; height: auto; margin: 18px 0 0; -webkit-touch-callout: default; }
.mine-box { background: var(--lime); border-radius: var(--rc); padding: 18px; margin: 0 0 30px; }
.mine-box p { margin: 0 0 12px; }

.my-board[hidden], .board-peek[hidden], .mboard[hidden] { display: none; }

/* Instagram names */
.ig-chip { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--lime); font-size: .8rem; vertical-align: 1px; animation: pop .35s var(--spring); }
.ig-chip[hidden] { display: none; }
.ig-link { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.mlist li .nm .ig-link { display: inline-block; min-height: 32px; line-height: 32px; }

.keep-note { margin: -6px 0 12px; font-size: .8125rem; color: var(--muted); }

/* ---------- Match first: promise on the intro, call to action right under the receipt ---------- */
.promise { display: inline-block; margin: 0 0 22px; padding: 10px 16px; border-radius: 16px; background: var(--ink); color: var(--lime); font-weight: 800; line-height: 1.35; transform: rotate(-1deg); }
.new-friends {
  display: block; margin: 0 0 18px; padding: 14px 18px; border-radius: 20px; background: var(--accent); color: var(--ink);
  font-weight: 800; font-size: var(--step-lead); line-height: 1.25; text-decoration: none; box-shadow: 0 5px 0 var(--ink);
  animation: pop .55s .2s var(--spring) both;
}
.new-friends[hidden] { display: none; }

.mcta { background: var(--lime); margin: 0 0 22px; }
/* appears a moment after the receipt has printed, without moving anything (transform/opacity only) */
.after.show .mcta { animation: ctaIn .6s 1.2s var(--spring) both; }
@keyframes ctaIn { from { opacity: 0; transform: translateY(24px) scale(.96) rotate(-1deg); } }
.mcta h3 { font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.6rem); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 14px; }
.steps { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 6px; }
.steps li { display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: 16px; padding: 8px 14px 8px 8px; font-weight: 800; line-height: 1.25; }
.steps b { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--lime); font-size: .9375rem; }
.mcta .btn { margin-top: 16px; }
.mb-box { margin-top: 18px; background: var(--paper); border-radius: 20px; padding: 14px 12px 12px; }
.mb-box[hidden], .mb-sample[hidden], .mlist[hidden] { display: none; }
.mb-h { margin: 0 0 10px 4px; font-weight: 800; }
.mb-sample { text-align: center; }
.mb-sample .mlist { opacity: .42; filter: grayscale(.3); text-align: left; }
.mb-sample .mlist li { animation: none; }
.mb-sample-tag {
  display: inline-block; margin: 10px 0 2px; white-space: nowrap;
  background: var(--ink); color: var(--lime); font-weight: 800; font-size: .875rem; padding: 8px 14px; border-radius: 999px; transform: rotate(-3deg);
}
.btn-story { border: 3px solid var(--ink); }
.qr-note { margin: -4px 0 2px; text-align: center; font-size: var(--step-small); font-weight: 600; color: var(--muted); }
.peek-share { margin-top: 14px; box-shadow: 0 6px 0 var(--lime); }
.peek-share[hidden] { display: none; }
