:root {
  --verde: #b6ff3d;
  --nero: #0b0b0b;
  --bianco: #ffffff;
  --grigio: #f2f2ef;
  --linea: #e4e4df;
  --testo-2: #55554f;
  --pollice: 34px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bianco);
  color: var(--nero);
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Evidenziatore: rettangolo verde dietro la parola, che si stende al caricamento */
mark {
  color: inherit;
  background: linear-gradient(var(--verde), var(--verde)) no-repeat left 0 bottom .2em / 100% .42em;
  padding: 0 .14em;
  margin: 0 -.02em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: evidenzia .7s cubic-bezier(.65, 0, .35, 1) .35s backwards;
}
dialog mark { animation: none; }
@keyframes evidenzia { from { background-size: 0% .42em; } }

/* ---------- Apertura ---------- */
.hero {
  text-align: center;
  padding: clamp(48px, 10vw, 104px) 0 clamp(28px, 5vw, 44px);
}
h1 {
  font-size: clamp(1.9rem, 5.8vw, 3.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.03em;
  margin: 0 auto;
  max-width: 17ch;
  text-wrap: balance;
}
.sub {
  font-size: clamp(1.1rem, 2.6vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -.015em;
  max-width: 30ch;
  margin: 22px auto 0;
  text-wrap: balance;
}

/* ---------- Video ---------- */
.video {
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  background: var(--grigio);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .45);
}
.video iframe, .video video, .video wistia-player { width: 100%; height: 100%; border: 0; display: block; border-radius: inherit; overflow: hidden; }
.video-segnaposto {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: radial-gradient(120% 90% at 50% 0%, #1f1f1c, var(--nero));
}
.play {
  width: clamp(64px, 12vw, 92px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--verde);
  display: grid;
  place-items: center;
}
.play svg { width: 42%; fill: var(--nero); margin-left: 6%; }
.video-nota { color: rgba(255, 255, 255, .55); font-size: .9rem; font-weight: 500; }

/* ---------- Pulsanti ---------- */
.cta-wrap { text-align: center; padding: 32px 0 0; }
.cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--bianco);
  background: var(--nero);
  border-radius: 999px;
  padding: 10px 10px 10px 30px;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  transition: transform .2s cubic-bezier(.3, .7, .4, 1.4), box-shadow .2s;
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, .55);
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -14px rgba(0, 0, 0, .55); }
.cta:active { transform: scale(.97); }
.cta:focus-visible { outline: 3px solid var(--verde); outline-offset: 3px; }
.cta-freccia {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--verde);
  display: grid;
  place-items: center;
  transition: transform .25s;
}
.cta:hover .cta-freccia { transform: translateX(3px); }
.cta-freccia svg { width: 22px; fill: none; stroke: var(--nero); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cta-nota { margin: 12px 0 0; font-size: .9rem; font-weight: 500; color: var(--testo-2); }

/* ---------- Calcolatore ---------- */
.calcolo { padding: clamp(72px, 12vw, 120px) 0 clamp(64px, 10vw, 100px); text-align: center; }
h2 {
  font-size: clamp(1.8rem, 4.6vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.08;
  margin: 0;
}
.calcolo-card {
  margin: 32px auto 0;
  max-width: 640px;
  background: var(--grigio);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 44px) clamp(20px, 5vw, 48px) 28px;
}
.calcolo-etichetta { margin: 0; font-size: 1.15rem; font-weight: 700; }
#n-business { font-variant-numeric: tabular-nums; }
.cifra {
  margin: 6px 0 30px;
  font-size: clamp(3.6rem, 13vw, 6rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cifra small { font-size: .26em; letter-spacing: -.01em; font-weight: 700; color: var(--testo-2); margin-left: .25em; }
.calcolo-nota { margin: 22px 0 0; font-size: .82rem; font-weight: 500; color: var(--testo-2); }

.slider { position: relative; padding-bottom: 34px; }
.slider input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--pollice);
  margin: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
}
.slider input:focus { outline: none; }

/* traccia: grigia, con la parte percorsa verde (la --p la aggiorna app.js) */
.slider::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: calc(var(--pollice) / 2 - 6px);
  height: 12px;
  border-radius: 99px;
  background:
    linear-gradient(var(--verde), var(--verde)) no-repeat left / calc(var(--pollice) / 2 + (100% - var(--pollice)) * var(--p)) 100%,
    #dcdcd6;
  transition: background-size .35s cubic-bezier(.2, .8, .2, 1);
}
.slider.trascina::before { transition: none; }

.slider input::-webkit-slider-runnable-track { height: var(--pollice); background: transparent; }
.slider input::-moz-range-track { height: var(--pollice); background: transparent; }
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--pollice);
  height: var(--pollice);
  border-radius: 50%;
  background: var(--nero);
  border: 0;
  box-shadow: inset 0 0 0 10px var(--nero), inset 0 0 0 40px var(--verde), 0 6px 16px -4px rgba(0, 0, 0, .45);
  transition: transform .2s cubic-bezier(.3, .7, .4, 1.5);
}
.slider input::-moz-range-thumb {
  width: var(--pollice);
  height: var(--pollice);
  border-radius: 50%;
  background: var(--verde);
  border: 10px solid var(--nero);
  box-sizing: border-box;
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, .45);
  transition: transform .2s cubic-bezier(.3, .7, .4, 1.5);
}
.slider input:active::-webkit-slider-thumb { transform: scale(1.18); }
.slider input:active::-moz-range-thumb { transform: scale(1.18); }
.slider input:focus-visible::-webkit-slider-thumb { box-shadow: inset 0 0 0 10px var(--nero), inset 0 0 0 40px var(--verde), 0 0 0 5px rgba(182, 255, 61, .6); }

.tacche { position: absolute; left: 0; right: 0; top: calc(var(--pollice) + 8px); height: 24px; }
.tacche button {
  position: absolute;
  transform: translateX(-50%);
  width: 32px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  color: #9a9a93;
  cursor: pointer;
  transition: color .2s;
}
.tacche button.attiva { color: var(--nero); }
.tacche button:nth-child(1) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 0 / 6); }
.tacche button:nth-child(2) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 1 / 6); }
.tacche button:nth-child(3) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 2 / 6); }
.tacche button:nth-child(4) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 3 / 6); }
.tacche button:nth-child(5) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 4 / 6); }
.tacche button:nth-child(6) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 5 / 6); }
.tacche button:nth-child(7) { left: calc(var(--pollice) / 2 + (100% - var(--pollice)) * 6 / 6); }

/* ---------- Piè di pagina ---------- */
footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 16px 40px;
  border-top: 1px solid var(--linea);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--testo-2);
}
footer p { margin: 0; }
footer nav { display: flex; gap: 20px; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--nero); text-decoration: underline; }

/* ---------- Modulo ---------- */
dialog {
  border: 0;
  padding: 0;
  width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  border-radius: 28px;
  background: var(--bianco);
  color: var(--nero);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .5);
}
dialog[open] { animation: entra .35s cubic-bezier(.2, .9, .3, 1.1); }
dialog::backdrop { background: rgba(10, 10, 10, .55); backdrop-filter: blur(4px); animation: sfuma .3s; }
@keyframes entra { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes sfuma { from { opacity: 0; } }

dialog form, .grazie { padding: 36px clamp(20px, 5vw, 36px) 32px; }
dialog h2 { font-size: 1.9rem; }
.form-sub { margin: 8px 0 22px; font-weight: 500; color: var(--testo-2); }

.chiudi {
  position: absolute;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--grigio);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.chiudi svg { width: 18px; stroke: var(--nero); stroke-width: 2.4; stroke-linecap: round; }

.campo { display: block; margin-bottom: 14px; }
.campo span, .scelta legend { display: block; font-size: .9rem; font-weight: 700; margin-bottom: 6px; }
.campo input {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  padding: 14px 16px;
  border: 2px solid var(--linea);
  border-radius: 14px;
  background: var(--bianco);
  color: var(--nero);
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus { outline: none; border-color: var(--nero); box-shadow: 0 0 0 4px rgba(182, 255, 61, .55); }
.campo input.non-valido { border-color: #d33; }

.scelta { border: 0; padding: 0; margin: 4px 0 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.scelta legend { width: 100%; padding: 0; }
.scelta label { flex: 1; }
.scelta input { position: absolute; opacity: 0; pointer-events: none; }
.scelta span {
  display: block;
  text-align: center;
  padding: 13px;
  border: 2px solid var(--linea);
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.scelta input:checked + span { background: var(--verde); border-color: var(--nero); }
.scelta input:focus-visible + span { box-shadow: 0 0 0 4px rgba(182, 255, 61, .55); }

.privacy { display: flex; gap: 10px; align-items: flex-start; font-size: .85rem; font-weight: 500; color: var(--testo-2); margin-bottom: 20px; cursor: pointer; }
.privacy input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--nero); }
.privacy a { color: var(--nero); }

.trappola { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.errore { margin: -6px 0 16px; color: #c42020; font-weight: 600; font-size: .92rem; }

.cta-piena { width: 100%; justify-content: space-between; }
.cta[disabled] { opacity: .6; pointer-events: none; }

.grazie { text-align: center; padding-top: 48px; }
.grazie p { font-weight: 500; color: var(--testo-2); margin: 10px 0 22px; }

.whatsapp {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 12px;
  border-radius: 999px;
  background: #25d366;
  color: var(--nero);
  text-decoration: none;
  text-align: left;
  box-shadow: 0 14px 30px -14px rgba(18, 140, 68, .7);
  transition: transform .2s cubic-bezier(.3, .7, .4, 1.4), box-shadow .2s;
}
.whatsapp:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -14px rgba(18, 140, 68, .8); }
.whatsapp:active { transform: scale(.97); }
.whatsapp:focus-visible { outline: 3px solid var(--nero); outline-offset: 3px; }
.whatsapp-foto { position: relative; flex: none; width: 56px; height: 56px; }
.whatsapp-foto img, .whatsapp-iniziale {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--bianco);
}
.whatsapp-foto img { position: absolute; inset: 0; z-index: 1; object-fit: cover; }
.whatsapp-iniziale { display: grid; place-items: center; background: var(--nero); color: var(--verde); font-weight: 900; font-size: 1.4rem; }
.whatsapp-badge {
  position: absolute; z-index: 2;
  right: -3px; bottom: -3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bianco);
  display: grid; place-items: center;
}
.whatsapp-badge svg { width: 16px; fill: #25d366; }
.whatsapp-testo { flex: 1; min-width: 0; line-height: 1.2; }
.whatsapp-testo strong { display: block; font-size: 1.15rem; font-weight: 800; }
.whatsapp-testo small { font-size: .85rem; font-weight: 600; opacity: .8; }
.whatsapp .cta-freccia { background: var(--bianco); }
.whatsapp:hover .cta-freccia { transform: translateX(3px); }

.grazie-chiudi {
  margin-top: 16px;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--testo-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px 12px;
}
.spunta {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--verde);
  display: grid;
  place-items: center;
}
.spunta svg { width: 34px; fill: none; stroke: var(--nero); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Barra fissa in basso (solo telefono) ---------- */
.barra-cta { display: none; }

/* ---------- Telefono ---------- */
@media (max-width: 640px) {
  html { -webkit-tap-highlight-color: transparent; }
  :root { --pollice: 40px; }

  .hero { padding: 36px 0 26px; }
  h1 { font-size: clamp(1.85rem, 8.6vw, 2.3rem); line-height: 1.1; max-width: none; }
  .sub { font-size: 1.05rem; margin-top: 16px; max-width: 28ch; }

  /* il video resta dentro i margini, con gli angoli come da desktop */
  .video { border-radius: 16px; box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .45); }

  .cta-wrap { padding-top: 22px; }
  .cta { width: 100%; justify-content: space-between; min-height: 62px; font-size: 1.12rem; padding-left: 26px; }
  .cta:hover { transform: none; }
  .cta-nota { margin-top: 10px; }

  .calcolo { padding: 64px 0 56px; }
  .calcolo-card { margin-top: 22px; border-radius: 24px; padding: 26px 18px 22px; }
  .calcolo-etichetta { font-size: 1.05rem; }
  .cifra { margin-bottom: 26px; }
  .tacche button { width: 40px; height: 32px; font-size: 1rem; }
  .slider { padding-bottom: 38px; }

  footer { flex-direction: column; align-items: center; text-align: center; padding-bottom: 120px; }

  /* il modulo sale dal basso come un foglio */
  dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: 94dvh;
    border-radius: 26px 26px 0 0;
    overscroll-behavior: contain;
  }
  dialog[open] { animation: sale .38s cubic-bezier(.2, .9, .3, 1); }
  dialog form, .grazie { padding: 30px 18px calc(24px + env(safe-area-inset-bottom)); }
  dialog h2 { font-size: 1.6rem; padding-right: 44px; }
  .form-sub { margin-bottom: 18px; }
  .campo input { padding: 15px 16px; font-size: 16px; }
  .scelta span { padding: 15px; }
  .chiudi { top: 16px; right: 14px; }

  .barra-cta {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--linea);
    transform: translateY(110%);
    transition: transform .35s cubic-bezier(.2, .9, .3, 1);
  }
  .barra-cta.visibile { transform: none; }
  .barra-cta .cta { min-height: 56px; box-shadow: none; }
}
@keyframes sale { from { transform: translateY(100%); } }

