:root {
  --fondo: #ffffff;
  --inchiostro: #16161a;
  --grigio: #6d6d75;
  --grigio-chiaro: #a4a4ac;
  --linea: #ececef;
  --tessera: #f3f3f5;
  --accento: #1f8f5f;
  --accento-chiaro: #e3f3ea;
  --carta: #1c1d23;
  --carta-luce: #2c2e37;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: clamp(14px, min(1.3vw, 2.4vh), 20px); }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  display: grid;
  place-items: center;
}

.wrap {
  position: relative;
  width: min(25rem, calc(100vw - 28px));
}

/* ---- the notification ---- */
.note {
  position: relative;
  background: #fff;
  border: 1px solid rgba(22, 22, 26, 0.07);
  border-radius: 1.15rem;
  box-shadow: 0 1px 2px rgba(22, 22, 26, 0.04), 0 14px 34px -14px rgba(22, 22, 26, 0.22);
  outline: none;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 0.35s ease;
}
.note.is-open { box-shadow: 0 1px 2px rgba(22, 22, 26, 0.04), 0 22px 48px -18px rgba(22, 22, 26, 0.28); }
.note:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accento), 0 14px 34px -14px rgba(22, 22, 26, 0.22); }

.note__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 4.4rem;
  padding: 0 0.95rem 0 0.85rem;
}

.ico {
  position: relative;
  flex: none;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 0.8rem;
  background: var(--tessera);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ico svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: var(--inchiostro); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ico .box__tape { stroke: var(--accento); }
.ico__shine {
  position: absolute; inset: -20% auto -20% 0; width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-140%) skewX(-18deg);
}

.note__text { flex: 1; min-width: 0; }
.note__title { display: flex; align-items: baseline; gap: 0.45rem; white-space: nowrap; }
.note__head { font-weight: 640; font-size: 0.95rem; letter-spacing: -0.005em; }
.note__when { font-size: 0.72rem; color: var(--grigio-chiaro); }
.note__sub {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  color: var(--grigio);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note__sub b { font-weight: 600; color: var(--inchiostro); }

.note__money { flex: none; text-align: right; }
.amount {
  font-size: 0.98rem; font-weight: 650;
  color: var(--inchiostro);
  transition: color 0.4s ease;
}
.amount__sign { display: inline-block; opacity: 0; }
.amount.is-done { color: var(--accento); }
.state {
  margin-top: 0.15rem;
  display: flex; align-items: center; justify-content: flex-end; gap: 0.22rem;
  font-size: 0.68rem; color: var(--grigio-chiaro);
  white-space: nowrap;
}
.state__tick { width: 0.72rem; height: 0.72rem; fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: none; }
.state.is-done { color: var(--accento); }
.state.is-done .state__tick { display: block; }

/* ---- what opens below ---- */
.note__more { height: 0; opacity: 0; }

.track {
  position: relative;
  margin: 0.15rem 0.95rem 0;
  padding-top: 0.6rem;
  height: 5.4rem;
}
.track__line {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.track__base { fill: none; stroke: var(--linea); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 5; }
.track__done { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; }

.stops {
  list-style: none;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  height: 100%;
}
.stop {
  display: flex; flex-direction: column; align-items: center; gap: 0.42rem;
  width: 4.6rem;
}
.stop:first-child { align-items: flex-start; }
.stop:last-child { align-items: flex-end; }
.stop__dot {
  width: 1.45rem; height: 1.45rem; border-radius: 50%;
  background: #fff;
  border: 1.5px solid #dcdce2;
  display: grid; place-items: center;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.stop__dot svg { width: 0.72rem; height: 0.72rem; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stop.is-on .stop__dot { background: var(--accento); border-color: var(--accento); }
.stop__name { font-size: 0.7rem; color: var(--grigio-chiaro); white-space: nowrap; transition: color 0.3s ease; }
.stop.is-on .stop__name { color: var(--inchiostro); }

/* the card at the end of the track */
.card {
  position: relative;
  width: 3.4rem; height: 2.15rem;
  margin: -0.35rem 0 -0.35rem;
  border-radius: 0.38rem;
  background: linear-gradient(140deg, var(--carta-luce), var(--carta) 60%);
  box-shadow: 0 6px 14px -8px rgba(22, 22, 26, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.card__chip {
  position: absolute; left: 0.34rem; top: 0.52rem;
  width: 0.62rem; height: 0.46rem; border-radius: 0.12rem;
  background: linear-gradient(135deg, #d9c38b, #b39a5c);
}
.card__brand {
  position: absolute; right: 0.32rem; top: 0.28rem;
  font-size: 0.42rem; font-weight: 760; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.82);
}
.card__num {
  position: absolute; left: 0.34rem; bottom: 0.26rem;
  font-size: 0.48rem; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.7);
}
.card__plus {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 0.74rem; font-weight: 700; color: #fff;
  background: var(--accento);
  opacity: 0;
}
.card__shine {
  position: absolute; inset: -30% auto -30% 0; width: 40%; z-index: 2;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-160%) skewX(-18deg);
}

/* the parcel that runs along the track */
.parcel {
  position: absolute; left: 0; top: 0;
  width: 1.85rem; height: 1.85rem;
  margin: -0.92rem 0 0 -0.92rem;
  border-radius: 0.55rem;
  background: #fff;
  border: 1px solid rgba(22, 22, 26, 0.08);
  box-shadow: 0 8px 16px -8px rgba(22, 22, 26, 0.45);
  display: grid; place-items: center;
  opacity: 0;
  z-index: 3;
}
.parcel svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--inchiostro); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }

.note__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  margin: 0.15rem 0.95rem 0;
  padding: 0.75rem 0 0.85rem;
  border-top: 1px solid var(--linea);
}
.note__meta { font-size: 0.72rem; color: var(--grigio); line-height: 1.35; }
.receipt {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.32rem;
  height: 2rem; padding: 0 0.7rem 0 0.85rem;
  border: 0; border-radius: 999px;
  background: var(--inchiostro); color: #fff;
  font: inherit; font-size: 0.74rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 12px -8px rgba(22, 22, 26, 0.6);
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}
.receipt__arr { width: 0.85rem; height: 0.85rem; display: grid; place-items: center; overflow: hidden; }
.receipt__arr svg { width: 0.85rem; height: 0.85rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.receipt:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.receipt.is-hover { background: #2a2a30; box-shadow: 0 9px 16px -9px rgba(22, 22, 26, 0.7); }
@media (hover: hover) {
  .receipt:hover { background: #2a2a30; box-shadow: 0 9px 16px -9px rgba(22, 22, 26, 0.7); }
}

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

@media (max-width: 420px) {
  .note__row { gap: 0.6rem; padding: 0 0.75rem 0 0.7rem; }
  .note__when { display: none; }
  .track { margin: 0.15rem 0.75rem 0; }
  .note__foot { margin: 0.15rem 0.75rem 0; }
  .note__meta { font-size: 0.68rem; }
}
