:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #1a1715;
  --testo-2: #6a625c;
  --testo-3: #aaa29b;
  --linea: #eeeae6;
  --traccia: #f6f3f0;
  --accento: #b4432e;        /* the single accent: brick red, in the fill, the lid and the Undo ring */
  --accento-scuro: #96331f;
  --accento-velo: #fbefec;
  --ombra: 40, 24, 16;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(12px, min(3.5vw, 3.2vh), 17px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
ul { list-style: none; }

.stage { min-height: 100vh; display: grid; place-items: center; padding: 1em; }

/* ---- the cart ---- */
.cart {
  width: min(23em, 92vw);
  background: var(--carta);
  border: 1px solid var(--linea);
  border-radius: 1.25em;
  padding: 1.1em 1.15em 0.95em;
  box-shadow: 0 1px 2px rgba(var(--ombra), .04), 0 20px 44px -28px rgba(var(--ombra), .3);
}
.cart__head { display: flex; align-items: baseline; justify-content: space-between; }
.cart__title { font-weight: 650; font-size: 1.02em; font-stretch: 104%; }
.cart__count { color: var(--testo-3); font-size: .8em; font-variant-numeric: tabular-nums; }

.cart__body { position: relative; margin-top: .7em; height: 11.1em; overflow: hidden; }
.cart__list { display: grid; gap: .1em; }
.row { border-top: 1px solid var(--linea); }
.row:last-child { border-bottom: 1px solid var(--linea); }
.row__inner { display: flex; align-items: center; gap: .75em; padding: .55em 0; will-change: transform; }
.thumb {
  flex: none;
  width: 2.5em; height: 2.5em;
  border-radius: .7em;
  background: var(--traccia);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), .05);
  display: grid; place-items: center;
}
.thumb svg { width: 1.9em; height: 1.9em; fill: none; stroke: var(--testo-2); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.thumb__soft { stroke: var(--testo-3); }
.thumb__flame { stroke: var(--accento); }
.row__text { display: grid; line-height: 1.25; min-width: 0; }
.row__name { font-weight: 600; font-size: .9em; }
.row__var { color: var(--testo-3); font-size: .75em; }
.row__price { margin-left: auto; font-weight: 600; font-size: .86em; font-variant-numeric: tabular-nums; }

.empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: .3em;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.empty__bag { width: 2.6em; height: 2.6em; fill: none; stroke: var(--testo-3); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .2em; }
.empty__title { font-weight: 650; font-size: .95em; }
.empty__sub { color: var(--testo-3); font-size: .76em; }

.cart__sum { display: flex; justify-content: space-between; align-items: baseline; margin-top: .75em; font-size: .86em; color: var(--testo-2); }
.cart__total { color: var(--testo); font-weight: 650; font-variant-numeric: tabular-nums; }

.roll { display: inline-grid; overflow: hidden; vertical-align: -.28em; height: 1.3em; line-height: 1.3em; }
.roll__line { grid-area: 1 / 1; display: block; white-space: nowrap; }

/* ---- the pill ---- */
.pill-wrap { position: relative; margin-top: .75em; }
.pill {
  --p: 0;
  position: relative;
  display: block;
  width: 100%;
  height: 3.2em;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
}
.pill__face {
  position: absolute; inset: 0;
  display: grid;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accento-velo);
  box-shadow: inset 0 0 0 1px rgba(180, 67, 46, .18), 0 calc(8px - var(--p) * 6px) calc(18px - var(--p) * 12px) -12px rgba(180, 67, 46, .55);
  transition: box-shadow .25s ease;
}
.pill:focus-visible .pill__face { box-shadow: inset 0 0 0 1px rgba(180, 67, 46, .18), 0 0 0 3px rgba(180, 67, 46, .3); }
.pill__fill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #c95540, var(--accento) 55%, var(--accento-scuro));
  transform-origin: 0 50%;
  transform: scaleX(var(--p));
}
.pill__fill::after {
  content: "";
  position: absolute; top: 0; bottom: 0; right: 0;
  width: 1.6em;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.32));
  opacity: min(1, calc(var(--p) * 6), calc((1 - var(--p)) * 10));
}
.pill__label, .pill__done {
  grid-area: 1 / 1;
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: .45em;
  font-weight: 650;
  font-size: .98em;
  letter-spacing: -.005em;
  pointer-events: none;
}
.pill__label { color: var(--accento); font-stretch: calc(100% + var(--p) * 20%); }
.pill__label--on { color: #fff; clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0); }
.bin { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.pill__done { color: #fff; opacity: 0; font-stretch: 104%; }
.tick { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tick path { stroke-dasharray: 1; stroke-dashoffset: 1; }

@media (hover: hover) {
  .pill:hover .pill__face { box-shadow: inset 0 0 0 1px rgba(180, 67, 46, .32), 0 8px 18px -10px rgba(180, 67, 46, .55); }
}

.cart__foot { display: flex; align-items: center; justify-content: space-between; margin-top: .55em; font-size: .76em; min-height: 1.7em; }
.hint { color: var(--testo-3); }
.undo {
  display: inline-flex; align-items: center; gap: .4em;
  color: var(--testo-2);
  font-weight: 600;
  padding: .15em .1em;
  opacity: 0;
  pointer-events: none;
}
.undo.is-on { pointer-events: auto; }
.undo__ring { width: 1.25em; height: 1.25em; transform: rotate(-90deg); }
.undo__track { fill: none; stroke: var(--linea); stroke-width: 2; }
.undo__time { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (hover: hover) { .undo:hover { color: var(--accento); } }
