/* ==========================================================
   Tr360care · Questionario
   Stile: minimal, glass, alta leggibilità
   ========================================================== */

:root {
  --bg: #eaf1ee;
  --ink: #15302d;
  --ink-2: #48605c;
  --ink-3: #7b8f8b;
  --accent: #26756e;
  --accent-hover: #1e625c;
  --accent-soft: rgba(38, 117, 110, 0.10);
  --accent-ring: rgba(38, 117, 110, 0.28);
  --danger: #b2483b;

  --glass: rgba(255, 255, 255, 0.56);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-stroke: rgba(255, 255, 255, 0.85);
  --line: rgba(21, 48, 45, 0.10);

  --radius: 28px;
  --radius-sm: 16px;
  --shadow: 0 40px 90px -40px rgba(21, 48, 45, 0.35), 0 2px 8px rgba(21, 48, 45, 0.04);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Sfondo ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, #f6faf8 0%, transparent 60%),
    linear-gradient(160deg, #eef4f1 0%, #e6eeeb 55%, #ece9f1 100%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: #a9d6cc; }
.b2 { width: 38vmax; height: 38vmax; right: -12vmax; top: 18vh; background: #cfc6ea; animation-delay: -8s; }
.b3 { width: 34vmax; height: 34vmax; left: 20vw; bottom: -18vmax; background: #f4d6c4; opacity: 0.45; animation-delay: -16s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vmax, 3vmax, 0) scale(1.08); }
}

/* ---------- Layout ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 48px) 16px calc(32px + env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.shell.enter .card { animation: rise 0.45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.card-top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px clamp(20px, 5vw, 44px) 0;
}
.card-body { padding: clamp(24px, 4vw, 36px) clamp(20px, 5vw, 44px) 8px; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand svg { width: 30px; height: 30px; flex: none; }

/* ---------- Progresso ---------- */
.progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(21, 48, 45, 0.08);
  overflow: hidden;
}
.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4fa79c, var(--accent));
  transition: width 0.5s cubic-bezier(.2, .7, .2, 1);
}
.progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}

/* ---------- Testi ---------- */
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.q-title {
  margin: 0;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.q-title:focus,
.hero-title:focus { outline: none; }
.help {
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 1rem;
}
.hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- Opzioni ---------- */
.options {
  display: grid;
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}
.opt-wrap { display: grid; gap: 8px; }

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--glass-strong);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(21, 48, 45, 0.05);
  cursor: pointer;
  transition: border-color .18s, background-color .18s, box-shadow .18s, transform .12s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--accent-ring); }
.opt:active { transform: scale(0.995); }
.opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.opt:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--accent-ring); }
.opt:has(input:checked) {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 6px 20px -10px rgba(38, 117, 110, 0.55);
}

.mark {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #b9c7c4;
  background: #fff;
  display: grid;
  place-items: center;
  transition: all .18s;
}
.opt input[type="checkbox"] + .mark { border-radius: 7px; }
.opt input:checked + .mark {
  border-color: var(--accent);
  background: var(--accent);
}
.opt input:checked + .mark::after {
  content: "";
  width: 11px;
  height: 6px;
  border: 2.5px solid #fff;
  border-top: 0;
  border-right: 0;
  transform: translateY(-1px) rotate(-45deg);
}

.lbl { display: grid; gap: 2px; font-size: 1.05rem; font-weight: 500; }
.lbl small { font-size: 0.88rem; font-weight: 400; color: var(--ink-2); }

/* Contenuti che compaiono quando un'opzione è selezionata */
.opt-wrap > .reveal { display: none; }
.opt-wrap:has(> .opt input:checked) > .reveal {
  display: grid;
  animation: rise 0.3s ease both;
}
.reveal {
  gap: 8px;
  margin-left: 20px;
  padding: 4px 0 6px 18px;
  border-left: 2px solid var(--accent-ring);
}
.reveal-title {
  margin: 4px 0 2px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-2);
}
.reveal .opt { min-height: 50px; padding: 11px 16px; }
.reveal .lbl { font-size: 1rem; }

/* ---------- Campi di testo ---------- */
.field {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color .18s, box-shadow .18s;
}
.field::placeholder { color: var(--ink-3); }
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
textarea.field { min-height: 150px; resize: vertical; line-height: 1.5; }

.form-grid { display: grid; gap: 16px; margin-top: 26px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 0.95rem; font-weight: 600; color: var(--ink-2); }
.form-row label .opt-tag { font-weight: 400; color: var(--ink-3); }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--ink-2);
  cursor: pointer;
}
.consent input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

/* ---------- Informativa privacy (schermata iniziale) ---------- */
.informativa {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--glass-strong);
}
.informativa summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--accent);
}
.informativa-body {
  max-height: 320px;
  overflow-y: auto;
  padding: 0 18px 16px;
}
.hero .informativa-body p { font-size: 0.9rem; margin: 10px 0 0; max-width: none; }
.informativa-body a { color: var(--accent); }
.consent-start { margin-top: 18px; }

/* ---------- Contatore numerico ---------- */
.counter { gap: 12px; }
.counter-row { display: flex; align-items: center; gap: 16px; }
.counter-val {
  min-width: 2.2ch;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .18s, transform .12s;
}
.round:hover { border-color: var(--accent); }
.round:active { transform: scale(0.94); }
.round:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }

input[type="range"] {
  width: 100%;
  max-width: 420px;
  accent-color: var(--accent);
  height: 28px;
  margin: 0;
}

/* ---------- Età di più assistiti ---------- */
.age-group {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-stroke);
}
.age-group-title { margin: 0 0 10px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .opt { min-height: 46px; padding: 10px 16px; gap: 10px; }
.chips .mark { width: 20px; height: 20px; }
.chips .lbl { font-size: 0.98rem; }

/* ---------- Errori ---------- */
.error {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--danger);
}
.error:empty { visibility: hidden; }

/* ---------- Navigazione ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px clamp(20px, 5vw, 44px) 26px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 99px;
  border: 0;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .18s, transform .12s, box-shadow .18s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px -12px rgba(38, 117, 110, 0.8);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-stroke);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.85); color: var(--ink); }
.nav .btn-primary { margin-left: auto; }

.kbd-hint {
  display: none;
  font-size: 0.8rem;
  color: var(--ink-3);
}
@media (hover: hover) and (min-width: 700px) {
  .kbd-hint { display: inline; }
}

/* ---------- Schermate speciali ---------- */
.hero { padding: clamp(32px, 6vw, 56px) clamp(20px, 5vw, 52px); }
.hero .brand { margin-bottom: 32px; }
.hero-title {
  margin: 0;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero p { color: var(--ink-2); font-size: 1.06rem; margin: 18px 0 0; max-width: 56ch; }
.hero .greet { color: var(--ink); font-weight: 600; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.meta li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-stroke);
}
.meta svg { width: 16px; height: 16px; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.icon-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--glass-stroke);
  box-shadow: 0 10px 30px -14px rgba(38, 117, 110, 0.6);
}
.icon-badge svg { width: 30px; height: 30px; }

/* Presentazione soluzione */
.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--glass-stroke);
  font-weight: 500;
  line-height: 1.4;
}
.features svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--accent); }

.toast {
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  min-height: 1.4em;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .shell { justify-content: flex-start; padding-top: 16px; }
  .card { border-radius: 24px; }
  .card-top { gap: 14px; }
  .brand span { display: none; }
  .features { grid-template-columns: 1fr; }
  .reveal { margin-left: 10px; padding-left: 14px; }
  .nav { padding-bottom: 22px; }
  .btn { padding: 0 22px; }
  .nav .btn-primary { flex: 1; }
  .actions .btn { flex: 1 1 auto; }
}

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