:root {
  --fondo: #ffffff;
  --inchiostro: #15181a;
  --grigio: #8a8f93;
  --nuvola: #a9aeb2;
  --verde: #1f8a57;
  --verde-scuro: #0f5634;
  --verde-chiaro: #e8f5ed;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the frame: the pill on top, the order total below, room between them for the cost's arc */
.frame {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  width: min(330px, 94vw);
  height: min(146px, 40vh);
  padding-top: 10px;
}

/* the pill: the button for GSAP (scale, y), the shell for the swell, the layers inside for CSS */
.s {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 9px 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--inchiostro);
  font: inherit;
  text-align: left;
  cursor: pointer;
  isolation: isolate;
  max-width: 94vw;
  -webkit-tap-highlight-color: transparent;
}
.s:focus-visible { outline: none; }
.s:focus-visible .s__shell { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--verde); }

/* the soft layered shadow, on its own layer so the press can lower it */
.s__shadow {
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: 999px;
  pointer-events: none;
  box-shadow:
    0 1px 1px rgba(21, 24, 26, 0.06),
    0 3px 6px -2px rgba(21, 24, 26, 0.07),
    0 12px 24px -10px rgba(21, 24, 26, 0.16),
    0 28px 44px -26px rgba(15, 86, 52, 0.28);
}

.s__shell {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 999px;
  overflow: hidden;
  pointer-events: none;
}
.s__skin, .s__fill, .s__glow, .s__sheen, .s__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.s__skin { background: linear-gradient(180deg, #ffffff 0%, #fbfbfa 55%, #f3f4f3 100%); }
/* the pale green that spreads from the leaf */
.s__fill {
  background:
    radial-gradient(90% 140% at 12% 0%, rgba(255, 255, 255, 0.9), transparent 60%),
    linear-gradient(180deg, #f2faf5 0%, var(--verde-chiaro) 70%, #dcefe3 100%);
  clip-path: circle(0px at 30px 50%);
}
.s__glow {
  opacity: 0;
  background: radial-gradient(110px 70px at var(--gx, 50%) var(--gy, 50%), rgba(31, 138, 87, 0.07), transparent 70%);
}
.s__sheen {
  opacity: 0;
  background: linear-gradient(100deg, transparent 34%, rgba(255, 255, 255, 0.95) 48%, transparent 62%);
  background-size: 260% 100%;
  background-position: 120% 0;
}
/* the 1px edge: darker at the bottom, catching the light at the top */
.s__edge {
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(21, 24, 26, 0.07), rgba(21, 24, 26, 0.16)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  box-shadow: inset 0 1px 0 #fff;
}
.s__edge--on {
  opacity: 0;
  background: linear-gradient(180deg, rgba(31, 138, 87, 0.22), rgba(15, 86, 52, 0.42)) border-box;
}

/* the icon, free inside the pill: the cloud of CO2, the specks, the leaf */
.s__icon {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
}
.s__icon svg {
  position: absolute;
  inset: -4px;
  width: 42px;
  height: 42px;
  overflow: visible;
}
.cloud__body {
  fill: #eceeef;
  stroke: var(--nuvola);
  stroke-width: 1.3;
  stroke-linejoin: round;
}
.cloud__line { fill: none; stroke: var(--nuvola); stroke-width: 1.2; stroke-linecap: round; opacity: 0.7; }
.leaf__body {
  fill: rgba(31, 138, 87, 0.16);
  stroke: var(--verde);
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.leaf__vein, .leaf__stem { fill: none; stroke: var(--verde); stroke-width: 1.2; stroke-linecap: round; }
.leaf__vein { opacity: 0.75; }
[data-leaf] { opacity: 0; }
[data-dust] circle { fill: var(--nuvola); }

.s__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}
.s__labels {
  position: relative;
  display: block;
  height: 20px;
  overflow: hidden;
}
.s__label {
  position: absolute;
  left: 0;
  top: 0;
  width: max-content;
  height: 20px;
  line-height: 20px;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  font-variation-settings: "wdth" 100;
  letter-spacing: -0.01em;
  opacity: 0;
}
.s__label[data-l="idle"] { opacity: 1; }
.s__label[data-l="done"] { color: var(--verde-scuro); }
.s__sub {
  font-size: 12px;
  line-height: 15px;
  font-weight: 480;
  color: var(--grigio);
  white-space: nowrap;
  font-feature-settings: "tnum" 1;
}
.s__sub sub { font-size: 0.72em; vertical-align: -0.18em; line-height: 0; }

/* the cost chip, sunk into the pill; it turns green with a tick */
.s__chip {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  height: 40px;
  padding: 0 12px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 640;
  font-variation-settings: "wdth" 104;
  font-feature-settings: "tnum" 1;
  isolation: isolate;
}
.chip__skin {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #eef0ef, #f6f7f6);
  box-shadow: inset 0 1px 2px rgba(21, 24, 26, 0.12), inset 0 0 0 1px rgba(21, 24, 26, 0.05), 0 1px 0 #fff;
}
.chip__skin--on {
  opacity: 0;
  background: linear-gradient(180deg, #27a066 0%, var(--verde) 55%, #187248 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 2px 6px -2px rgba(15, 86, 52, 0.45);
}
.chip__price, .chip__check { grid-area: 1 / 1; }
.chip__check {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the wheels: every digit is a column of 0-9 and a blank, moved with yPercent */
.odo {
  display: inline-flex;
  height: 1.2em;
  line-height: 1.2em;
  overflow: hidden;
  white-space: nowrap;
}
.odo__ch { display: inline-block; }
.odo__col { display: inline-block; overflow: hidden; height: 1.2em; text-align: center; }
.odo__stack { display: block; }
.odo__stack > span { display: block; height: 1.2em; }

/* the order total under the pill */
.note {
  position: absolute;
  left: 0;
  right: 0;
  top: 104px;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 480;
  color: var(--grigio);
  white-space: nowrap;
}
.note__total {
  color: var(--inchiostro);
  font-weight: 660;
  font-size: 15px;
  font-variation-settings: "wdth" 108;
  font-feature-settings: "tnum" 1;
}

/* the cost that travels: placed by the script over the chip, then over the total */
.token {
  position: absolute;
  z-index: 3;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 660;
  font-variation-settings: "wdth" 104;
  font-feature-settings: "tnum" 1;
  color: var(--verde-scuro);
  white-space: nowrap;
  isolation: isolate;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 1px 1px rgba(15, 86, 52, 0.1), 0 8px 16px -8px rgba(15, 86, 52, 0.45);
}
.token__skin {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, #f3fbf6, #d9efe2);
  box-shadow: inset 0 0 0 1px rgba(15, 86, 52, 0.14), inset 0 1px 0 #fff;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 400px) {
  .s { height: 58px; gap: 9px; padding: 0 8px 0 12px; }
  .s__label { font-size: 14.5px; }
  .s__chip { height: 38px; padding: 0 11px; font-size: 13px; margin-left: 2px; }
  .note { top: 100px; }
}
