/* "Dove sono?" — aspetto da social network: interfaccia neutra, le foto al
   centro, un solo colore d'accento. Chiaro o scuro in base al dispositivo. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f1f1f3;
  --line: #dcdce1;
  --text: #0f0f10;
  --muted: #73737a;
  --accent: #ff3b5c;
  --accent-text: #ffffff;
  --ok: #17a05d;
  --danger: #e0364c;
  --note: #fff5d1;
  --ring: linear-gradient(45deg, #ffb13d, #ff3b5c 55%, #b33bff);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 0px;
  color-scheme: light;
}

/* Tema scuro: lo attiva theme.js in base all'orario (o alla scelta nel profilo). */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #101012;
  --soft: #1e1e22;
  --line: #2b2b31;
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --note: #2b2512;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  overflow-x: hidden;
}

body.has-tabs { --tabs-h: 52px; }

a { color: inherit; }

/* ---------- intestazione e navigazione ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 480px;
  height: 52px;
  margin: 0 auto;
  padding: 0 16px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }

.userchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 190px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.userchip.plain {
  padding: 7px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
}

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1100;
  display: flex;
  height: calc(52px + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.tabs a.on { color: var(--text); }
.tabs .ico { width: 27px; height: 27px; }
.tabs a.on .ico { stroke-width: 2.4; }

.wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px calc(28px + var(--tabs-h) + var(--safe-b));
}
.wrap.has-bar { padding-bottom: calc(96px + var(--tabs-h) + var(--safe-b)); }

h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -0.4px; margin: 6px 0 6px; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
h2.section { margin: 26px 0 12px; }
p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.grad-text { color: inherit; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 14px 0;
}

/* ---------- bottoni ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  margin: 8px 0;
  transition: opacity 0.12s ease, transform 0.08s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.ghost { background: var(--soft); color: var(--text); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.danger, .mini.danger { color: var(--danger); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.btn .socials { display: inline-flex; align-items: center; gap: 6px; margin-right: 2px; }
.ico { width: 20px; height: 20px; flex: none; display: block; }

.nametag { display: inline-flex; align-items: center; gap: 0.3em; min-width: 0; max-width: 100%; color: inherit; text-decoration: none; }
.nametag .ico { width: 0.95em; height: 0.95em; }

/* pulsante principale fisso in basso (sopra la navigazione, se c'è) */
.bar {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--tabs-h);
  z-index: 1000;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
body.has-tabs .bar { padding-bottom: 10px; bottom: calc(52px + var(--safe-b)); }
.bar-in { max-width: 448px; margin: 0 auto; }
.bar .btn { margin: 0; }

/* ---------- campi ---------- */

input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--muted); }
input::placeholder { color: var(--muted); }
input[type="file"] { display: none; }

.field { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field:first-child { margin-top: 0; }
.field.social-label { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.field.social-label .ico { display: inline-block; width: 15px; height: 15px; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 0;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.chip.on { background: var(--text); color: var(--bg); }
/* un campo subito sotto un gruppo di pillole non deve restarci attaccato */
.chips + input { margin-top: 10px; }
.chip .ico { display: inline-block; width: 15px; height: 15px; vertical-align: -2.5px; }

/* ---------- foto (come un post: a tutta larghezza) ---------- */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 52vh;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--soft);
  text-align: center;
  cursor: pointer;
}
.drop .emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--bg);
  margin-bottom: 10px;
}
.drop .emoji .ico { width: 30px; height: 30px; }
.drop .title { font-size: 18px; font-weight: 700; }

.shot {
  position: relative;
  margin: 0 -16px;
  background: #000;
}
.shot img { display: block; width: 100%; max-height: 66vh; object-fit: contain; }
.shot .tag {
  position: absolute;
  left: 12px; bottom: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 24px);
  padding: 6px 11px 6px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.shot .tag .ico { width: 15px; height: 15px; }
.shot .tag .avatar { display: none; }
.shot .swap {
  position: absolute;
  right: 12px; top: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
@media (min-width: 520px) {
  .shot { margin: 0; border-radius: 6px; border: 1px solid var(--line); }
}

/* foto che si svela piano: le versioni sfocate sono immagini minuscole,
   ingrandite e ammorbidite perché non si vedano i quadretti */
.shot { overflow: hidden; }
.shot img.soft { filter: blur(9px); transform: scale(1.08); }
.reveal-badge {
  position: absolute;
  left: 12px; right: 12px; top: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* codice di recupero: grande, a caratteri di larghezza fissa, facile da ricopiare */
.code, input.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  letter-spacing: 0.06em;
}
.code {
  padding: 16px 10px;
  border-radius: 12px;
  background: var(--soft);
  font-size: clamp(15px, 4.6vw, 20px);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  user-select: all;
  -webkit-user-select: all;
}
.code + .row { margin-top: 10px; }
.code + .row .btn { margin: 0; }
input.mono { text-transform: uppercase; }
input.mono::placeholder { text-transform: none; letter-spacing: 0.06em; }
.security form + form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.security input + input { margin-top: 8px; }
a.linklike { display: inline-block; }

/* segnalazione: un link discreto che apre un piccolo modulo */
.report { margin: 18px 0 4px; text-align: center; }
.report form { text-align: left; }
.report input { margin-top: 12px; }
.linklike {
  background: none;
  border: 0;
  padding: 8px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* pannello: righe con più pulsanti e nota della segnalazione */
.rowitem.wrap { flex-wrap: wrap; align-items: flex-start; }
/* nelle segnalazioni il testo si legge per intero e i pulsanti vanno a capo */
.rowitem.wrap .rowmain b, .rowitem.wrap .rowmain .muted { white-space: normal; }
.rowitem.wrap .actions { flex: 1 1 100%; }
.rowitem.wrap .actions .mini { flex: 1; min-height: 38px; }
.actions { display: flex; gap: 6px; flex: none; }
.rowmain .note { font-size: 13px; padding: 6px 10px; margin-top: 4px; border-radius: 8px; background: var(--soft); white-space: normal; }
.board .mini { min-height: 28px; padding: 3px 9px; font-size: 12px; }

.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar.big { width: 44px; height: 44px; font-size: 18px; }

/* intestazione della sfida: chi ti sfida */
.author { display: flex; align-items: center; gap: 12px; margin: 2px 0 12px; }
.author .name { font-size: 15px; font-weight: 700; line-height: 1.25; }
.author .muted { font-size: 13px; }

/* ---------- posizione ---------- */

.geo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 4px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.geo.ok { color: var(--ok); }
.geo.bad { color: var(--text); background: var(--note); border-radius: 12px; }

/* ---------- mappa ---------- */

.map-wrap { position: relative; margin: 10px 0; }
.map {
  height: min(52vh, 420px);
  min-height: 280px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  z-index: 0;
}
.map-hint {
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%);
  z-index: 500;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.pin {
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.pin.guess { background: var(--accent); }
.pin.answer { background: var(--ok); }
.pin.other { background: #6f7480; width: 16px; height: 16px; border-width: 2px; }

.leaflet-container { background: #e9e9ec; font: inherit; }
.leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; }

/* mappa "I miei posti" sul profilo */
.map.places { height: 260px; min-height: 0; }
.place-card { display: flex; align-items: center; gap: 10px; color: #0f0f10; text-decoration: none; font-size: 13px; }
.place-card img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: #ddd; }
.place-card span { display: flex; flex-direction: column; color: #73737a; }
.place-card b { color: #0f0f10; font-weight: 600; }
.leaflet-popup-content { margin: 10px 12px; }

/* ---------- risultato ---------- */

.result { text-align: center; padding: 22px 16px 18px; }
.result .emoji { display: none; }
.result .big { font-size: 54px; line-height: 1.05; font-weight: 800; letter-spacing: -2px; margin: 4px 0 0; }

/* numeri in riga, come sul profilo di un social */
.stats { display: flex; margin-top: 14px; }
.stat { flex: 1; text-align: center; padding: 0 4px; }
.stat b { display: block; font-size: 18px; font-weight: 700; line-height: 1.2; }
.stat span { font-size: 13px; color: var(--muted); }

/* classifica come un elenco di persone */
.board { list-style: none; margin: 0 -8px; padding: 0; }
.board li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.board li.me { background: var(--soft); }
.board .pos { width: 22px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.board .avatar { width: 40px; height: 40px; font-size: 16px; }
.board .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* Sotto il nome, il posto che ha scritto chi ha risposto: si legge per intero,
   andando a capo se serve. Il nome resta su una riga. */
.board li { flex-wrap: wrap; }
.board .who { white-space: normal; overflow: visible; }
.board .who .nametag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .who .place { display: block; margin-top: 1px; font-size: 13px; font-weight: 400; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
/* giudizio dell'autore sul posto */
.verdict { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; vertical-align: 1px; }
.verdict.ok { background: rgba(23, 160, 93, 0.16); color: var(--ok); }
.verdict.no { background: rgba(224, 54, 76, 0.16); color: var(--danger); }
/* riga di azioni dell'autore, sotto la risposta */
.board .acts { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
.board .acts .mini { min-height: 32px; padding: 4px 11px; font-size: 13px; }
.mini.on.ok { background: var(--ok); color: #fff; }
.mini.on.no { background: var(--danger); color: #fff; }
.board .dist { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.board .pts { min-width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- condivisione ---------- */

.linkbox {
  word-break: break-all;
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}
.howto { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: step; }
.howto li { position: relative; padding: 5px 0 5px 32px; font-size: 14px; color: var(--muted); counter-increment: step; }
.howto li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}
.share-note { min-height: 18px; font-size: 13px; font-weight: 600; color: var(--ok); text-align: center; }

.story-preview { margin: 2px 0 14px; text-align: center; }
.story-preview img {
  display: block;
  width: 54%;
  max-width: 220px;
  margin: 0 auto 8px;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  background: var(--soft);
}
.story-preview span { display: block; font-size: 13px; color: var(--muted); }
.preview-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }

/* finestra di conferma dell'app: sale dal basso sul telefono, al centro sul computer */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + var(--safe-b));
  background: rgba(0, 0, 0, 0.6);
  animation: modal-fade 0.15s ease-out;
}
.modal {
  width: 100%;
  max-width: 420px;
  padding: 22px 16px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  animation: modal-rise 0.18s ease-out;
}
.modal-text { margin: 0 4px 18px; font-size: 16px; line-height: 1.4; text-align: center; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; margin: 0; }
.btn.danger-solid { background: var(--danger); color: #fff; }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { transform: translateY(16px); opacity: 0; } }
@media (min-width: 520px) { .modal-back { align-items: center; } }
@media (prefers-reduced-motion: reduce) { .modal-back, .modal { animation: none; } }

/* foto a tutto schermo, aperta toccando l'anteprima */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-b));
  background: rgba(0, 0, 0, 0.94);
  cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 12px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.warn { margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: var(--note); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; text-align: center; }

/* ---------- profilo: la mappa dei propri posti fa da copertina ---------- */

.cover {
  position: relative;
  height: 200px;
  margin: -14px -16px 0;
  background: var(--soft);
  overflow: hidden;
}
.cover .map { height: 100%; min-height: 0; border: 0; border-radius: 0; }
.cover.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 32px 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.cover.empty .ico { width: 30px; height: 30px; }
@media (min-width: 520px) { .cover { margin: 0; border-radius: 16px; } }

/* foto profilo a cavallo della copertina, nome e impostazioni */
/* La foto profilo sporge di 24px sulla copertina; sotto restano 52px, in cui
   nome e pulsante Impostazioni stanno alla stessa altezza, centrati. */
.pid { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 12px; margin-top: -24px; }
.avatar.xl { width: 76px; height: 76px; font-size: 32px; border: 4px solid var(--bg); }
.pid-text { flex: 1; min-width: 0; padding-bottom: 4px; }
.pid-name { font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -0.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pid-text .muted { line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pid .mini { margin-bottom: 10px; text-decoration: none; display: inline-flex; align-items: center; }

/* i numeri del profilo, scritti come una frase */
.facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.facts b { color: var(--text); font-weight: 700; }

/* le sfide come schede: foto, risposte, chi è in testa */
.wrap > .chips { margin-top: 14px; }
.cards { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.ch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.ch:active { background: var(--soft); }
.ch img { flex: none; width: 84px; height: 84px; border-radius: 12px; object-fit: cover; background: var(--soft); }
.ch-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-main b { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-top, .ch-lead { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch > .ico { width: 18px; height: 18px; color: var(--muted); }
.ch-pts { font-size: 18px; font-weight: 700; padding-right: 4px; font-variant-numeric: tabular-nums; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tagchip { padding: 2px 8px; border-radius: 999px; background: var(--soft); font-size: 11px; font-weight: 600; color: var(--muted); }
.tagchip.alert { background: var(--note); color: var(--text); }
.empty { padding: 28px 0; text-align: center; }

/* ---------- pannello: una scheda per voce, informazioni sopra e azioni sotto ---------- */

.wrap > .chips + input { margin-top: 12px; }
.acard {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.acard-top { display: flex; align-items: center; gap: 12px; }
.acard-pic { flex: none; line-height: 0; }
.acard-pic img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--soft); }
.acard-top > .avatar { width: 56px; height: 56px; font-size: 22px; }
.acard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acard-main b { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.acard-main .muted { font-size: 13px; overflow-wrap: anywhere; }
.acard-main .note { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--soft); font-size: 13px; overflow-wrap: anywhere; }
.acard-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.acard-actions .mini {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 6px 8px;
  text-align: center;
  text-decoration: none;
}

/* ---------- profilo: testata, schede, impostazioni ---------- */

.profile-head { display: flex; align-items: center; gap: 8px; }
.profile-head .author { flex: 1; min-width: 0; margin-bottom: 6px; }
.icon-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--text);
}
.icon-btn:active { background: var(--soft); }
.icon-btn .ico { width: 24px; height: 24px; }
.profile-actions { margin-top: 12px; }
.profile-actions .btn { margin: 0; }

/* schede con icona: una sola sezione visibile alla volta */
.seg { display: flex; margin: 16px -16px 14px; border-top: 1px solid var(--line); }
.seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: -1px;
  padding: 11px 0;
  background: none;
  border: 0;
  border-top: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn .ico { width: 19px; height: 19px; }
.seg-btn.on { color: var(--text); border-top-color: var(--text); }
@media (min-width: 520px) { .seg { margin-left: 0; margin-right: 0; } }

.page-head { display: flex; align-items: center; gap: 2px; margin: -2px 0 4px -10px; }
.page-head h1 { margin: 0; font-size: 20px; }

.menu { margin: 14px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:active { background: var(--soft); }
.menu-row .ico { width: 18px; height: 18px; color: var(--muted); }

/* ---------- profilo: griglia di foto come su un social ---------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -16px; }
.tile { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--soft); color: #fff; text-decoration: none; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-top { display: none; }
.tile-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 7px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  font-size: 0;
}
.tile-info b { font-size: 12px; font-weight: 600; }
@media (min-width: 520px) { .grid { margin: 0; } }

.rows { display: flex; flex-direction: column; }
.rowitem { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--text); text-decoration: none; }
.rowitem > a { flex: none; line-height: 0; }
.thumb { flex: none; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.rowmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rowmain b, .rowmain .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowmain b { font-weight: 600; }
.rowmain .muted { font-size: 13px; }
.rowitem .pts { font-weight: 700; }

.mini {
  flex: none;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 0;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- consenso, note legali ---------- */

.check { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 4px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }

.legal-links { margin: 24px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.legal-links a { margin: 0 6px; text-decoration: none; }

.legal h2 { margin: 24px 0 6px; font-size: 16px; }
.legal p, .legal li { font-size: 15px; }
.legal ul { margin: 6px 0; padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal .draft { padding: 10px 12px; border-radius: 12px; background: var(--note); font-size: 13px; }

/* ---------- pagina di benvenuto ---------- */

body.wide .top-in, body.wide .wrap { max-width: 900px; }

.gate { display: grid; gap: 18px; padding-top: 6px; }
.gate-art { display: flex; justify-content: center; }

/* telefono con un post di esempio */
.phone {
  width: min(290px, 80vw);
  border-radius: 34px;
  border: 7px solid var(--text);
  background: var(--bg);
  overflow: hidden;
  font-size: 13px;
}
.phone .author { margin: 0; padding: 10px 12px 8px; gap: 8px; }
.phone .author .avatar { width: 30px; height: 30px; font-size: 13px; }
.phone .author .name { font-size: 13px; }
.phone .author .muted { font-size: 11px; }
/* una foto fuori fuoco: il posto è un mistero */
.mock-shot {
  position: relative;
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(38% 30% at 72% 30%, rgba(255, 226, 170, 0.95), transparent 70%),
    radial-gradient(60% 40% at 25% 62%, rgba(40, 60, 110, 0.75), transparent 75%),
    radial-gradient(50% 30% at 80% 70%, rgba(30, 50, 90, 0.6), transparent 75%),
    linear-gradient(180deg, #4f79c9 0%, #9d8fc4 34%, #f0a184 54%, #315a78 56%, #17344d 100%);
}
.mock-shot .tag { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 4px; padding: 5px 10px 5px 7px; border-radius: 999px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 12px; font-weight: 600; }
.mock-shot .tag .ico { width: 13px; height: 13px; }
.phone .board { margin: 0; padding: 6px 6px 10px; }
.phone .board li { padding: 5px 6px; gap: 8px; }
.phone .board .avatar { width: 28px; height: 28px; font-size: 12px; }
.phone .board .pos { width: 14px; font-size: 12px; }
.phone .board .dist { font-size: 12px; }
.phone-cap { padding: 8px 12px 0; font-weight: 600; }
.phone-cap span { color: var(--muted); font-weight: 400; }

.gate-card { margin: 0; padding: 26px 22px 22px; text-align: center; }
.gate-card .logo { display: block; font-size: 38px; letter-spacing: -1.6px; margin-bottom: 8px; }
.gate-card .tagline { font-size: 16px; color: var(--muted); margin: 0 auto 18px; max-width: 18em; }
.gate-card .btn { margin: 8px 0 0; }
.gate-steps { list-style: none; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); text-align: left; }
.gate-steps li { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; }
.gate-steps .ico { width: 22px; height: 22px; color: var(--text); }
.gate-steps span { color: var(--muted); }
.gate-steps b { color: var(--text); font-weight: 600; }
.gate-alt { margin: 10px 0 0; padding: 16px; text-align: center; font-size: 14px; color: var(--muted); }
.gate-alt b { color: var(--text); font-weight: 600; }
.gate-cta { display: none; }

@media (min-width: 860px) {
  body.wide .bar { display: none; }
  body.wide .wrap.has-bar { padding-bottom: 40px; }
  .gate { grid-template-columns: 1fr 380px; gap: 56px; align-items: center; padding: 56px 0 30px; }
  .gate-art { justify-content: flex-end; }
  .phone { width: 320px; }
  .gate-cta { display: block; }
}

@media (max-width: 360px) {
  .result .big { font-size: 46px; }
  .chip { padding: 7px 10px; font-size: 13px; }
}

/* accesso con TikTok */
.or-box { margin: 4px 0 12px; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.tiktok { background: #000; color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; border: 1px solid rgba(255, 255, 255, 0.28); }
.btn.tiktok svg { width: 20px; height: 20px; flex: none; }

/* ---------- opzioni della sfida: una scelta per riga ---------- */
.opts { padding-top: 4px; padding-bottom: 4px; }
.opt { padding: 14px 0; }
.opt + .opt { border-top: 1px solid var(--line); }
.opt-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.opt-hint { margin: 8px 2px 0; font-size: 13px; line-height: 1.35; color: var(--muted); min-height: 2.7em; }
.opt-safe { margin: 10px 4px 0; font-size: 12px; color: var(--muted); text-align: center; }
/* selettore a segmenti: un'unica barra, tutte le voci larghe uguali */
.chips.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; padding: 3px; border-radius: 12px; background: var(--soft); }
.chips.segs .chip { min-width: 0; min-height: 36px; padding: 6px 4px; border-radius: 9px; background: transparent; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.chips.segs .chip.on { background: var(--text); color: var(--bg); }
@media (max-width: 360px) { .chips.segs .chip { font-size: 12px; padding: 6px 1px; letter-spacing: -0.2px; } }
/* messaggio di stato su piu righe: angoli meno tondi */
.geo.wide { border-radius: 12px; line-height: 1.35; }

/* ---------- notifiche: elenco delle attività ---------- */
.tabs a { position: relative; }
.tabs .dot {
  position: absolute; top: 7px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
  border: 2px solid var(--bg); box-sizing: content-box;
}
.note-head { margin: 18px 0 4px; font-size: 15px; font-weight: 700; }
.notes { margin: 0 -16px; }
.note { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--text); text-decoration: none; }
.note:active { background: var(--soft); }
.note.new { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.note .avatar { flex: none; width: 44px; height: 44px; font-size: 18px; }
.note .avatar.sys { background: var(--soft); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.note .avatar.sys .ico { width: 22px; height: 22px; }
.note-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.note-time { color: var(--muted); white-space: nowrap; }
.note-thumb { flex: none; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--soft); }
.note-foot { margin-top: 22px; font-size: 13px; color: var(--muted); text-align: center; }
