:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #17181c;
  --soft: rgba(23, 24, 28, 0.58);
  --line: rgba(23, 24, 28, 0.12);
  --accent: #12a36a;
  --bad: #d8452e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 12px;
  overflow: hidden;
}

.ev { position: relative; width: min(332px, 100%); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; padding: 20px; border-radius: 26px; background: var(--card); box-shadow: 0 0 0 1px rgba(23, 24, 28, 0.07), 0 1px 2px rgba(23, 24, 28, 0.04), 0 24px 44px -28px rgba(23, 24, 28, 0.32); }
.ev__roll { display: block; overflow: hidden; }
.ev__roll > span { display: block; white-space: nowrap; }

/* the tile: an envelope at first, a stamped seal at the end. --tile is tweened by the script */
.ev__tile { --tile: rgba(23, 24, 28, 0.06); position: relative; width: 52px; height: 52px; margin-bottom: 14px; }
.ev__face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; background: var(--tile); color: var(--ink); }
.ev__face svg { position: absolute; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; }
.ev__tick { stroke-width: 2.400; stroke-dasharray: 20; stroke-dashoffset: 20; opacity: 0; }
.ev.is-done .ev__tick { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.38s cubic-bezier(0.3, 0.7, 0.2, 1) 0.16s; }
.ev.is-done .ev__face { color: #ffffff; }
.ev__ripple { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); opacity: 0; pointer-events: none; }

.ev__copy { display: grid; gap: 6px; width: 100%; }
.ev__title { height: 26px; line-height: 26px; font-size: 20px; font-weight: 740; font-stretch: 104%; letter-spacing: -0.015em; }
.ev__text { height: 40px; font-size: 13.500px; line-height: 20px; font-weight: 540; color: var(--soft); }
.ev__text b { font-weight: 680; color: var(--ink); white-space: nowrap; }

.ev__area { width: 100%; height: 0; overflow: hidden; }
.ev__code { position: relative; display: block; height: 52px; margin-top: 14px; cursor: text; }
.ev__boxes { position: absolute; inset: 0; display: flex; gap: 6px; }
.ev__box { flex: 1; min-width: 0; display: grid; place-items: center; border-radius: 13px; background: rgba(23, 24, 28, 0.035); box-shadow: inset 0 0 0 1.500px var(--line); font-size: 21px; font-weight: 720; font-stretch: 104%; transition: box-shadow 0.2s, background-color 0.2s; }
.ev__box:nth-child(4) { margin-left: 8px; }
.ev__box.is-full { background: #ffffff; box-shadow: inset 0 0 0 1.500px rgba(23, 24, 28, 0.5); }
.ev__box.is-next { box-shadow: inset 0 0 0 2px var(--ink); background: #ffffff; }
.ev.is-bad .ev__box { box-shadow: inset 0 0 0 1.500px var(--bad); color: var(--bad); }
.ev__box span { display: block; }
.ev__input { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: none; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; }

/* --fill and --text are tweened by the script: dark to send, quiet to resend, the accent to continue */
.ev__btn { --fill: var(--ink); --text: #ffffff; width: 100%; height: 48px; margin-top: 16px; display: grid; place-items: center; border: 0; border-radius: 24px; background: var(--fill); color: var(--text); font: inherit; font-size: 14.500px; font-weight: 720; font-stretch: 104%; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.ev__btn:focus-visible, .note:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.ev__btn .ev__roll { height: 22px; line-height: 22px; }

/* the notification the code arrives in */
.note { position: absolute; left: 12px; right: 12px; top: -40px; z-index: 4; height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 18px; background: rgba(28, 29, 34, 0.94); color: #ffffff; font: inherit; text-align: left; cursor: pointer; outline: none; visibility: hidden; -webkit-tap-highlight-color: transparent; box-shadow: 0 16px 30px -14px rgba(23, 24, 28, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.note__icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); }
.note__icon svg { width: 19px; height: 19px; fill: none; stroke: #ffffff; stroke-width: 1.900; stroke-linecap: round; stroke-linejoin: round; }
.note__text { flex: 1; min-width: 0; display: grid; gap: 1px; font-size: 12.500px; line-height: 17px; }
.note__text b { font-weight: 720; }
.note__text span { color: rgba(255, 255, 255, 0.72); font-weight: 540; white-space: nowrap; }
.note__text i { font-style: normal; font-weight: 720; color: #ffffff; letter-spacing: 0.04em; }
.note__text i span { display: inline-block; color: inherit; font-weight: inherit; }
.note__fill { flex: none; height: 28px; line-height: 28px; padding: 0 11px; border-radius: 14px; background: rgba(255, 255, 255, 0.14); font-size: 12px; font-weight: 700; }

.fly { position: absolute; left: 0; top: 0; z-index: 6; font-size: 21px; font-weight: 720; font-stretch: 104%; color: var(--ink); pointer-events: none; will-change: transform; }
.ev__say { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; pointer-events: none; opacity: 0; fill: var(--ink); stroke: #ffffff; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 3px rgba(23, 24, 28, 0.3)); z-index: 8; }

@media (max-width: 350px) {
  .ev { padding: 18px; }
  .ev__box { font-size: 19px; }
  .ev__boxes { gap: 5px; }
}
@media (max-height: 380px) {
  .ev { padding-top: 16px; padding-bottom: 16px; }
  .ev__tile { margin-bottom: 10px; }
  .ev__btn { margin-top: 12px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .ev__box, .ev.is-done .ev__tick { transition: none; }
}
