:root {
  --fondo: #fafafa;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #6f6f77;
  --grigio-chiaro: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.09);
  --traccia: #f0f0f2;
  --foto: #4f46e5;
  --video: #8b5cf6;
  --documenti: #0ea5b7;
  --altro: #b4b4bc;
  --spunta: #1f9d55;
}

* { box-sizing: border-box; margin: 0; padding: 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 ---------- */
.store {
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(16px, 4.4vmin, 24px);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 22px 54px -22px rgba(17, 17, 19, 0.2);
}

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

.store__mark {
  flex: none;
  width: 34px; height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--inchiostro);
  fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round;
}

.store__title { flex: 1; min-width: 0; }
.store__name { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.store__sub { font-size: 12.5px; color: var(--grigio); margin-top: 1px; white-space: nowrap; }
.store__sub span:first-child { color: var(--grigio-chiaro); }

.store__cap {
  font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap;
}
.store__of { display: block; font-weight: 450; font-size: 11.5px; color: var(--grigio); }

.store__body {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(14px, 4vw, 26px);
  margin: clamp(14px, 3.6vmin, 22px) 0 clamp(12px, 3vmin, 18px);
}

/* ---------- the ring ---------- */
.ring {
  position: relative;
  width: clamp(112px, min(31vw, 30vh), 164px);
  aspect-ratio: 1;
}

.ring__svg { width: 100%; height: 100%; overflow: visible; display: block; }

.ring__track { fill: none; stroke: var(--traccia); stroke-width: 15; }

.seg {
  fill: none;
  stroke-width: 15;
  stroke-linecap: butt;
  cursor: pointer;
}

.ring__center {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  text-align: center;
  pointer-events: none;
}

.ring__big { height: 1.15em; overflow: hidden; font-size: clamp(20px, min(6vw, 6vh), 27px); }
.ring__val {
  display: block;
  font-weight: 680;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}
.ring__small { font-size: 11.5px; color: var(--grigio); margin-top: 1px; white-space: nowrap; }

/* ---------- the legend ---------- */
.legend { list-style: none; display: grid; gap: clamp(8px, 2.2vmin, 12px); min-width: 0; }

.row { cursor: default; transition: opacity 0.25s ease; }
.row__top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.2; }
.row__name { font-weight: 540; color: #3a3a40; white-space: nowrap; }
.row__val { font-variant-numeric: tabular-nums; color: var(--grigio); white-space: nowrap; }

.row__bar {
  position: relative;
  height: 4px;
  margin-top: 6px;
  border-radius: 4px;
  background: var(--traccia);
  overflow: hidden;
}
.row__fill {
  position: absolute; inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  transform-origin: left center;
  transform: scaleX(0);
}

.legend.is-focus .row:not(.is-on) { opacity: 0.4; }
.row.is-on .row__name { color: var(--inchiostro); }
.row.is-on .row__val { color: var(--inchiostro); }

/* ---------- the footer ---------- */
.store__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: clamp(12px, 3vmin, 16px);
  border-top: 1px solid var(--bordo);
}
.store__free { font-size: 12.5px; color: var(--grigio); font-variant-numeric: tabular-nums; white-space: nowrap; }

.up {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 14px 0 16px;
  border: 1px solid var(--inchiostro);
  border-radius: 999px;
  background: var(--inchiostro);
  color: #fff;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px -8px rgba(17, 17, 19, 0.55);
  transition: background 0.25s ease, border-color 0.25s ease;
}
.up:focus-visible { outline: 2px solid var(--foto); outline-offset: 2px; }
.up.is-done { background: var(--spunta); border-color: var(--spunta); box-shadow: 0 8px 18px -8px rgba(31, 157, 85, 0.6); }

.up__roll { position: relative; display: grid; height: 1.25em; overflow: hidden; }
.up__txt { grid-area: 1 / 1; display: block; line-height: 1.25; white-space: nowrap; }
.up__txt--b { visibility: hidden; }

.up__ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.up__check { stroke-dasharray: 14; stroke-dashoffset: 14; }

/* ---------- the drawn pointer ---------- */
.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 360px) {
  .row__top { font-size: 12px; }
  .store__sub { font-size: 11.5px; }
  .up { padding: 0 12px 0 13px; font-size: 12.5px; }
}
