:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: rgba(20, 22, 26, 0.08);
  --linea: #eeeff1;
  --testo: #15171a;
  --testo-2: #6b7079;
  --testo-3: #a4a8b0;
  --elimina: #e5372f;        /* the one strong colour: Delete, as it fills */
  --elimina-tenue: #fbe7e5;  /* Delete before it is pulled far */
  --archivia: #34383f;       /* Archive, a dark neutral */
  --archivia-tenue: #eceef1;
  --fissa: #8a8f98;          /* Pin, a lighter neutral */
  --fissa-tenue: #f1f2f4;
  --avviso: #17191d;         /* the Undo toast */
  --mano: #15171a;           /* the drawn pointer */
}

* { box-sizing: border-box; margin: 0; padding: 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;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vh, 28px) 12px;
}
.wrap { position: relative; width: min(380px, 100%); }

/* ---- the card ---- */
.card {
  --rh: clamp(52px, 11.6vh, 68px);
  position: relative;
  width: 100%;
  background: var(--carta);
  border-radius: 22px;
  padding: 4px 0 6px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 2px rgba(20, 22, 26, 0.04),
    0 12px 28px -14px rgba(20, 22, 26, 0.16),
    0 40px 70px -38px rgba(20, 22, 26, 0.24);
}
.card::before {
  content: "";
  position: absolute; inset: 0 18px auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  pointer-events: none;
}

.head {
  display: flex; align-items: center; gap: 8px;
  height: clamp(42px, 11vh, 58px);
  padding: 0 12px 0 18px;
}
.head__title { font-size: clamp(17px, 4.6vh, 20px); font-weight: 650; font-stretch: 104%; letter-spacing: -0.015em; }
.head__count { font-size: 12.5px; color: var(--testo-3); font-variant-numeric: tabular-nums; margin-top: 2px; }
.head__new {
  margin-left: auto; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; color: var(--testo-2);
  transition: background-color .2s, transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.head__new svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.head__new:active { transform: scale(.92); }
@media (hover: hover) { .head__new:hover { background: #f3f4f6; color: var(--testo); } }

.list { position: relative; height: calc(var(--rh) * 5); }

/* ---- a row: the actions underneath, the face on top ---- */
.row { position: relative; height: var(--rh); overflow: hidden; }
.row:not(.is-top) .face::before {
  content: ""; position: absolute; top: 0; left: 70px; right: 0; height: 1px; background: var(--linea);
}
.under { position: absolute; inset: 0; }
.act {
  position: absolute; top: 0; bottom: 0; width: 0;
  overflow: hidden; color: var(--testo-2);
  outline: none;
}
.act__fill { position: absolute; inset: 0; opacity: 0; }
.act--pin { left: 0; background: var(--fissa-tenue); }
.act--pin .act__fill { background: var(--fissa); }
.act--archive { right: 0; background: var(--archivia-tenue); }
.act--archive .act__fill { background: var(--archivia); }
.act--delete { right: 0; background: var(--elimina-tenue); }
.act--delete .act__fill { background: var(--elimina); }
.act__in {
  position: absolute; top: 50%; left: 0;
  width: 60px; margin-top: -19px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--testo-2);
  will-change: transform;
}
.act__in svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.act__label { font-size: 11px; font-weight: 560; letter-spacing: .01em; font-stretch: 96%; white-space: nowrap; }
.bin__lid { transform-box: fill-box; transform-origin: 85% 100%; }
.box__lid { transform-box: fill-box; transform-origin: 50% 100%; }
.pin__head { transform-box: view-box; transform-origin: 50% 50%; }
.act:focus-visible { box-shadow: inset 0 0 0 2px rgba(20, 22, 26, .35); }

.face {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px 0 18px;
  background: var(--carta);
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
  outline: none;
  will-change: transform;
}
.face::after {
  /* the soft edge shadow the face casts on the actions while it is pulled */
  content: ""; position: absolute; top: 0; bottom: 0; width: 18px; pointer-events: none;
  opacity: var(--edge, 0);
  right: -18px;
  background: linear-gradient(90deg, rgba(20, 22, 26, .10), rgba(20, 22, 26, 0));
}
.face.is-right::after { right: auto; left: -18px; background: linear-gradient(270deg, rgba(20, 22, 26, .10), rgba(20, 22, 26, 0)); }
.face.is-grab { cursor: grabbing; }
.face:focus-visible { box-shadow: inset 0 0 0 2px rgba(20, 22, 26, .22); }
@media (hover: hover) { .face:hover { background: #fafafb; } .face.is-grab:hover { background: var(--carta); } }

.ava {
  flex: none; width: clamp(36px, 9.2vh, 42px); height: clamp(36px, 9.2vh, 42px); border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ava); color: var(--ava-ink);
  font-size: 13px; font-weight: 640; letter-spacing: .02em; font-stretch: 108%;
  box-shadow: inset 0 0 0 1px rgba(20, 22, 26, .05), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.ava svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.txt__top { display: flex; align-items: center; gap: 6px; }
.txt__name { font-size: 14.5px; font-weight: 540; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txt__time { margin-left: auto; flex: none; font-size: 12px; color: var(--testo-3); font-variant-numeric: tabular-nums; }
.txt__prev { font-size: 13px; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txt__prev { display: block; }
.txt__ico { display: inline-block; vertical-align: -2px; margin-right: 5px; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.is-unread .txt__name { font-weight: 680; }
.is-unread .txt__prev { color: var(--testo); }
.is-unread .txt__time { color: var(--testo); font-weight: 560; }
.pinned { flex: none; width: 13px; height: 13px; fill: var(--testo-3); opacity: 0; transform: scale(.4) rotate(-30deg); }

/* ---- the empty state and the toast ---- */
.empty {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 14px; color: var(--testo-2); opacity: 0; pointer-events: none;
}
.empty svg { width: 26px; height: 26px; fill: none; stroke: var(--testo-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty.is-on { pointer-events: auto; }
.empty__btn { font-size: 13px; font-weight: 580; padding: 7px 14px; border-radius: 999px; background: #f2f3f5; color: var(--testo); }
.empty__btn:active { transform: scale(.96); }

.toast {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  height: calc(var(--rh) - 12px); max-height: 50px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 6px 0 16px;
  border-radius: 14px;
  background: var(--avviso); color: #f4f5f7;
  font-size: 13.5px; font-weight: 520;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  box-shadow: 0 10px 24px -10px rgba(20, 22, 26, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.toast__text { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.toast__sep { color: rgba(255, 255, 255, .4); }
.toast__undo {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px 0 11px; border-radius: 10px;
  font-weight: 640; color: #fff; background: rgba(255, 255, 255, .1);
  transition: background-color .2s, transform .18s cubic-bezier(.3, 1.6, .5, 1);
}
.toast__undo svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.toast__undo:active, .toast__undo.is-press { transform: scale(.94); background: rgba(255, 255, 255, .2); }
@media (hover: hover) { .toast__undo:hover { background: rgba(255, 255, 255, .17); } }
.toast__undo:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: 1px; }
.toast__fuse {
  position: absolute; left: 16px; right: 16px; bottom: 5px; height: 1.5px; border-radius: 1px;
  background: rgba(255, 255, 255, .5);
  transform-origin: 0 50%; transform: scaleX(0);
}

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

@media (max-width: 360px) {
  .face { padding: 0 12px 0 14px; gap: 10px; }
  .row:not(.is-top) .face::before { left: 60px; }
  .txt__name { font-size: 14px; }
}
