:root {
  --fondo: #ffffff;
  --inchiostro: #18181b;
  --grigio: #71717a;
  --bordo: #e6e4df;
  --accento: #2f5bea;
  --accento-chiaro: #f1f4ff;
  --accento-bordo: #c8d3fb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: clamp(14px, min(1.45vw, 2.5vh), 24px); }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

.pezzo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.125rem;
}

.fila {
  display: flex;
  align-items: center;
}

/* the button: one element for GSAP (tasto), the inside for the CSS */
.tasto {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 1rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tasto__corpo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: 3.25rem;
  padding: 0 1.375rem 0 1.062rem;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid var(--bordo);
  box-shadow: 0 1px 0 rgba(24, 24, 27, 0.04), 0 8px 18px -10px rgba(24, 24, 27, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: background-color 0.35s ease, border-color 0.35s ease, box-shadow 0.25s ease, color 0.35s ease;
}
.tasto.is-premuto .tasto__corpo {
  box-shadow: 0 1px 0 rgba(24, 24, 27, 0.03), 0 3px 8px -6px rgba(24, 24, 27, 0.3), inset 0 1px 2px rgba(24, 24, 27, 0.06);
}
.tasto.is-fatto .tasto__corpo {
  background: var(--accento-chiaro);
  border-color: var(--accento-bordo);
  color: var(--accento);
}
.tasto:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }

.scatola {
  width: 1.5rem;
  height: 1.5rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.busta rect { fill: #fff; }
.fondo__pieno, .coperchio rect { fill: #fff; transition: fill 0.35s ease; }
.tasto.is-fatto .fondo__pieno, .tasto.is-fatto .coperchio rect { fill: var(--accento-chiaro); }

.scritte {
  position: relative;
  display: block;
  height: 1.375rem;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.375rem;
  font-weight: 560;
  font-variation-settings: "wdth" 100;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.scritta { position: absolute; left: 0; top: 0; }
.scritta--fatto { opacity: 0; }

/* Undo: grows out from behind the button, the row stays centred */
.posto-annulla {
  display: block;
  width: 0;
  overflow: hidden;
  /* room for Undo's shadow, given back with negative margins so the row does not move */
  padding: 1.1rem 0.9rem 1.4rem 0;
  margin: -1.1rem -0.9rem -1.4rem 0;
}
.annulla {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3125rem;
  margin-left: 0.625rem;
  height: 3.25rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 1rem;
  background: var(--inchiostro);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 560;
  cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(24, 24, 27, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
}
.annulla__scritta { line-height: 1.125rem; }
.annulla__tempo {
  display: block;
  width: 1.875rem;
  height: 0.125rem;
  border-radius: 0.125rem;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.annulla__tempo span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 0.125rem;
  background: rgba(255, 255, 255, 0.85);
  transform-origin: left center;
}
.annulla:focus-visible { outline: 0.125rem solid var(--accento); outline-offset: 0.1875rem; }
@media (hover: hover) {
  .tasto:hover .tasto__corpo { border-color: #d9d6cf; }
  .tasto.is-fatto:hover .tasto__corpo { border-color: var(--accento-bordo); }
  .annulla:hover { background: #27272a; }
}
.tasto.is-ghosthover .tasto__corpo { border-color: #d9d6cf; }

.nota {
  font-size: 0.8125rem;
  line-height: 1.125rem;
  color: var(--grigio);
  font-variation-settings: "wdth" 96;
  transition: opacity 0.4s ease;
}
.nota.is-spenta { opacity: 0.38; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.375rem;
  height: 1.375rem;
  margin: -0.1875rem 0 0 -0.25rem;
  fill: #18181b;
  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;
}

@media (prefers-reduced-motion: reduce) {
  .tasto__corpo, .nota, .fondo__pieno, .coperchio rect { transition: none; }
}
