:root {
  --fondo: #ffffff;
  --isola: #0b0b0d;
  --carta: #f4f3ef;
  --grigio: #8d8c93;
  --linea: rgba(255, 255, 255, 0.09);
  --accento: #4fd98a;
  --accento-scuro: #0b2a17;
  --avena: #e8c98f;
  --mandorla: #d9a77a;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--carta);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the frame keeps the room of the open card, so nothing around it moves */
.frame {
  position: relative;
  width: min(372px, calc(100vw - 32px));
  height: min(250px, 64vh);
}

/* swipe: GSAP moves it sideways; island: GSAP sets its size; the layers inside belong to CSS */
.swipe {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  display: flex;
  justify-content: center;
  touch-action: pan-y;
  will-change: transform;
}

.island {
  position: relative;
  width: 252px;
  height: 40px;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  box-shadow:
    0 1px 1px rgba(10, 10, 12, 0.08),
    0 4px 10px -4px rgba(10, 10, 12, 0.18),
    0 18px 38px -14px rgba(10, 10, 12, 0.34),
    0 38px 70px -34px rgba(20, 60, 36, 0.3);
  transition: box-shadow 0.4s ease;
}
.island.is-drag { cursor: grabbing; }

.island__skin, .island__grain, .island__rim, .island__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.island__skin {
  z-index: -3;
  background:
    radial-gradient(120% 90% at 18% -10%, rgba(79, 217, 138, 0.1), transparent 55%),
    linear-gradient(180deg, #17171a 0%, var(--isola) 48%, #060607 100%);
}
.island__grain {
  z-index: -2;
  opacity: 0.11;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.island__rim {
  z-index: 5;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6);
}
.island__sheen {
  z-index: 4;
  opacity: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.09) 46%, rgba(160, 255, 200, 0.12) 50%, transparent 66%);
  background-size: 260% 100%;
  background-position: 120% 0;
}

/* ---------- the compact pill ---------- */
.pill {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  margin: 0 auto;
  width: 252px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: inherit;
  border-radius: 20px;
  -webkit-tap-highlight-color: transparent;
}
.pill:focus-visible, .act:focus-visible, .card__fold:focus-visible, .cleared__undo:focus-visible {
  outline: 2px solid var(--accento);
  outline-offset: 2px;
}
.pill__app, .card__app {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(160deg, #6be79f, #2fb46a 70%, #23955a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
.pill__app svg, .card__app svg { width: 16px; height: 16px; }
.g-handle, .g-basket, .g-slats {
  fill: none;
  stroke: var(--accento-scuro);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g-basket { fill: rgba(11, 42, 23, 0.12); }
.g-slats { stroke-width: 1.3; opacity: 0.7; }

.pill__who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: rgba(244, 243, 239, 0.92); }
.pill__count {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: rgba(244, 243, 239, 0.55);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.roll {
  position: relative;
  display: inline-block;
  height: 1.25em;
  line-height: 1.25em;
  overflow: hidden;
  color: var(--accento);
  font-weight: 640;
  font-size: 13px;
  vertical-align: bottom;
}
.roll__n { display: block; }
.roll__n + .roll__n { position: absolute; left: 0; top: 100%; }

.ring { flex: none; width: 20px; height: 20px; transform: rotate(-90deg); }
.ring__track, .ring__fill { fill: none; stroke-width: 2.4; }
.ring__track { stroke: rgba(255, 255, 255, 0.12); }
.ring__fill { stroke: var(--accento); stroke-linecap: round; }

/* ---------- the open card ---------- */
.card {
  position: absolute;
  left: 50%;
  top: 0;
  width: 352px;
  translate: -50% 0;
  padding: 14px 14px 14px;
  display: grid;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  cursor: inherit;
}

.card__head { display: flex; align-items: center; gap: 10px; }
.card__app { width: 32px; height: 32px; border-radius: 9px; }
.card__app svg { width: 20px; height: 20px; }
.card__titles { flex: 1; min-width: 0; display: grid; gap: 1px; }
.card__meta { font-size: 11px; font-weight: 520; color: var(--grigio); letter-spacing: 0.01em; }
.card__sep { padding: 0 0.32em; opacity: 0.7; }
.card__title {
  font-size: 15px;
  font-weight: 640;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__fold {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(244, 243, 239, 0.7);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s cubic-bezier(.3, 1.6, .5, 1);
}
.card__fold svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card__fold:active { transform: scale(0.9); }

.swap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 22px 1fr;
  align-items: center;
  gap: 6px;
}
.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 9px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 0 0 1px var(--linea), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.item--gone { opacity: 0.62; }
.item--new { box-shadow: inset 0 0 0 1px rgba(79, 217, 138, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 22px -12px rgba(79, 217, 138, 0.45); }
.item__halo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(80% 120% at 20% 0%, rgba(79, 217, 138, 0.2), transparent 60%);
  opacity: 0.7;
}
.carton { flex: none; width: 24px; height: 31px; }
.carton svg { width: 100%; height: 100%; overflow: visible; }
.carton__body { fill: #f1eee6; stroke: rgba(0, 0, 0, 0.25); stroke-width: 0.6; }
.carton__top { fill: #dcd8cd; stroke: rgba(0, 0, 0, 0.2); stroke-width: 0.6; }
.carton__fold { stroke: rgba(0, 0, 0, 0.16); stroke-width: 0.7; }
.carton__band--oat { fill: var(--avena); }
.carton__band--almond { fill: var(--mandorla); }
.item--gone .carton { filter: grayscale(0.7); }

.item__text { display: grid; gap: 1px; min-width: 0; }
.item__name {
  position: relative;
  font-size: 12px;
  font-weight: 600;
  font-variation-settings: "wdth" 92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item__sub { font-size: 11px; color: var(--grigio); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item__tag {
  justify-self: start;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(244, 243, 239, 0.6);
  background: rgba(255, 255, 255, 0.07);
}
.item__tag--diff { color: var(--accento); background: rgba(79, 217, 138, 0.12); font-variant-numeric: tabular-nums; }
.item__strike {
  position: absolute;
  left: -1px;
  right: -1px;
  top: 54%;
  height: 1px;
  background: rgba(244, 243, 239, 0.55);
  transform-origin: left center;
  transform: scaleX(0);
}

.swap__note {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: calc(50% - 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  font-weight: 560;
  color: rgba(244, 243, 239, 0.78);
  opacity: 0;
  visibility: hidden;
}
.swap__note > span { display: grid; gap: 1px; }
.swap__aisle { font-size: 10.5px; font-weight: 500; color: var(--grigio); }
.swap__note svg { flex: none; width: 15px; height: 15px; padding: 2px; border-radius: 50%; background: rgba(79, 217, 138, 0.14); fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.swap__arrow { display: grid; place-items: center; color: rgba(244, 243, 239, 0.45); }
.swap__arrow svg { width: 18px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.card__foot { display: flex; align-items: center; gap: 10px; }
.timer { flex: 1; min-width: 0; display: grid; gap: 6px; }
.timer__short { display: none; }
.timer__text { overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--grigio); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer__line { position: relative; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.timer__fill { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, rgba(79, 217, 138, 0.45), var(--accento)); transform-origin: left center; }

.actions { flex: none; display: flex; gap: 6px; }
.act {
  position: relative;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.act__face {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 0 14px;
  border-radius: inherit;
  font-size: 12.5px;
  font-weight: 620;
  white-space: nowrap;
  transition: transform 0.35s cubic-bezier(.3, 1.7, .5, 1), background 0.3s ease, box-shadow 0.3s ease;
}
.act:active .act__face, .act.is-press .act__face { transform: scale(0.95); transition-duration: 0.12s; }
.act--ghost .act__face { color: rgba(244, 243, 239, 0.82); background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.act--go .act__face {
  color: var(--accento-scuro);
  background: linear-gradient(180deg, #74ecaa, var(--accento) 55%, #36c473);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.16), 0 6px 16px -8px rgba(79, 217, 138, 0.8);
}
.act__labels { position: relative; display: grid; overflow: hidden; height: 1.3em; line-height: 1.3em; }
.act__l { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.act__l[data-l="done"] { visibility: hidden; }
.tick { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- after a swipe ---------- */
.cleared {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  margin: 0 auto;
  width: max-content;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 5px 0 16px;
  border-radius: 20px;
  background: #f4f4f2;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #5d5c63;
  font-size: 12.5px;
  font-weight: 540;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
}
.cleared__undo {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 15px;
  background: #16161a;
  color: #f4f3ef;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(.3, 1.7, .5, 1);
}
.cleared__undo:active, .cleared__undo.is-press { transform: scale(0.94); }

@media (hover: hover) {
  .island:hover {
    box-shadow:
      0 1px 1px rgba(10, 10, 12, 0.08),
      0 6px 14px -4px rgba(10, 10, 12, 0.2),
      0 24px 46px -14px rgba(10, 10, 12, 0.38),
      0 44px 80px -34px rgba(20, 60, 36, 0.36);
  }
  .card__fold:hover { background: rgba(255, 255, 255, 0.13); }
  .act--ghost:hover .act__face { background: rgba(255, 255, 255, 0.13); }
  .act--go:hover .act__face { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.16), 0 8px 20px -8px rgba(79, 217, 138, 1); }
  .cleared__undo:hover { background: #2a2a30; }
}

@media (max-width: 380px) {
  .item { padding: 8px 7px; gap: 6px; }
  .carton { width: 20px; height: 26px; }
  .item__name { font-size: 11.5px; }
  .act__face { padding: 0 11px; font-size: 12px; }
  .timer__text { font-size: 10.5px; }
  .timer__long { display: none; }
  .timer__short { display: inline; }
}
