:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --testo: #18181b;
  --testo-2: #6b6b73;
  --testo-3: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.1);
  --riga: rgba(17, 17, 19, 0.07);
  --accento: #e5484d;
  --accento-tenue: #fdeeee;
  --accento-velo: rgba(229, 72, 77, 0.045);
  --focus: #6d5efc;
}

* { 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;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* the panel: a card on its own, no page around it */
.panel {
  width: min(440px, calc(100vw - 32px));
  background: var(--carta);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--bordo), 0 1px 2px rgba(17, 17, 19, 0.04), 0 18px 40px -24px rgba(17, 17, 19, 0.35);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--riga);
  font-size: 14px;
}
.panel__mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #f4f4f5;
}
.panel__mark svg { width: 14px; height: 14px; fill: none; stroke: var(--testo-2); stroke-width: 1.6; stroke-linecap: round; }
.panel__title { font-weight: 620; font-stretch: 104%; }
.panel__place { color: var(--testo-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* one line high: the old count leaves before the new one comes in */
.panel__count {
  margin-left: auto;
  height: 18px;
  overflow: hidden;
  flex: none;
  color: var(--testo-2);
  font-size: 12.5px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.panel__count > span { display: block; }

/* the rows are placed by GSAP (y), the list keeps the height of all of them */
.list {
  position: relative;
  list-style: none;
}

.note {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 66px;
  padding: 0 10px 0 16px;
  background: var(--carta);
  will-change: transform;
}
/* the hairline between rows belongs to the row, so it travels with it */
.note::after {
  content: "";
  position: absolute;
  left: 60px;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--riga);
}
.note[data-last]::after { opacity: 0; }

/* the pinned rows get a faint warm veil, never a dot */
.note__veil {
  position: absolute;
  inset: 0;
  background: var(--accento-velo);
  opacity: 0;
  pointer-events: none;
}

/* the lifted shadow while the row travels up */
.note__lift {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  box-shadow: 0 14px 28px -14px rgba(17, 17, 19, 0.35), 0 0 0 1px rgba(17, 17, 19, 0.06);
  opacity: 0;
  pointer-events: none;
}

.note__avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--av);
  color: var(--avt);
  font-size: 11.5px;
  font-weight: 640;
  letter-spacing: 0.02em;
}

.note__body { position: relative; flex: 1; min-width: 0; display: grid; gap: 2px; }
.note__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.note__title {
  font-size: 14.5px;
  font-weight: 590;
  font-stretch: 102%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note__text {
  font-size: 13px;
  color: var(--testo-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note__time {
  position: relative;
  flex: none;
  align-self: flex-start;
  margin-top: 15px;
  font-size: 12px;
  color: var(--testo-3);
  font-variant-numeric: tabular-nums;
}

/* the Pinned tag: GSAP owns its transform and opacity */
.tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accento-tenue);
  color: var(--accento);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.01em;
  opacity: 0;
  visibility: hidden;
}

/* the Pin button: a round ghost button with the pushpin drawn inside */
.pinbtn {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--testo-2);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
.pinbtn:focus { outline: none; }
.pinbtn:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--focus); }
/* the round background: its own layer, so GSAP can grow it without touching the icon */
.pinbtn__bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #f4f4f5;
  transform: scale(0);
  pointer-events: none;
}
.pinbtn[aria-pressed="true"] .pinbtn__bg { background: var(--accento-tenue); }

@media (hover: hover) {
  .pinbtn:hover .pinbtn__bg { transform: scale(1); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
}

.pin-ico {
  position: relative;
  width: 22px;
  height: 22px;
  overflow: visible;
}
.pin-ico .pin { color: inherit; }
.pin-ico .pin__cap,
.pin-ico .pin__body {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.pin-ico .pin__needle { stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.pin-ico .pin__shine { fill: none; stroke: #ffffff; stroke-width: 1; stroke-linecap: round; opacity: 0; }
.pin-ico .pin__shadow { fill: rgba(17, 17, 19, 0.28); }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #18181b;
  stroke: #ffffff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (max-height: 460px) {
  .note { height: 58px; }
  .panel__head { height: 44px; }
}

@media (max-width: 380px) {
  .note__time { display: none; }
  .panel__place { display: none; }
}
