:root {
  --fondo: #f2f2f2;
  --carta: #ffffff;
  --bordo: rgba(0, 0, 0, 0.07);
  --testo: #111113;
  --testo-2: #6e6e76;
  --testo-3: #a1a1aa;
  --pista: #18181b;
  --accento: #2f6bff;
  --accento-scuro: #1d3c94;
  --maniglia: #ffffff;
}

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

html, body { height: 100%; }

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.card {
  width: min(380px, 100%);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 24px;
  padding: clamp(16px, 4.2vmin, 22px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 18px 40px -18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 3vh, 18px);
}

.card__head { display: flex; align-items: center; gap: 12px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: #3a3a40;
  background: linear-gradient(140deg, #eef1f7, #dfe3ec);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.who__name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.who__meta { font-size: 12.5px; color: var(--testo-2); margin-top: 2px; }

.sum__label { position: relative; height: 16px; font-size: 12.5px; color: var(--testo-2); }
.sum__state { position: absolute; left: 0; top: 0; white-space: nowrap; }
.sum__state--done { opacity: 0; color: var(--accento); font-weight: 550; }

.sum__amount {
  font-size: clamp(30px, 8.5vmin, 38px);
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  line-height: 1.05;
}

.sum__note { font-size: 12.5px; color: var(--testo-3); margin-top: 4px; }

.slot { position: relative; display: flex; justify-content: center; height: 60px; }

.pill {
  position: relative;
  width: 100%;
  height: 60px;
  border-radius: 999px;
  background: var(--pista);
  overflow: hidden;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 16px -10px rgba(0, 0, 0, 0.5);
}

.pill:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accento); }

.pill__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 60px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accento-scuro), var(--accento) 75%);
  opacity: 0;
}

.pill__label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding-left: 44px;
  font-size: 15px; font-weight: 550; letter-spacing: -0.005em;
  white-space: nowrap;
  color: transparent;
  background-image: linear-gradient(100deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.42) 40%, rgba(255,255,255,1) 50%, rgba(255,255,255,0.42) 60%, rgba(255,255,255,0.42) 100%);
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
}

.handle {
  position: absolute; left: 5px; top: 5px;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--maniglia);
  display: grid; place-items: center;
  cursor: grab;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 4px 10px -2px rgba(0, 0, 0, 0.35);
  will-change: transform;
}

.handle svg { grid-area: 1 / 1; width: 22px; height: 22px; fill: none; stroke: var(--pista); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.handle__spin { opacity: 0; }
.handle__spin circle { stroke: var(--accento); stroke-dasharray: 32 60; }

.pill__done {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -0.005em;
  opacity: 0; pointer-events: none;
}

.pill__check {
  width: 22px; height: 22px;
  fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
}

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

@media (hover: hover) {
  .handle:hover { box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 6px 14px -2px rgba(0, 0, 0, 0.42); }
}

.dragging .handle { cursor: grabbing; }
