:root {
  --fondo: #f2f2f3;
  --card: #ffffff;
  --inchiostro: #141416;
  --grigio: #6f6f77;
  --grigio-chiaro: #a9a9b1;
  --bordo: rgba(20, 20, 22, 0.09);
  --campo: #f4f4f6;
  --accento: #16834e;
  --accento-chiaro: #e7f4ec;
  --ambra: #b26a0c;
  --ambra-chiaro: #fbf1e1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
}

.wallet {
  width: min(340px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(14px, 3.8vmin, 22px);
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.04), 0 26px 56px -28px rgba(20, 20, 22, 0.24);
}

.wallet__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wallet__brand { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 660; letter-spacing: -0.01em; }
.wallet__logo { width: 26px; height: 26px; border-radius: 8px; background: var(--inchiostro); display: grid; place-items: center; }
.wallet__logo svg { width: 17px; height: 17px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }

/* the status tag: its label rolls when the balance is topped up */
.tag {
  display: inline-block;
  height: 22px; overflow: hidden;
  border-radius: 999px;
  font-size: 11px; font-weight: 620;
  transition: background 0.4s, color 0.4s;
}
.tag__in { display: block; line-height: 22px; padding: 0 9px; white-space: nowrap; }
.tag--low { background: var(--ambra-chiaro); color: var(--ambra); }
.tag--ok { background: var(--accento-chiaro); color: var(--accento); }

.balance { margin-top: clamp(12px, 3.4vmin, 20px); }
.balance__label { font-size: 12px; color: var(--grigio); }
.balance__plan { color: var(--grigio-chiaro); }
.balance__row { position: relative; display: flex; align-items: flex-end; gap: 10px; margin-top: 4px; }
.balance__value { display: inline-flex; align-items: center; font-size: clamp(30px, 9vmin, 38px); font-weight: 700; letter-spacing: -0.03em; height: 1.12em; overflow: hidden; }
.plus {
  align-self: flex-start; margin-top: 2px;
  font-size: 12.5px; font-weight: 640; color: var(--accento);
  background: var(--accento-chiaro);
  border-radius: 999px; padding: 3px 8px;
  opacity: 0;
  pointer-events: none;
}

/* every digit sits on its own wheel, each wheel one fixed width wide, so the figure never jiggles */
.money { display: inline-flex; align-items: center; height: 1.15em; overflow: hidden; vertical-align: top; }
.money .ch { display: inline-block; text-align: center; }
.money .wheel { display: inline-block; position: relative; width: 0.6em; height: 1.15em; overflow: hidden; }
.money .wheel__strip { position: absolute; left: 0; top: 0; width: 100%; display: flex; flex-direction: column; }
.money .wheel__strip span { display: block; height: 1.15em; line-height: 1.15em; text-align: center; }

/* the amounts: a white pill slides under the chosen one */
.amounts {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr) 1.35fr;
  gap: 4px;
  margin-top: clamp(14px, 3.8vmin, 22px);
  padding: 4px;
  border-radius: 14px;
  background: var(--campo);
  border: 1px solid var(--bordo);
}
.amounts__pill {
  position: absolute; left: 0; top: 4px;
  height: calc(100% - 8px);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.08), 0 4px 10px -4px rgba(20, 20, 22, 0.18);
  pointer-events: none;
}
.amount {
  position: relative; z-index: 1;
  height: 38px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--grigio);
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: color 0.25s;
}
.amount[aria-checked="true"] { color: var(--inchiostro); }
.amount--custom { display: flex; align-items: center; justify-content: center; gap: 1px; cursor: text; }
.amount__ph { font-size: 13px; font-weight: 560; }
.amount__cur { display: none; color: var(--inchiostro); }
.amount--custom.is-open .amount__ph { display: none; }
.amount--custom.is-open .amount__cur { display: inline; }
.amount__input {
  width: 0; min-width: 0;
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--inchiostro);
  text-align: left;
}
.amount--custom.is-open .amount__input { width: 2.2ch; }

/* the button: it sits in a box of fixed size, so folding it into a circle never moves the card */
.cta { position: relative; height: 50px; margin-top: clamp(10px, 2.8vmin, 14px); display: grid; place-items: center; }
.topup {
  position: relative;
  width: 100%; height: 50px;
  border: 0; border-radius: 999px;
  background: var(--inchiostro);
  color: #fff;
  font: inherit; font-size: 15px; font-weight: 620;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 22px -12px rgba(20, 20, 22, 0.55);
}
.topup__label { display: inline-flex; align-items: center; gap: 0.32em; white-space: nowrap; }
.topup__ring {
  position: absolute; left: 50%; top: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  fill: none; stroke-width: 2.2; stroke-linecap: round;
  opacity: 0;
}
.topup__ring circle { stroke: rgba(255, 255, 255, 0.22); }
.topup__ring path { stroke: #fff; }
.topup__done {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  opacity: 0;
}
.topup__done svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }

.meta { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: clamp(10px, 2.6vmin, 14px); font-size: 11.5px; color: var(--grigio); }
.meta svg { flex: none; width: 15px; height: 15px; fill: none; stroke: var(--grigio-chiaro); stroke-width: 1.6; }
.meta__text { display: inline-block; height: 1.3em; line-height: 1.3em; overflow: hidden; white-space: nowrap; }
.meta__text span { display: block; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.pointer {
  position: absolute; left: 0; top: 0;
  width: 20px; height: 20px;
  fill: #111; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}

@media (hover: hover) {
  .amount:not([aria-checked="true"]):hover { color: var(--inchiostro); }
  .topup:hover { background: #26262a; }
}
