:root {
  --bg: #000000;
  --card: #15161b;
  --raise: #1f2128;
  --ink: #f3f4f1;
  --soft: rgba(243, 244, 241, 0.55);
  --line: rgba(243, 244, 241, 0.1);
  --accent: #3ddc97;
}

*, *::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;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.cc { position: relative; width: min(308px, 100%); padding: 16px; border-radius: 26px; background: linear-gradient(160deg, #1b1c22, var(--card) 55%); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 30px 50px -30px rgba(61, 220, 151, 0.22); overflow: hidden; }
.cc::before { content: ""; position: absolute; left: -20%; top: -70px; width: 70%; height: 140px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent); pointer-events: none; }

.cc__head { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.cc__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--raise); box-shadow: inset 0 0 0 1px var(--line); color: var(--accent); }
.cc__icon svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.500; stroke-linecap: round; stroke-linejoin: round; }
.cc__title { font-size: 15px; font-weight: 680; letter-spacing: -0.005em; white-space: nowrap; }
.cc__bal { display: grid; justify-items: end; gap: 1px; }
.cc__ballabel { font-size: 10.5px; color: var(--soft); white-space: nowrap; }
.cc__bal strong { display: flex; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cc__roll { display: block; height: 18px; line-height: 18px; overflow: hidden; }
.cc__roll b { display: block; font-weight: inherit; }

/* three faces stacked in one body; the body takes the height of the face on show */
.cc__body { position: relative; height: 112px; margin-top: 16px; }
.cc__face { position: absolute; left: 0; right: 0; top: 0; display: grid; grid-template-columns: minmax(0, 1fr); opacity: 0; visibility: hidden; }
.cc[data-state="pick"] [data-face="pick"], .cc[data-state="code"] [data-face="code"], .cc[data-state="done"] [data-face="done"] { visibility: visible; }
.cc[data-state="pick"] [data-face="pick"] { opacity: 1; }

.cc__chips { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: 46px; padding: 4px; border-radius: 15px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px var(--line); }
.cc__chips button { position: relative; z-index: 1; display: grid; place-items: center; border-radius: 11px; font-size: 14px; font-weight: 620; font-variant-numeric: tabular-nums; color: var(--soft); transition: color 0.2s; }
.cc__chips button[aria-checked="true"] { color: var(--ink); }
.cc__chips button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.cc__thumb { position: absolute; left: 4px; top: 4px; bottom: 4px; width: calc((100% - 8px) / 4); border-radius: 11px; background: var(--raise); box-shadow: inset 0 0 0 1px rgba(243, 244, 241, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 6px 10px -6px rgba(0, 0, 0, 0.8); }

.cc__go { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; width: 100%; height: 50px; margin-top: 16px; border-radius: 16px; background: var(--accent); color: #06231a; font-size: 15px; font-weight: 720; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 14px 22px -14px var(--accent); }
.cc__go span { display: block; }
.cc__go:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.cc__go--soft { height: 46px; background: var(--raise); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.08); }

.cc__hint { font-size: 12px; color: var(--soft); text-align: center; }
.cc__code { display: grid; grid-template-columns: repeat(3, minmax(0, 38px)) 10px repeat(3, minmax(0, 38px)); justify-content: center; align-items: center; gap: 6px; margin-top: 10px; }
.cc__code span { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; height: 50px; border-radius: 12px; background: rgba(0, 0, 0, 0.4); box-shadow: inset 0 0 0 1px var(--line), inset 0 -10px 14px -12px color-mix(in srgb, var(--accent) 60%, transparent); overflow: hidden; }
.cc__code b { display: block; font-size: 25px; line-height: 1; font-weight: 640; font-variant-numeric: tabular-nums; font-stretch: 92%; }
.cc__code i { display: block; width: 8px; height: 2px; border-radius: 1px; background: var(--soft); justify-self: center; }
.cc__expiry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 14px; }
.cc__track { display: block; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.cc__track i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transform-origin: 0 50%; }
.cc__left { font-size: 11.5px; color: var(--soft); white-space: nowrap; }
.cc__left b { font-weight: 620; color: var(--ink); font-variant-numeric: tabular-nums; }
.cc__cancel { justify-self: center; height: 34px; margin-top: 8px; padding: 0 14px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--soft); }
.cc__cancel:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); color: var(--ink); }
@media (hover: hover) { .cc__cancel:hover { color: var(--ink); } }

.cc__ok { justify-self: center; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1.500px var(--accent); color: var(--accent); }
.cc__ok svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.200; stroke-linecap: round; stroke-linejoin: round; }
.cc__ok path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cc__done { display: grid; justify-items: center; gap: 3px; margin-top: 12px; text-align: center; }
.cc__done strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc__done span { font-size: 12px; color: var(--soft); }
.cc__done strong span { font-size: inherit; color: inherit; }

/* an empty box as big as the tallest state of the card: the preview frames this */
.frame { position: absolute; left: 50%; top: 50%; width: 330px; height: 290px; margin: -145px 0 0 -165px; pointer-events: none; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #0b0b0d; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); z-index: 6; }

@media (prefers-reduced-motion: reduce) { .cc__chips button { transition: none; } }
