:root {
  --fondo: #ffffff;
  --pillola: #16140f;
  --pillola-alta: #2a2620;
  --carta: #f6f1e7;
  --grigio: #8a847a;
  --grigio-scuro: #9d968b;
  --accento: #f0b13a;
  --accento-scuro: #c98a17;
  --inchiostro: #1a160e;
}

*, *::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: 24px 12px;
  overflow: hidden;
}

.frame {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 94vw;
  padding: 10px 4px;
}

/* the pill: GSAP animates its width and scale; the skin, grain, sheen and fill are CSS layers inside */
.pill {
  position: relative;
  height: 60px;
  width: 168px;
  max-width: 94vw;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  color: var(--carta);
  font-size: 16px;
  font-weight: 590;
  letter-spacing: -0.005em;
  box-shadow:
    0 1px 1px rgba(22, 20, 15, 0.18),
    0 6px 14px -6px rgba(22, 20, 15, 0.35),
    0 22px 40px -18px rgba(22, 20, 15, 0.45);
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.6s ease;
}
.pill.is-gold {
  box-shadow:
    0 1px 1px rgba(150, 96, 10, 0.2),
    0 8px 18px -8px rgba(201, 138, 23, 0.55),
    0 24px 44px -18px rgba(201, 138, 23, 0.5);
}
.pill__skin, .pill__grain, .pill__sheen, .pill__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.pill__skin {
  z-index: -3;
  background:
    radial-gradient(120% 140% at 50% -40%, var(--pillola-alta), transparent 62%),
    var(--pillola);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.pill__grain {
  z-index: -2;
  opacity: 0.1;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
}
.pill__sheen {
  z-index: 2;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.16) 48%, rgba(255, 255, 255, 0.05) 54%, transparent 64%);
  transform: translateX(-110%);
  mix-blend-mode: screen;
}
.pill__fill {
  z-index: -1;
  background:
    radial-gradient(120% 160% at 30% -50%, #ffd27a, transparent 60%),
    var(--accento);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(120, 72, 0, 0.25);
  opacity: 0;
}

.pill__go {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  border-radius: inherit;
  cursor: pointer;
}
.pill__go:focus-visible, .chip:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}
.layer--rest { opacity: 1; }
.pill__go .layer { pointer-events: none; }
.layer--bays { z-index: 3; }
.in {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  white-space: nowrap;
  font-variation-settings: "wdth" 100;
}
.txt { display: inline-flex; align-items: center; line-height: 22px; }
.txt b { font-weight: 680; }
.sep { margin: 0 0.42em; opacity: 0.5; }

/* the paper bag, drawn in strokes */
.bag {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.bag__body { fill: rgba(246, 241, 231, 0.08); }
.bag__fold { opacity: 0.45; }
.bag__handle { transform-box: fill-box; transform-origin: 50% 100%; }

/* the bays: small rounded chips, not dots */
.bays__q { color: var(--grigio-scuro); font-size: 14px; font-weight: 520; margin: 0 4px 0 10px; }
.chip {
  position: relative;
  width: 54px;
  height: 42px;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: var(--carta);
  font: inherit;
  font-weight: 640;
  border-radius: 13px;
  cursor: pointer;
  pointer-events: auto;
}
.layer--bays:not(.is-open) .chip { pointer-events: none; }
.chip__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 6px 12px -8px rgba(0, 0, 0, 0.8);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.chip__n { position: relative; display: block; line-height: 42px; }
@media (hover: hover) {
  .chip:hover .chip__bg {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
    box-shadow: inset 0 0 0 1px rgba(240, 177, 58, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 16px -8px rgba(0, 0, 0, 0.9);
  }
}

/* the ring that runs around the bag while it is brought out */
.ring-ico { position: relative; width: 32px; height: 32px; flex: none; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; width: 32px; height: 32px; transform: rotate(-90deg); fill: none; stroke-width: 1.8; }
.ring__track { stroke: rgba(26, 22, 14, 0.16); }
.ring__run { stroke: var(--inchiostro); stroke-linecap: round; stroke-dasharray: 88 88; stroke-dashoffset: 88; }
.bag--small { width: 18px; height: 18px; }
.bag--small .bag__body { fill: rgba(26, 22, 14, 0.08); }

.check { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.check__ring { opacity: 0.25; }
.check__tick { stroke-dasharray: 14 14; stroke-dashoffset: 14; stroke-width: 2; }

.note {
  position: relative;
  margin: 0;
  height: 18px;
  width: 100%;
  min-width: 290px;
  font-size: 13px;
  font-weight: 460;
  color: var(--grigio);
}
.note__t {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
}
.note__t[data-n="rest"] { opacity: 1; }

@media (max-width: 380px) {
  .pill { font-size: 15px; }
  .chip { width: 48px; }
  .bays__q { margin-left: 6px; }
  .note { font-size: 12px; min-width: 0; }
}
