:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #e8e8ec;
  --bordo-2: #dcdce3;
  --tinta: #f6f6f8;          /* the row under the pointer, the icon tiles */
  --testo: #131317;
  --testo-2: #5c5b66;
  --testo-3: #9d9ca8;
  --accento: #0f8a68;        /* the single accent: the bookmark, the New tag, the light on the new memory */
  --accento-chiaro: #e7f5f0;
  --ombra: 20, 24, 30;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(11px, min(3.9vw, 3.5vh), 18px); }
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; }

.stage { position: relative; height: 100vh; display: grid; place-items: center; padding: 3vh 4vw; }
.frame { position: absolute; left: 50%; top: 50%; width: min(25em, 92vw); height: 21em; transform: translate(-50%, -50%); pointer-events: none; }
.chat { width: min(25em, 92vw); display: grid; gap: .75em; }

/* the answer */
.msg { display: flex; gap: .6em; align-items: flex-start; }
.msg p { font-size: .9em; line-height: 1.45; padding-top: .18em; }
.msg__who {
  flex: none; width: 1.75em; height: 1.75em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--testo);
}
.msg__who svg { width: 1.05em; height: 1.05em; display: block; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; }

/* the memory: a pill that becomes a card */
.memwrap { padding-left: 2.35em; }
.mem {
  position: relative;
  width: max-content;
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 999px;
  overflow: hidden;
  box-shadow:
    0 1px 1px rgba(var(--ombra), .04),
    0 4px 10px -5px rgba(var(--ombra), .09),
    0 14px 30px -20px rgba(var(--ombra), .2);
  transform-origin: 0 0;
}
.mem__light {
  position: absolute; top: 0; bottom: 0; left: -60%; width: 60%; pointer-events: none; z-index: 3;
  background: linear-gradient(100deg, transparent, rgba(15, 138, 104, .12) 45%, rgba(255, 255, 255, .7) 50%, rgba(15, 138, 104, .12) 55%, transparent);
}

.pill {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: auto auto; align-items: center; gap: .45em;
  height: 2.2em; padding: 0 .95em 0 .55em;
  font-size: .8em; font-weight: 560; color: var(--testo-2);
  white-space: nowrap;
  border-radius: 999px;
}
.pill:focus-visible { outline: 2px solid var(--accento); outline-offset: -2px; }
@media (hover: hover) { .pill:hover { color: var(--testo); } }
.pill__ico { width: 1.45em; height: 1.45em; display: grid; place-items: center; border-radius: 50%; background: var(--accento-chiaro); }
.pill__ico svg { width: 1em; height: 1em; display: block; fill: none; stroke: var(--accento); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bm { stroke-dasharray: 1 1; stroke-dashoffset: 0; }

/* the card sits inside the same box; the box changes size around it */
.card {
  position: absolute; left: 0; top: 0; z-index: 1;
  visibility: hidden;
}
.card__head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .7em;
  padding: .8em .8em .7em .85em;
}
.card__ico { width: 2.1em; height: 2.1em; border-radius: .6em; display: grid; place-items: center; background: var(--accento-chiaro); }
.card__ico svg { width: 1.1em; height: 1.1em; display: block; fill: none; stroke: var(--accento); stroke-width: 1.6; stroke-linejoin: round; }
.card__title { display: grid; gap: .12em; min-width: 0; }
.card__title b { font-size: .9em; font-weight: 620; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.count { display: flex; align-items: center; gap: .3em; font-size: .72em; line-height: 1.25; color: var(--testo-3); font-variant-numeric: tabular-nums; }
.count__win { position: relative; display: block; flex: none; height: 1.25em; width: 1.1ch; overflow: hidden; color: var(--testo-2); font-weight: 600; }
.count__win span { position: absolute; left: 0; top: 0; line-height: 1.25; }
.count__lab { display: block; line-height: 1.25; }

.shut {
  width: 1.9em; height: 1.9em; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--bordo);
  transition: background-color .2s, border-color .2s;
}
.shut svg { width: .9em; height: .9em; display: block; fill: none; stroke: var(--testo-2); stroke-width: 1.6; stroke-linecap: round; }
@media (hover: hover) { .shut:hover { background: var(--tinta); border-color: var(--bordo-2); } }
.shut:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

.list { position: relative; display: grid; padding: 0 .4em; border-top: 1px solid var(--bordo); }
.row {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .55em;
  height: 3em; padding: 0 .5em 0 .55em;
  border-radius: .65em;
  overflow: hidden;
  transition: background-color .25s;
}
.row + .row::before { content: ""; position: absolute; left: .55em; right: .55em; top: 0; height: 1px; background: var(--bordo); }
.row.is-over { background: var(--tinta); }
.row.is-over::before, .row.is-over + .row::before { opacity: 0; }
@media (hover: hover) { .row:hover { background: var(--tinta); } .row:hover::before, .row:hover + .row::before { opacity: 0; } }
.row__light {
  position: absolute; top: 0; bottom: 0; left: -55%; width: 55%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(15, 138, 104, .14) 45%, rgba(255, 255, 255, .75) 50%, rgba(15, 138, 104, .14) 55%, transparent);
}
.row__main { display: grid; gap: .1em; min-width: 0; }
.row__txt { font-size: .84em; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__meta { font-size: .68em; color: var(--testo-3); white-space: nowrap; }
/* New and Forget share the same cell on the right: at rest the tag, on hover, focus or tap the button */
.row__new, .forget { grid-column: 2; grid-row: 1; justify-self: end; }
.row__new {
  display: none;
  transition: opacity .2s, transform .3s cubic-bezier(.3, 1.4, .6, 1);
}
.row__new > span {
  display: block;
  font-size: .64em; font-weight: 640; letter-spacing: .02em;
  color: var(--accento); background: var(--accento-chiaro);
  border: 1px solid rgba(15, 138, 104, .22);
  border-radius: 2em; padding: .18em .6em;
}
.row.is-new .row__new { display: block; }
.row.is-over .row__new, .row:focus-within .row__new { opacity: 0; transform: scale(.85); }

/* Forget: always there for the tab key, shown on hover, focus or tap */
.forget {
  position: relative;
  height: 1.9em; padding: 0 .75em; border-radius: 2em;
  display: grid; place-items: center;
  font-size: .72em; font-weight: 580; color: var(--testo-2);
  border: 1px solid var(--bordo-2); background: #fff;
  opacity: 0; transform: translateX(.4em);
  transition: opacity .22s, transform .32s cubic-bezier(.3, 1.5, .6, 1), color .2s, border-color .2s;
}
.forget span { pointer-events: none; }
.row.is-over .forget, .row:focus-within .forget { opacity: 1; transform: none; }
@media (hover: hover) {
  .row:hover .forget { opacity: 1; transform: none; }
  .row:hover .row__new { opacity: 0; transform: scale(.85); }
  .forget:hover { color: var(--testo); border-color: var(--testo-3); }
}
.forget:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

.card__foot { padding: .65em .95em .85em; font-size: .7em; line-height: 1.4; color: var(--testo-3); border-top: 1px solid var(--bordo); }
