:root {
  --fondo: #ffffff;
  --carta: #fdfcfa;
  --inchiostro: #1a1716;
  --grigio: #6e6863;
  --grigio-chiaro: #aaa39c;
  --bordo: rgba(26, 23, 22, 0.1);
  --campo: #f6f4f1;
  --accento: #8a2a2b;
  --cera-luce: #c2575a;
  --cera-ombra: #561616;
  --accento-velo: rgba(138, 42, 43, 0.1);
  --accento-bordo: rgba(138, 42, 43, 0.42);
  --spazio: clamp(6px, 1.7vh, 14px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2vh, 18px) 14px;
  overflow: hidden;
}

/* ---- the card: its height is driven by the script, so it can spring when the questions change ---- */
.card {
  position: relative;
  width: min(372px, 100%);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(26, 23, 22, 0.04), 0 22px 50px -28px rgba(60, 20, 20, 0.28);
  overflow: hidden;
}
.card__in { position: relative; }

.form {
  display: grid;
  gap: var(--spazio);
  padding: clamp(12px, 2.8vh, 20px) clamp(13px, 3.6vw, 20px);
}

/* ---- header ---- */
.firm {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--grigio);
  font-variation-settings: "wdth" 104;
}
.firm__mark { width: 15px; height: 15px; fill: none; stroke: var(--accento); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.title {
  margin-top: clamp(4px, 1vh, 8px);
  font-family: "Newsreader Variable", Georgia, serif;
  font-weight: 400;
  font-size: clamp(21px, 3.6vh, 27px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 48;
}
.title em { font-style: italic; color: var(--accento); }
.sub { margin-top: 4px; font-size: 12px; line-height: 1.35; color: var(--grigio); }

/* ---- blocks and labels ---- */
.block { border: 0; min-width: 0; }
.label {
  display: block;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--grigio);
  margin-bottom: 6px;
  padding: 0;
}
.label__soft { font-weight: 450; color: var(--grigio-chiaro); }

/* ---- practice areas: a segmented row with a sliding ink behind the chosen one ---- */
.areas {
  position: relative;
  display: flex; gap: 3px;
  padding: 3px;
  background: var(--campo);
  border-radius: 12px;
}
.areas__ink {
  position: absolute; left: 0; top: 0;
  border-radius: 9px;
  background: var(--inchiostro);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 6px 12px -6px rgba(26, 23, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
.area {
  position: relative;
  flex: 1 1 auto;
  font: inherit;
  font-size: clamp(11.5px, 3.4vw, 12.5px); font-weight: 560;
  letter-spacing: -0.005em;
  white-space: nowrap;
  color: var(--grigio);
  background: none; border: 0; border-radius: 9px;
  padding: clamp(5px, 1.2vh, 8px) clamp(4px, 1.6vw, 8px);
  cursor: pointer;
  transition: color 0.25s;
  font-variation-settings: "wdth" 100;
  -webkit-tap-highlight-color: transparent;
}
.area[aria-checked="true"] { color: #fff; }
.area:focus-visible { outline: 2px solid var(--accento-bordo); outline-offset: 2px; }
@media (hover: hover) {
  .area:not([aria-checked="true"]):hover { color: var(--inchiostro); }
}

/* ---- the questions that change ---- */
.qs { position: relative; overflow: hidden; }
.qs__in { display: grid; gap: var(--spazio); }
.q { display: grid; }
.field {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  height: clamp(32px, 5.4vh, 38px);
  padding: 0 11px;
  background: #fff;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field.is-focus { border-color: var(--accento-bordo); box-shadow: 0 0 0 3px var(--accento-velo); }
.field__icon { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--grigio-chiaro); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.field__input {
  flex: 1; min-width: 0;
  font: inherit;
  color: var(--inchiostro);
  background: none; border: 0; outline: 0;
}
.field__input { font-size: 13.5px; }
/* on touch screens 16px, so Safari doesn't zoom the page when the field is tapped */
@media (pointer: coarse) { .field__input { font-size: 16px; } }
.field.is-wrong { border-color: var(--accento); box-shadow: 0 0 0 3px var(--accento-velo); }
.field__input::placeholder { color: var(--grigio-chiaro); }
.hint { margin-top: 5px; font-size: 11px; line-height: 1.35; color: var(--grigio-chiaro); }

.opts { display: flex; flex-wrap: wrap; gap: 5px; }
@media (max-width: 400px) { .opts { flex-wrap: nowrap; gap: 4px; } .opt { flex: 0 1 auto; min-width: 0; } }
.q, .qs__group { min-width: 0; }
.opt {
  font: inherit; font-size: clamp(11.5px, 3.4vw, 12px); font-weight: 520;
  white-space: nowrap;
  color: var(--inchiostro);
  background: #fff;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  padding: clamp(4px, 0.9vh, 6px) clamp(8px, 2.5vw, 10px);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
.opt__tick { width: 0; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.opt[aria-checked="true"] { background: var(--accento-velo); border-color: var(--accento-bordo); color: var(--accento); }
.opt:focus-visible { outline: 2px solid var(--accento-bordo); outline-offset: 2px; }
@media (hover: hover) {
  .opt:not([aria-checked="true"]):hover { border-color: rgba(26, 23, 22, 0.24); }
}

/* ---- days ---- */
.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.day {
  font: inherit;
  display: grid; justify-items: center; gap: 1px;
  padding: clamp(4px, 0.9vh, 7px) 0;
  background: #fff;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  color: var(--inchiostro);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.day__w { font-size: 10px; font-weight: 560; color: var(--grigio); letter-spacing: 0.02em; text-transform: uppercase; }
.day__n { font-family: "Newsreader Variable", Georgia, serif; font-size: clamp(15px, 2.6vh, 18px); line-height: 1.1; font-variation-settings: "opsz" 24; }
.day[aria-checked="true"] { background: var(--inchiostro); border-color: var(--inchiostro); color: #fff; }
.day[aria-checked="true"] .day__w { color: rgba(255, 255, 255, 0.62); }
.day:focus-visible { outline: 2px solid var(--accento-bordo); outline-offset: 2px; }
.day[disabled] { opacity: 0.4; cursor: default; }
@media (hover: hover) {
  .day:not([aria-checked="true"]):not([disabled]):hover { border-color: rgba(26, 23, 22, 0.24); }
}

/* ---- send ---- */
.send {
  position: relative;
  height: clamp(38px, 6.4vh, 46px);
  font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em;
  color: #fff;
  background: var(--accento);
  border: 0; border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 1px rgba(60, 10, 10, 0.25), 0 10px 18px -12px rgba(138, 42, 43, 0.9);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.send__label { display: inline-block; }
.send__spin {
  position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round;
  opacity: 0;
}
.send__spin circle { stroke: rgba(255, 255, 255, 0.28); }
.send:focus-visible { outline: 2px solid var(--accento-bordo); outline-offset: 3px; }
@media (hover: hover) {
  .send:hover { background: #7a2223; }
}

/* ---- the sealed confirmation ---- */
.done {
  position: absolute; left: 0; right: 0; top: 0;
  display: grid; justify-items: center; text-align: center;
  padding: clamp(18px, 4vh, 30px) 20px clamp(16px, 3.4vh, 26px);
  visibility: hidden;
}
.seal { position: relative; width: clamp(84px, 15vh, 104px); aspect-ratio: 1; }
.seal__wax { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 2px rgba(60, 10, 10, 0.28)) drop-shadow(0 10px 14px rgba(60, 10, 10, 0.18)); }
.seal__blob { fill: url(#cera); }
.seal__ring { fill: none; stroke: rgba(40, 6, 6, 0.38); stroke-width: 2; }
.seal__ring--in { stroke: rgba(255, 210, 205, 0.22); stroke-width: 1; }
.seal__mono { font-family: "Newsreader Variable", Georgia, serif; font-style: italic; font-size: 25px; fill: rgba(50, 8, 8, 0.55); letter-spacing: -0.02em; paint-order: stroke; stroke: rgba(255, 200, 196, 0.22); stroke-width: 0.8; }
.seal__shine { fill: none; stroke: rgba(255, 235, 230, 0.55); stroke-width: 2.5; stroke-linecap: round; }
.seal__press {
  position: absolute; left: 50%; top: 50%;
  width: 100%; aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1.5px solid var(--accento-bordo);
  opacity: 0;
}
.done__title {
  margin-top: clamp(10px, 2vh, 16px);
  font-family: "Newsreader Variable", Georgia, serif;
  font-size: clamp(22px, 3.8vh, 28px);
  line-height: 1.05;
  font-variation-settings: "opsz" 48;
}
.done__title em { font-style: italic; color: var(--accento); }
.done__line { margin-top: 6px; font-size: 13px; font-weight: 560; color: var(--inchiostro); }
.done__note { margin-top: 3px; font-size: 12px; color: var(--grigio); }
.again {
  margin-top: clamp(10px, 2.2vh, 16px);
  font: inherit; font-size: 12.5px; font-weight: 560;
  color: var(--inchiostro);
  background: #fff;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
.again:focus-visible { outline: 2px solid var(--accento-bordo); outline-offset: 2px; }
@media (hover: hover) {
  .again:hover { border-color: rgba(26, 23, 22, 0.28); }
}

/* short screens (the phone preview box): the subtitle and the hints step aside */
@media (max-height: 470px) {
  .sub, .hint { display: none; }
  .title { margin-top: 2px; }
  .label { margin-bottom: 4px; }
  .day { gap: 0; }
  .day__w { font-size: 9px; }
}

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

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
