:root {
  --azzurro: #00aff0;
  --azzurro-scuro: #0091c8;
  --azzurro-chiaro: #e6f7fe;
  --testo: #1f2328;
  --grigio: #8a96a3;
  --grigio-chiaro: #f2f4f6;
  --bordo: #e7eaee;
  --bianco: #ffffff;
  --verde: #34c759;
  --rosso: #e5484d;
  --raggio: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--testo);
  background: var(--grigio-chiaro);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- profilo ---------- */
.pagina {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bianco);
  padding-bottom: 40px;
}
.copertina {
  height: 168px;
  background: linear-gradient(135deg, #00aff0, #7fd6f7);
  overflow: hidden;
}
.copertina img { width: 100%; height: 100%; object-fit: cover; display: block; }
.testa { padding: 0 16px 8px; }
.riga-avatar { display: flex; align-items: flex-end; justify-content: space-between; margin-top: -46px; }
.avatar { position: relative; width: 96px; height: 96px; }
.avatar img {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; display: block;
  border: 4px solid var(--bianco); background: var(--grigio-chiaro);
}
.pallino-online {
  position: absolute; right: 7px; bottom: 7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--verde); border: 3px solid var(--bianco);
}
.tondo {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--bordo); background: var(--bianco);
  display: inline-flex; align-items: center; justify-content: center; color: var(--azzurro);
}
.tondo svg { width: 20px; height: 20px; }
.tondo.piatto { border: 0; color: var(--testo); }
.nome { font-size: 22px; line-height: 1.2; margin: 10px 0 2px; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.spunta { width: 20px; height: 20px; flex: none; }
.spunta circle { fill: var(--azzurro); stroke: none; }
.spunta path { stroke: var(--bianco); stroke-width: 2.4; }
.sotto { margin: 0; color: var(--grigio); font-size: 14px; }
.punto { margin: 0 6px; }
.bio { margin: 12px 0 16px; font-size: 15px; line-height: 1.45; white-space: pre-line; }
.cta {
  width: 100%; min-height: 50px; border: 0; border-radius: 999px; background: var(--azzurro); color: var(--bianco);
  font-size: 16px; font-weight: 700; letter-spacing: .2px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 18px rgba(0, 175, 240, .28);
}
.cta:hover { background: var(--azzurro-scuro); }
.cta:disabled { opacity: .6; cursor: default; }
.cta svg { width: 20px; height: 20px; }
.account { font-size: 13px; color: var(--grigio); text-align: center; margin: 12px 0 0; }
.link { background: none; border: 0; padding: 0; color: var(--azzurro); font-weight: 600; }
.schede { display: flex; border-bottom: 1px solid var(--bordo); margin-top: 18px; }
.scheda { flex: 1; text-align: center; padding: 14px 0 12px; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--grigio); }
.scheda.attiva { color: var(--testo); box-shadow: inset 0 -2px 0 var(--azzurro); }
.scheda small { font-weight: 500; text-transform: none; letter-spacing: 0; }
.riquadro { margin: 16px; padding: 16px 18px; border-radius: var(--raggio); background: var(--grigio-chiaro); }
.riquadro h2 { margin: 0 0 8px; font-size: 15px; }
.riquadro ol { margin: 0; padding-left: 20px; color: #4a5560; font-size: 14px; line-height: 1.6; }
.piede { text-align: center; color: var(--grigio); font-size: 12px; margin-top: 28px; }

/* ---------- chat ---------- */
.chat {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  max-width: 600px; margin: 0 auto; background: var(--bianco);
  height: 100vh; height: 100dvh;
}
.chat-testa {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--bordo); background: var(--bianco);
}
.mini { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.chi { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chi strong { font-size: 16px; }
.chi small { color: var(--grigio); font-size: 12px; }
.messaggi { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.giorno { align-self: center; color: var(--grigio); font-size: 12px; margin: 12px 0 6px; text-transform: capitalize; }
.bolla { max-width: 78%; padding: 9px 13px 6px; border-radius: 18px; font-size: 15px; line-height: 1.38; word-wrap: break-word; overflow-wrap: anywhere; }
.bolla p { margin: 0; white-space: pre-wrap; }
.bolla time { display: block; font-size: 11px; margin-top: 3px; text-align: right; opacity: .75; }
.bolla.mia { align-self: flex-end; background: var(--azzurro); color: var(--bianco); border-bottom-right-radius: 6px; }
.bolla.sua { align-self: flex-start; background: var(--grigio-chiaro); color: var(--testo); border-bottom-left-radius: 6px; }
.bolla.in-volo { opacity: .55; }
.vuoto { margin: auto; text-align: center; color: var(--grigio); font-size: 14px; max-width: 280px; line-height: 1.5; }
.vuoto img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; display: block; margin: 0 auto 10px; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--bordo); background: var(--bianco);
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--bordo); border-radius: 22px; padding: 11px 16px;
  font: 16px/1.35 var(--font); max-height: 140px; outline: none; background: var(--grigio-chiaro);
}
.composer textarea:focus { border-color: var(--azzurro); background: var(--bianco); }
.invia { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--azzurro); color: var(--bianco); display: flex; align-items: center; justify-content: center; flex: none; }
.invia:disabled { opacity: .5; }
.invia svg { width: 20px; height: 20px; }
.avviso { align-self: center; background: #fff4f4; color: var(--rosso); font-size: 13px; padding: 6px 12px; border-radius: 12px; margin: 6px 0; }

/* ---------- iscrizione / accesso ---------- */
.velo {
  position: fixed; inset: 0; background: rgba(15, 20, 25, .45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 10;
}
.foglio {
  position: relative; width: 100%; max-width: 480px; background: var(--bianco);
  border-radius: 22px 22px 0 0; padding: 22px 20px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  animation: sale .22s ease-out;
}
@media (min-width: 640px) {
  .velo { align-items: center; }
  .foglio { border-radius: 22px; }
}
@keyframes sale { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.foglio h2 { margin: 0 0 14px; font-size: 19px; }
.chiudi { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--grigio); padding: 6px; }
.scelta { display: flex; background: var(--grigio-chiaro); border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.scelta button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 9px 0; font-weight: 700; font-size: 14px; color: var(--grigio); }
.scelta button.attivo { background: var(--bianco); color: var(--testo); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
#form-auth label { display: block; font-size: 13px; font-weight: 600; color: #4a5560; margin-bottom: 12px; }
#form-auth input[type=email], #form-auth input[type=text], #form-auth input[type=password] {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: 16px var(--font);
  border: 1px solid var(--bordo); border-radius: 12px; outline: none;
}
#form-auth input:focus { border-color: var(--azzurro); }
#form-auth .spunta-18 { display: flex; align-items: center; gap: 8px; font-weight: 500; }
#form-auth .spunta-18 input { width: 18px; height: 18px; accent-color: var(--azzurro); margin: 0; }
.foglio.accedi .solo-iscrizione { display: none !important; }
.errore { color: var(--rosso); font-size: 13px; min-height: 18px; margin: 0 0 10px; }
