@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-latin-var.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree-latin-var.woff2') format('woff2-variations');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --deep: #4B1F6F;
  --purple: #7B3FBF;
  --lavender: #C9A6E6;
  --lilac: #EAD9F7;
  --cream: #FFF7E6;
  --sunshine: #FEC95B;
  --ink-soft: #6B4A88;
  --paper: #FFFDF7;
  --display: 'Fredoka', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--body);
  color: var(--deep);
  background:
    radial-gradient(60rem 40rem at 50% -10%, var(--lilac), transparent 70%),
    radial-gradient(40rem 30rem at 110% 110%, rgba(254, 201, 91, .28), transparent 70%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  overflow: hidden;
}

.card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 2rem 1.75rem 1.6rem;
  background: var(--paper);
  border-radius: 34px;
  box-shadow: 0 22px 50px rgba(75, 31, 111, .16), 0 2px 10px rgba(75, 31, 111, .07);
  text-align: center;
  animation: rise .7s cubic-bezier(.2, .8, .2, 1) both;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--lilac);
  pointer-events: none;
}

.logo { margin: 0; line-height: 0; }
.logo img {
  width: min(100%, 300px);
  height: auto;
  animation: settle .9s .1s cubic-bezier(.2, .8, .2, 1) both;
}

.descriptor {
  margin: .9rem 0 1.4rem;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--ink-soft);
  text-wrap: balance;
}

.qr { margin: 0; }

.qr-tile {
  position: relative;
  width: min(100%, 236px);
  margin: 0 auto;
  padding: 16px;
  background: #fff;
  border-radius: 22px;
  box-shadow: inset 0 0 0 3px var(--lavender);
  animation: pop .6s .35s cubic-bezier(.3, 1.4, .5, 1) both;
}

.qr-code {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

/* High error correction (H) covers this: the mark hides well under 15% of the code. */
.qr-mark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 12px;
}
.qr-mark img { width: 84%; height: auto; }

.qr figcaption {
  margin-top: .75rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.actions {
  display: grid;
  gap: .6rem;
  margin-top: 1.4rem;
}

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: .85rem 1.2rem;
  border: 0;
  border-radius: 999px;
  font: 700 1.05rem/1.2 var(--display);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:focus-visible { outline: 3px solid var(--sunshine); outline-offset: 3px; }
.btn:active { transform: scale(.98); }

.btn-main {
  background: var(--deep);
  color: #fff;
  box-shadow: 0 8px 18px rgba(75, 31, 111, .25);
}
.btn-main:hover { background: var(--purple); }

.btn-soft {
  background: var(--lilac);
  color: var(--deep);
}
.btn-soft:hover { background: var(--lavender); }

.status {
  min-height: 1.2em;
  margin: .5rem 0 0;
  font-size: .9rem;
  font-weight: 600;
  color: var(--purple);
}

.area {
  margin: .4rem 0 0;
  font-size: .85rem;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

/* Drifting hearts, the brand's signature, kept behind the card. */
.heart {
  position: absolute;
  width: var(--s, 28px);
  aspect-ratio: 1;
  background: var(--c, var(--lavender));
  -webkit-mask: url('/img/heart.svg') center / contain no-repeat;
  mask: url('/img/heart.svg') center / contain no-repeat;
  opacity: .8;
  animation: drift var(--d, 9s) ease-in-out infinite alternate;
}
.h1 { --s: 34px; --c: var(--purple); top: 9%; left: 10%; --d: 8s; }
.h2 { --s: 22px; --c: var(--lavender); top: 16%; right: 12%; --d: 10s; }
.h3 { --s: 28px; --c: var(--sunshine); bottom: 12%; left: 14%; --d: 11s; }
.h4 { --s: 40px; --c: var(--lavender); bottom: 8%; right: 9%; --d: 9s; }

@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes settle { from { opacity: 0; transform: scale(.9) rotate(-2deg); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-18px) rotate(8deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phones with browser chrome showing: keep the whole card on one screen. */
@media (max-height: 869px) {
  .stage { padding-top: max(.75rem, env(safe-area-inset-top)); padding-bottom: max(.75rem, env(safe-area-inset-bottom)); }
  .card { padding: 1.4rem 1.4rem 1.1rem; }
  .logo img { width: min(100%, 230px); }
  .descriptor { margin: .6rem 0 .9rem; font-size: 1.02rem; }
  .qr-tile { width: min(100%, 212px); padding: 13px; }
  .qr figcaption { margin-top: .5rem; }
  .actions { margin-top: .9rem; gap: .5rem; }
  .btn { min-height: 48px; padding: .7rem 1.1rem; }
}

@media (min-height: 870px) {
  .card { padding: 2.4rem 2rem 1.8rem; }
  .qr-tile { width: min(100%, 256px); }
}

@media (max-height: 700px) {
  .logo img { width: min(100%, 200px); }
  .descriptor { font-size: .96rem; margin: .45rem 0 .7rem; }
  .qr-tile { width: min(100%, 186px); padding: 11px; }
  .qr figcaption { font-size: .88rem; }
  .actions { margin-top: .7rem; }
  .btn { min-height: 46px; padding: .6rem 1rem; font-size: 1rem; }
  .area { font-size: .8rem; }
}
