:root {
  --fondo: #ffffff;
  --nero: #0b0b0c;
  --card: #ffffff;
  --bordo: rgba(10, 10, 12, 0.08);
  --testo: #0b0b0c;
  --testo-2: #6b6b73;
  --testo-3: #a1a1aa;
  --accento: #2f6bff;
  --modulo: #0b0b0c;
  --tasto: #f4f4f5;
}

* { box-sizing: border-box; margin: 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;
}

.stage {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 18px);
  padding: 16px;
}

/* the slot keeps the place of the open card, so the note below never jumps */
.slot {
  position: relative;
  width: var(--w-card, 272px);
  height: var(--h-card, 352px);
  display: grid;
  place-items: center;
}

/* one box for GSAP: width, height and radius go from pill to card */
.app {
  position: relative;
  width: 172px;
  height: 52px;
  border-radius: 26px;
  background: var(--nero);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 6px 16px -6px rgba(10, 10, 12, 0.45), 0 1px 2px rgba(10, 10, 12, 0.2);
  overflow: hidden;
  will-change: width, height;
}

.app__pill {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  background: none;
  color: #fafafa;
  font: inherit;
  font-size: 15px;
  font-weight: 560;
  font-stretch: 100%;
  letter-spacing: -0.01em;
  cursor: pointer;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app__pill:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.app__phone, .app__chev {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.app__chev { width: 14px; height: 14px; opacity: 0.55; }

.app__label { white-space: nowrap; display: inline-block; }

/* the card, white inside the black box: it fades in as the box opens */
.card {
  position: absolute;
  inset: 1px;
  border-radius: 21px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(8px, 1.8vh, 14px);
  padding: clamp(12px, 2.6vh, 18px) 16px clamp(12px, 2.4vh, 16px);
  opacity: 0;
  visibility: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card__icon, .qr__badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(160deg, #3b78ff, #1f4fd6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 2px 6px -2px rgba(31, 79, 214, 0.6);
  flex: none;
}

.card__icon svg, .qr__badge svg {
  width: 70%;
  height: 70%;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card__name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.card__name strong { font-size: 15px; font-weight: 640; letter-spacing: -0.01em; }
.card__name small { font-size: 12px; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card__close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--tasto);
  color: var(--testo-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background 0.2s, color 0.2s;
}

.card__close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.card__close:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
@media (hover: hover) { .card__close:hover { background: #e9e9ec; color: var(--testo); } }

.qr {
  position: relative;
  align-self: center;
  width: var(--qr, 150px);
  height: var(--qr, 150px);
  padding: 8px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--bordo);
  overflow: hidden;
  flex: none;
}

.qr__code { width: 100%; height: 100%; display: block; }
.qr__code rect { fill: var(--modulo); transform-box: fill-box; transform-origin: center; }
.qr__code .finder { fill: none; stroke: var(--modulo); }

.qr__badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24%;
  height: 24%;
  margin: -12% 0 0 -12%;
  border-radius: 22%;
  box-shadow: 0 0 0 3px #fff, 0 2px 6px -2px rgba(31, 79, 214, 0.6);
}

/* the scan line: a thin bar with a soft tail above it */
.qr__scan {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 0;
  height: 26%;
  border-bottom: 1.5px solid var(--accento);
  background: linear-gradient(to bottom, rgba(47, 107, 255, 0), rgba(47, 107, 255, 0.14));
  opacity: 0;
  pointer-events: none;
}

.qr__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  pointer-events: none;
}

.qr__frame path { vector-effect: non-scaling-stroke; }

.card__hint { display: flex; flex-direction: column; align-items: center; line-height: 1.3; text-align: center; }
.card__say { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card__sub { font-size: 12px; color: var(--testo-2); font-variant-numeric: tabular-nums; }

.card__stores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }

.store {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 11px;
  background: var(--tasto);
  color: var(--testo);
  text-decoration: none;
  font-size: 13px;
  font-weight: 560;
  box-shadow: 0 0 0 1px var(--bordo) inset;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s;
}

.store svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.store:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.store.is-on { background: #e8e8ec; }
@media (hover: hover) { .store:hover { background: #ececef; } }

.note {
  font-size: 12px;
  color: var(--testo-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #0b0b0c;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}
