:root {
  --fondo: #f4f4f5;
  --carta: #ffffff;
  --bordo: rgba(17, 17, 19, 0.08);
  --testo: #18181b;
  --testo-2: #71717a;
  --testo-3: #a1a1aa;
  --binario: #f1f1f3;
  --verde: #22a55b;
  --verde-scuro: #17803f;
  --verde-tenue: #dff3e7;
  --notte: #17171a;
  --notte-2: #2a2a2f;
  --rosso: #e5484d;
  --avatar-a: #f2b38b;
  --avatar-b: #8f7cf0;
}

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

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vmin, 40px);
}

/* the piece keeps the size of the incoming card: the call bar and the end pill live inside it */
.pezzo {
  position: relative;
  width: min(340px, calc(100vw - 32px));
  height: 172px;
  display: grid;
  place-items: center;
}

.superficie {
  position: relative;
  width: 100%;
  height: 172px;
  border-radius: 24px;
  background: var(--carta);
  border: 1px solid var(--bordo);
  box-shadow:
    0 1px 1px rgba(17, 17, 19, 0.04),
    0 10px 24px -8px rgba(17, 17, 19, 0.12),
    0 30px 60px -24px rgba(17, 17, 19, 0.18);
  overflow: hidden;
  will-change: transform;
}

.strato {
  position: absolute;
  left: 0;
  top: 0;
}

/* ---- incoming ---- */
.strato--arrivo {
  width: min(340px, calc(100vw - 32px));
  height: 172px;
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.chi { display: flex; align-items: center; gap: 12px; }

.avatar {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 30% 25%, var(--avatar-a), transparent 62%), radial-gradient(circle at 75% 80%, var(--avatar-b), transparent 66%), #e7c9d8;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(17, 17, 19, 0.12);
}
.avatar__luce {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 255, 255, 0.45) 80%, transparent 90%);
  mix-blend-mode: soft-light;
}
.avatar__iniziali { position: relative; font-size: 15px; font-weight: 680; font-stretch: 112%; color: #fff; letter-spacing: 0.02em; text-shadow: 0 1px 2px rgba(60, 30, 60, 0.25); }

.chi__testo { display: grid; gap: 3px; min-width: 0; flex: 1; }
.chi__nome { font-size: 16px; font-weight: 640; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chi__cosa { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--testo-2); }
.chi__cosa svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--testo-3); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.chi__luccica {
  background: linear-gradient(100deg, var(--testo-2) 0 40%, #c4c4cc 50%, var(--testo-2) 60% 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.app {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--binario);
  display: grid;
  place-items: center;
  align-self: flex-start;
}
.app svg { width: 18px; height: 18px; fill: none; stroke: var(--verde-scuro); stroke-width: 1.8; stroke-linecap: round; }

.binario {
  position: relative;
  height: 60px;
  border-radius: 30px;
  background: var(--binario);
  box-shadow: inset 0 1px 2px rgba(17, 17, 19, 0.06);
  overflow: hidden;
  touch-action: none;
}
.binario__pieno {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  border-radius: 30px;
  background: linear-gradient(90deg, var(--verde-tenue), #c9ecd6);
}
.binario__scritta {
  position: absolute;
  inset: 0 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 560;
  color: var(--testo-2);
  pointer-events: none;
}
.binario__scritta svg { width: 16px; height: 16px; fill: none; stroke: var(--testo-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.maniglia {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(180deg, #2bb866, var(--verde));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 4px 10px -2px rgba(23, 128, 63, 0.45), 0 1px 2px rgba(17, 17, 19, 0.2);
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}
.maniglia:active { cursor: grabbing; }
.maniglia:focus-visible { outline: 2px solid var(--verde-scuro); outline-offset: 3px; }
.maniglia__cornetta { width: 22px; height: 22px; fill: #fff; }

/* ---- in the call ---- */
.strato--chiamata {
  width: min(320px, calc(100vw - 32px));
  height: 68px;
  padding: 0 10px 0 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.avatar--piccolo { width: 42px; height: 42px; }
.avatar--piccolo .avatar__iniziali { font-size: 13px; }
.barra__testo { display: grid; gap: 1px; min-width: 0; flex: 1; }
.barra__nome { font-size: 14px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tempo { display: flex; font-size: 13px; color: #9be0b6; height: 1.25em; overflow: hidden; }
.cifra { display: inline-block; width: 0.62em; text-align: center; }
.due { display: inline-block; width: 0.32em; text-align: center; }

.onda { display: flex; align-items: center; gap: 1.5px; height: 18px; flex: none; }
.onda i { display: block; width: 3px; height: 100%; border-radius: 1.5px; background: #9be0b6; transform: scaleY(0.3); transform-origin: 50% 50%; }

.tondo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.tondo svg { width: 20px; height: 20px; }
.tondo--muto { background: var(--notte-2); }
.tondo--muto svg { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; }
.tondo--muto[aria-pressed="true"] { background: #fff; }
.tondo--muto[aria-pressed="true"] svg { stroke: var(--notte); }
.muto__barra { stroke-dasharray: 100 100; stroke-dashoffset: 100; }
.tondo--chiudi { background: var(--rosso); box-shadow: 0 4px 12px -4px rgba(229, 72, 77, 0.7); }
.tondo--chiudi svg { fill: #fff; }

@media (hover: hover) {
  .tondo--muto:hover { background: #3a3a40; }
  .tondo--muto[aria-pressed="true"]:hover { background: #e8e8ec; }
  .tondo--chiudi:hover { background: #d93d42; }
}

/* ---- ended ---- */
.strato--fine {
  width: 190px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 560;
  color: var(--testo-2);
}
.strato--fine svg { width: 18px; height: 18px; fill: var(--testo-3); }

/* ---- the fake pointer ---- */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #18181b;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(17, 17, 19, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 380px) {
  .strato--chiamata { gap: 8px; padding: 0 9px 0 10px; }
  .avatar--piccolo { width: 38px; height: 38px; }
  .tondo { width: 36px; height: 36px; }
  .tondo svg { width: 18px; height: 18px; }
  .barra__nome { font-size: 13.5px; }
}

@media (max-height: 300px) {
  .stage { padding: 8px; }
}
