:root {
  --fondo: #0a0a0b;
  --carta: #111114;
  --pulsante: #16161a;
  --testo: #f2f2f4;
  --grigio: #8a8a94;
  --spento: #5c5c66;
  --luce: #a9b8ff;
  --luce2: #e7b8ff;
  --bordo: rgba(255, 255, 255, 0.08);
}

* { 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;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  background: radial-gradient(min(80vw, 620px) min(50vh, 360px) at 50% 70%, rgba(169, 184, 255, 0.06), transparent 70%);
}

/* ---------- the note */
.note {
  position: relative;
  width: min(100%, 440px);
  padding: clamp(16px, 3.4vh, 24px) clamp(16px, 4vw, 24px) clamp(14px, 3vh, 20px);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 40%), var(--carta);
  box-shadow: inset 0 0 0 1px var(--bordo), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}

.note__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(10px, 2.2vh, 16px);
  font-size: 13px;
  color: var(--grigio);
}
.note__title { display: flex; align-items: center; gap: 8px; color: var(--testo); font-weight: 560; font-size: 14px; }
.note__doc { width: 17px; height: 17px; fill: none; stroke: var(--grigio); stroke-width: 1.3; stroke-linejoin: round; stroke-linecap: round; }
.note__date { color: var(--spento); font-weight: 450; }
.note__count { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* digits that roll in their own little columns */
.roller { display: inline-flex; height: 1.2em; line-height: 1.2em; overflow: hidden; color: var(--testo); font-weight: 520; }
.roller .col { display: inline-block; position: relative; overflow: hidden; }
.roller .col .strip { display: flex; flex-direction: column; }
.roller .col .strip span { height: 1.2em; }

.note__body {
  position: relative;
  overflow: hidden;
  font-size: clamp(13.5px, min(3.6vw, 2.1vh + 6px), 15px);
  line-height: 1.6;
  letter-spacing: -0.003em;
}
.note__text { color: var(--grigio); }
.note__text .wd { display: inline; }
.note__sum {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  color: var(--testo);
  font-weight: 470;
  visibility: hidden;
}
.note__sum .sw { display: inline-block; white-space: nowrap; }
.note__sum .c { display: inline-block; white-space: pre; }

/* the band of light that reads */
.scan {
  position: absolute;
  left: 0;
  top: 0;
  width: 180px;
  height: 1.6em;
  margin-left: -90px;
  border-radius: 999px;
  background: radial-gradient(closest-side, rgba(214, 222, 255, 0.34), rgba(169, 184, 255, 0.12) 60%, transparent);
  filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- the button row */
.note__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(14px, 3vh, 20px);
}

.btnwrap { position: relative; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: clamp(38px, 6.4vh, 44px);
  padding: 0 18px 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--testo);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.95);
}
.btn:focus-visible { outline: 2px solid var(--luce); outline-offset: 4px; }

.btn__ring, .btn__halo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  overflow: hidden;
  opacity: 0;
}
.btn__halo { inset: -4px; filter: blur(10px); pointer-events: none; }
.btn__spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 260px;
  height: 260px;
  margin: -130px 0 0 -130px;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(169, 184, 255, 0) 40deg, var(--luce) 110deg, #ffffff 150deg, var(--luce2) 190deg, rgba(231, 184, 255, 0) 260deg, transparent 360deg);
}
.btn__face {
  position: absolute;
  inset: 1px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #1d1d22, var(--pulsante));
  box-shadow: inset 0 0 0 1px var(--bordo), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.btn__shine {
  position: absolute;
  left: 0;
  top: 0;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.16), transparent);
  opacity: 0;
}
.btn__in { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.btn__spark { width: 16px; height: 16px; fill: var(--luce); }
.btn__label {
  position: relative;
  display: inline-block;
  height: 1.25em;
  line-height: 1.25em;
  font-size: 14.5px;
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.btn__label .w { display: inline-block; white-space: pre; }
.btn__label .w.old { position: absolute; left: 0; top: 0; }
.btn__label .c { display: inline-block; }

.undo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--grigio);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
}
.undo svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .undo:hover { color: var(--testo); background: rgba(255, 255, 255, 0.05); }
}

/* ---------- the drawn pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #0a0a0b;
  stroke-width: 1.2;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  z-index: 5;
}
