@layer components {
  /* Invite landing: the guest of honour gets a little holiday. */
  .invite {
    position: relative;
    overflow: hidden;
    text-align: center;
  }

  .invite .kicker {
    margin: 0;
    color: var(--muted);
    font-size: var(--step-00);
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  .invite .friend-name {
    margin: var(--space-2xs) 0 var(--space-s);
    font-family: var(--font-display);
    font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
    line-height: 1.15;
    color: var(--paprika);
    text-wrap: balance;
  }

  .invite .invite-lead {
    max-inline-size: 36ch;
    margin-inline: auto;
  }

  .invite .telegram-box,
  .invite form {
    position: relative;
    z-index: 1;
    margin-block-start: var(--space-m);
  }

  .confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .confetti .dot {
    position: absolute;
    inset-block-start: -1.2rem;
    inline-size: 0.42rem;
    block-size: 0.72rem;
    border-radius: 0.12rem;
    background: var(--paprika);
    opacity: 0;
    animation: invite-fall 9s linear infinite;
  }

  .confetti .dot:nth-child(3n + 2) { background: var(--gold); }
  .confetti .dot:nth-child(3n) { background: var(--sage); }
  .confetti .dot:nth-child(5n + 4) { background: var(--plum); }

  .confetti .dot:nth-child(1) { left: 4%; animation-delay: 0s; }
  .confetti .dot:nth-child(2) { left: 11%; animation-delay: -2.1s; animation-duration: 10s; }
  .confetti .dot:nth-child(3) { left: 19%; animation-delay: -4.4s; }
  .confetti .dot:nth-child(4) { left: 26%; animation-delay: -1.2s; animation-duration: 11s; }
  .confetti .dot:nth-child(5) { left: 33%; animation-delay: -5.8s; }
  .confetti .dot:nth-child(6) { left: 41%; animation-delay: -3.1s; animation-duration: 8.5s; }
  .confetti .dot:nth-child(7) { left: 48%; animation-delay: -7.2s; }
  .confetti .dot:nth-child(8) { left: 56%; animation-delay: -0.6s; animation-duration: 10.5s; }
  .confetti .dot:nth-child(9) { left: 63%; animation-delay: -4.9s; }
  .confetti .dot:nth-child(10) { left: 70%; animation-delay: -2.7s; animation-duration: 9.5s; }
  .confetti .dot:nth-child(11) { left: 78%; animation-delay: -6.4s; }
  .confetti .dot:nth-child(12) { left: 85%; animation-delay: -1.8s; animation-duration: 11.5s; }
  .confetti .dot:nth-child(13) { left: 92%; animation-delay: -5.2s; }
  .confetti .dot:nth-child(14) { left: 97%; animation-delay: -8.1s; animation-duration: 8.8s; }

  @keyframes invite-fall {
    0% { transform: translateY(-1rem) rotate(0deg); opacity: 0; }
    8% { opacity: 0.85; }
    90% { opacity: 0.7; }
    100% { transform: translateY(38rem) rotate(340deg); opacity: 0; }
  }

  @media (prefers-reduced-motion: reduce) {
    .confetti .dot { animation: none; opacity: 0; }
  }

  /* Nickname and invite link on the Invites page. */
  .nickname-line .nickname {
    font-family: var(--font-display);
    font-size: var(--step-1);
    color: var(--paprika);
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .invite-link .pair {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;

    input {
      flex: 1;
      min-inline-size: 0;
      font-size: 0.9rem;
    }

    .btn {
      flex-shrink: 0;
      /* The global .btn carries a stack-separating top margin; in this row
         it would drop the copy button below the input's top edge. */
      margin-block: 0;
      padding-inline: var(--space-s);
    }
  }

  .invite-link .copy-idle,
  .invite-link .copy-done {
    display: inline-flex;
    align-items: center;

    .glyph { inline-size: 1.15em; block-size: 1.15em; }
  }

  .invite-link .copy-done { color: var(--sage); }

  #invite h2 {
    margin-block: var(--space-m) var(--space-s);
    font-family: var(--font-display);
    font-size: var(--step-1);
  }

  .referral-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .referral {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    min-block-size: var(--touch);
  }

  .referral-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xs);
    min-inline-size: 0;
  }

  .referral-name {
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .referral-joined {
    color: var(--muted);
    font-size: var(--step-00);
  }
}
