:root {
  --fondo: #f2f2f2;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #71717a;
  --grigio-chiaro: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.08);
  --pillola: #f4f4f5;
  --accento: #4f46e5;
  --tazza-a: #e6e2dc;
}

* { box-sizing: border-box; margin: 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: 16px;
}

/* the card: a white surface with a hairline border and a soft wide shadow */
.cart {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 18px 40px -22px rgba(17, 17, 19, 0.28);
  overflow: hidden;
}

.cart__body { padding: clamp(12px, 3.4vmin, 16px); }

.item {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vmin, 14px);
}

/* the product picture: a real photo of a stoneware mug, cropped square with soft corners */
.item__thumb {
  position: relative;
  flex: none;
  width: clamp(48px, 13vmin, 60px);
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--tazza-a);
  overflow: hidden;
}
.item__photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
  display: block;
}
.item__thumb::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 19, 0.06);
  pointer-events: none;
}
.item__shine {
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
}

.item__text { flex: 1; min-width: 0; }
.item__name { font-size: clamp(13px, 3.6vmin, 15px); font-weight: 600; letter-spacing: -0.01em; }
.item__meta { font-size: 12px; color: var(--grigio); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__price { font-size: 12px; color: var(--grigio-chiaro); margin-top: 3px; }

/* the stepper: a pill with two round keys and the rolling digit */
.stepper {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--pillola);
  border: 1px solid var(--bordo);
}

.step {
  position: relative;
  width: 32px; height: 32px;
  border: 0; padding: 0;
  background: none;
  color: var(--inchiostro);
  cursor: pointer;
  display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.step:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; border-radius: 999px; }
.step__face {
  position: absolute; inset: 0;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 1px 1px rgba(17, 17, 19, 0.06), 0 2px 6px -2px rgba(17, 17, 19, 0.18);
}
.step__icon {
  position: relative;
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.step__icon--bin, .step__icon--minus { position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -9px; }
.step__icon--bin { opacity: 0; }

.qty {
  position: relative;
  min-width: 30px;
  height: 22px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
 
  line-height: 22px;
}

/* rolling characters: one slot per character, the new one slides over the old */
.slot { position: relative; display: inline-block; overflow: hidden; height: 1.3em; line-height: 1.3em; vertical-align: top; }
.slot__c { display: block; }
.slot__c + .slot__c { position: absolute; left: 0; top: 0; }

.cart__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(12px, 3.4vmin, 16px);
  padding-top: clamp(10px, 3vmin, 14px);
  border-top: 1px solid var(--bordo);
}
.hint { font-size: 12px; color: var(--grigio); min-width: 0; }
.roll { position: relative; display: inline-block; overflow: hidden; vertical-align: top; height: 1.35em; line-height: 1.35em; white-space: nowrap; }
.roll__in { display: block; }
.roll__in + .roll__in { position: absolute; left: 0; top: 0; }
.total { font-size: 13px; color: var(--grigio); white-space: nowrap; }
.total__num { display: inline-flex; color: var(--inchiostro); font-weight: 600; font-size: 15px; }

/* the line left behind when the item is removed */
.removed {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 13px;
  color: var(--grigio);
  opacity: 0;
  visibility: hidden;
}
.undo {
  border: 0;
  background: var(--pillola);
  color: var(--inchiostro);
  font: inherit;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
@media (hover: hover) {
  .undo:hover { background: #e9e9ec; }
  .step:hover .step__face { box-shadow: 0 1px 1px rgba(17, 17, 19, 0.08), 0 4px 10px -3px rgba(17, 17, 19, 0.24); }
}

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

@media (max-width: 380px) {
  .item__meta { display: none; }
  .step { width: 30px; height: 30px; }
  .qty { min-width: 24px; }
}
