/* Global Reunion · Cruise Edition
   Palette del logo: blu, lime, azzurro, rosa, blu notte. Anton (OFL) per i titoli,
   font di sistema per il testo: nessuna risorsa esterna, tutto servito dal nostro dominio. */
@font-face {
  font-family: "Anton";
  src: url(/anton.woff2) format("woff2");
  font-display: swap;
}

:root {
  --brand: #286AD8;
  --brand-dark: #1D55B8;
  --lime: #EDFB8A;
  --sky: #07A2FF;
  --pink: #F8A0F8;
  --ink: #07253D;
  --bg: #F3F6FB;
  --panel: #ffffff;
  --text: #07253D;
  --muted: #5E7089;
  --line: #E4EAF3;
  --hover: #EEF3FB;
  --bubble-me: #EDFB8A;
  --bubble-me-text: #07253D;
  --bubble-me-meta: rgba(7, 37, 61, .55);
  --bubble-other: #ffffff;
  --chat-bg: #E9EFF8;
  --shadow: 0 1px 2px rgba(7, 37, 61, .08), 0 2px 8px rgba(7, 37, 61, .06);
  --link: #286AD8;
  --danger: #D7263D;
  --c0: #286AD8; --c1: #B026B0; --c2: #0077C2; --c3: #5E6B00; --c4: #07253D;
  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --sheet-radius: 24px;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%2307253D' stroke-opacity='.07' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M14 40q10-10 20 0t20 0t20 0'/%3E%3Cpath d='M100 146q10-10 20 0t20 0t20 0'/%3E%3C/g%3E%3Cg fill='%2307253D' fill-opacity='.06'%3E%3Cpath d='M136 24l5 12 13 1-10 8 3 13-11-7-11 7 3-13-10-8 13-1z'/%3E%3Cpath d='M40 112c8-6 20-2 22 8s-6 18-16 16-14-18-6-24z'/%3E%3Ccircle cx='96' cy='80' r='4'/%3E%3Ccircle cx='164' cy='100' r='3'/%3E%3Ccircle cx='22' cy='166' r='3'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1524;
    --panel: #0F1E34;
    --text: #EEF3FA;
    --muted: #93A6C2;
    --line: #1B2F4D;
    --hover: #15294A;
    --bubble-me: #286AD8;
    --bubble-me-text: #ffffff;
    --bubble-me-meta: rgba(255, 255, 255, .7);
    --bubble-other: #17294A;
    --chat-bg: #07101C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --link: #8DB8FF;
    --c0: #8DB8FF; --c1: #F8A0F8; --c2: #5CC4FF; --c3: #EDFB8A; --c4: #C9D6E8;
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M14 40q10-10 20 0t20 0t20 0'/%3E%3Cpath d='M100 146q10-10 20 0t20 0t20 0'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.045'%3E%3Cpath d='M136 24l5 12 13 1-10 8 3 13-11-7-11 7 3-13-10-8 13-1z'/%3E%3Cpath d='M40 112c8-6 20-2 22 8s-6 18-16 16-14-18-6-24z'/%3E%3Ccircle cx='96' cy='80' r='4'/%3E%3Ccircle cx='164' cy='100' r='3'/%3E%3Ccircle cx='22' cy='166' r='3'/%3E%3C/g%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1524;
  --panel: #0F1E34;
  --text: #EEF3FA;
  --muted: #93A6C2;
  --line: #1B2F4D;
  --hover: #15294A;
  --bubble-me: #286AD8;
  --bubble-me-text: #ffffff;
  --bubble-me-meta: rgba(255, 255, 255, .7);
  --bubble-other: #17294A;
  --chat-bg: #07101C;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --link: #8DB8FF;
  --c0: #8DB8FF; --c1: #F8A0F8; --c2: #5CC4FF; --c3: #EDFB8A; --c4: #C9D6E8;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.05' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M14 40q10-10 20 0t20 0t20 0'/%3E%3Cpath d='M100 146q10-10 20 0t20 0t20 0'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.045'%3E%3Cpath d='M136 24l5 12 13 1-10 8 3 13-11-7-11 7 3-13-10-8 13-1z'/%3E%3Cpath d='M40 112c8-6 20-2 22 8s-6 18-16 16-14-18-6-24z'/%3E%3Ccircle cx='96' cy='80' r='4'/%3E%3Ccircle cx='164' cy='100' r='3'/%3E%3Ccircle cx='22' cy='166' r='3'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Comportamento da app: niente zoom con doppio tocco, niente "rimbalzo" della pagina,
   niente selezione accidentale dell'interfaccia (il testo dei messaggi resta selezionabile). */
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
/* Su iPhone, aperta dalla Home, la pagina scorre sotto la barra di stato (black-translucent):
   lo sfondo del documento è blu, così dietro ora e batteria si vede sempre il blu della testata. */
html { background: var(--brand); }
/* Safari su iPhone ignora overflow:hidden sul documento: fissiamo la pagina allo schermo,
   così scorrono solo lista e messaggi. L'altezza segue lo spazio sopra la tastiera (--app-h). */
body { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); width: 100%; }
.kb-open .composer { padding-bottom: 10px; }
.list, .messages, #modal-body, #login { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, .msg .text { -webkit-user-select: text; user-select: text; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Blu: iOS colora la barra di stato (e la barra di Safari) in base allo sfondo della pagina.
     Lista e chat hanno i loro sfondi, quindi il blu si vede solo lì in alto. */
  background: var(--brand);
  color: var(--text);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 4px 0 0; font-size: 14px; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .3px; text-transform: uppercase; }

/* ---------- Accesso ---------- */
.screen { height: 100%; }
.brand { text-align: center; color: #fff; margin-bottom: 18px; }
.brand-logo { width: min(100%, 340px); height: auto; display: block; margin: 0 auto; }
.brand-sub { margin: 10px 0 0; font-size: 15px; font-weight: 600; }
#login {
  display: flex; align-items: center; justify-content: center; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px 110px;
  background: var(--brand) url(/waves.jpg) repeat-x center bottom / auto 110px;
}
.login-wrap { width: 100%; max-width: 400px; margin: auto; }
.login-card {
  background: var(--panel); border-radius: 26px; padding: 22px 20px 18px;
  box-shadow: 0 16px 50px rgba(7, 37, 61, .4);
}
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 10px; }
.login-card label { font-size: 13px; font-weight: 700; color: var(--text); }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg);
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(40, 106, 216, .15); }
.login-card button[type=submit] {
  margin-top: 4px; padding: 13px 14px 12px; border: 0; border-radius: 999px;
  background: var(--lime); color: #07253D; box-shadow: inset 0 0 0 2px #07253D, 0 4px 0 #07253D;
  font-family: var(--display); font-size: 20px; letter-spacing: 1px; text-transform: uppercase;
  transition: transform .1s, box-shadow .1s;
}
.login-card button[type=submit]:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #07253D, 0 1px 0 #07253D; }
.hint { margin: 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.4; }
.login-title { margin: 0 0 2px; font-family: var(--display); font-size: 24px; letter-spacing: .5px; text-transform: uppercase; color: var(--text); text-align: center; }
.email-row { position: relative; }
.login-card input[readonly] { color: var(--muted); padding-right: 84px; }
.link-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  color: var(--link); font-weight: 800; font-size: 14px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
#otp { font-size: 22px; letter-spacing: 6px; font-weight: 800; font-variant-numeric: tabular-nums; padding-right: 150px; }
#otp::placeholder { font-size: 16px; letter-spacing: 0; font-weight: 400; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.pw-wrap { position: relative; }
.login-card .pw-wrap input, .pw-wrap input { padding-right: 48px; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent;
  width: 40px; height: 40px; border-radius: 10px; font-size: 17px; cursor: pointer; opacity: .55;
}
.pw-eye.on { opacity: 1; }
.login-card .field { animation: fade .25s ease-out; }

/* ---------- Pulsanti comuni ---------- */
.btn {
  padding: 13px 18px; border: 0; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 800;
  font-size: 16px;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }
.btn.danger { background: var(--danger); }
.btn.lime { background: var(--lime); color: #07253D; box-shadow: inset 0 0 0 2px #07253D; }
.confirm-row { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-row .btn { padding: 10px 18px; }

/* ---------- Layout ---------- */
#app { display: flex; overflow: hidden; }
#sidebar {
  position: relative; width: 390px; max-width: 100%; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line);
}
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
#chat-view { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--chat-bg) var(--pattern); }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand); color: #fff; min-height: 62px;
}
.bar-logo { height: 44px; width: auto; display: block; }
.bar-actions { display: flex; align-items: center; gap: 2px; }
.icon {
  background: transparent; border: 0; color: inherit; width: 42px; height: 42px; font-size: 22px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: background .15s;
}
.icon:hover { background: rgba(255, 255, 255, .14); }
.back { display: none; }
.waves-strip { height: 26px; flex: none; background: var(--brand) url(/waves.jpg) repeat-x center 55% / auto 70px; }

/* ---------- Avatar (colori dell'evento) ---------- */
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 16px; letter-spacing: .3px;
  background: var(--brand); color: #fff; user-select: none;
}
.av-0 { background: #286AD8; color: #fff; }
.av-1 { background: #F8A0F8; color: #07253D; }
.av-2 { background: #07A2FF; color: #07253D; }
.av-3 { background: #EDFB8A; color: #07253D; }
.av-4 { background: #07253D; color: #EDFB8A; }
.av-announce { background: #F8A0F8; font-size: 22px; border-radius: 16px; }
.av-public { background: #07A2FF; font-size: 22px; border-radius: 16px; }
.av-group { background: #EDFB8A; font-size: 22px; border-radius: 16px; }
.av-staff { background: #07253D; font-size: 22px; border-radius: 16px; }
.bar .avatar { width: 38px; height: 38px; font-size: 14px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.bar .avatar.av-announce, .bar .avatar.av-public, .bar .avatar.av-group, .bar .avatar.av-staff { font-size: 19px; border-radius: 12px; }

/* ---------- Lista chat ---------- */
.offline { background: #FFD66B; color: #3a2a00; font-size: 14px; font-weight: 600; padding: 7px 12px; text-align: center; }
.search { padding: 10px 12px 6px; }
.search input, .modal input[type=search], .modal input[type=text] {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: 999px; border: 0; background: var(--bg) no-repeat 14px center / 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E7089' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  outline: none; font-size: 16px;
}
.modal input[type=text] { padding-left: 16px; background-image: none; }
.search input:focus, .modal input:focus { box-shadow: 0 0 0 2px var(--brand); }

.tabs { display: flex; gap: 6px; padding: 6px 12px 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; border: 0; border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 700;
  background: var(--bg); color: var(--muted); transition: background .15s, color .15s;
}
.tabs button.on { background: var(--ink); color: var(--lime); }
.tabs button .n { margin-left: 6px; background: var(--pink); color: #07253D; border-radius: 999px; padding: 0 6px; font-size: 12px; }

.list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 1; }
.list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px; cursor: pointer; border-radius: 18px;
  transition: background .12s;
}
.list li + li { margin-top: 2px; }
.list li:hover { background: var(--hover); }
.list li.active { background: var(--hover); box-shadow: inset 4px 0 0 var(--brand); }
.list .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.list .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.list .name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .time { font-size: 12px; color: var(--muted); flex: none; }
.list .preview { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.unread .preview { color: var(--text); font-weight: 600; }
.list li.unread .time { color: var(--link); font-weight: 800; }
.list .badge {
  background: var(--pink); color: #07253D; border-radius: 999px; font-size: 12px; font-weight: 800;
  min-width: 22px; height: 22px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.list .pin { color: var(--muted); display: inline-flex; flex: none; }
.list .tag { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--link); margin-left: 6px; }
.list li.checked { background: var(--hover); }
.list .check {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px var(--line); color: #07253D; font-size: 14px; font-weight: 900;
}
.list li.checked .check { background: var(--lime); box-shadow: inset 0 0 0 2px #07253D; }
.list-empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 15px; }
.list-empty .big { font-size: 34px; display: block; margin-bottom: 8px; }
#conv-list { padding-bottom: 12px; }
/* Barra in basso della lista: blu come la testata, con Info e New chat */
.list-footer {
  flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--brand);
  border-radius: 22px 22px 0 0;
}
.list-footer .fab { position: static; padding: 11px 20px 11px 16px; box-shadow: inset 0 0 0 2px #07253D, 0 3px 0 #07253D; }
.list-footer .fab:active { box-shadow: inset 0 0 0 2px #07253D, 0 1px 0 #07253D; }
/* Come su WhatsApp: righe piene separate da una linea sottile che parte dopo l'avatar */
#conv-list li:not(.list-empty) { border-radius: 14px; padding: 0 10px; gap: 14px; }
#conv-list li + li { margin-top: 0; }
#conv-list li:not(.list-empty) .info { align-self: stretch; justify-content: center; padding: 13px 2px 13px 0; border-bottom: 1px solid var(--line); }
#conv-list li:last-child .info,
#conv-list li:hover .info, #conv-list li.active .info,
#conv-list li:has(+ li:hover) .info, #conv-list li:has(+ li.active) .info { border-bottom-color: transparent; }

/* Invito ad attivare le notifiche */
.push-card {
  display: flex; align-items: center; gap: 10px; margin: 0 12px 10px; padding: 12px 10px 12px 14px;
  background: var(--ink); color: #fff; border-radius: 18px;
}
.push-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; }
.push-text strong { font-size: 15px; color: var(--lime); }
.push-text span { color: rgba(255, 255, 255, .85); }
.push-on { padding: 9px 16px; flex: none; font-size: 14px; }
.push-close { flex: none; border: 0; background: transparent; color: rgba(255, 255, 255, .7); width: 30px; height: 30px; border-radius: 50%; font-size: 14px; }

.fab {
  position: absolute; right: 16px; bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 22px 14px 18px; border: 0; border-radius: 999px;
  background: var(--lime); color: #07253D; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 0 0 2px #07253D, 0 4px 0 #07253D, 0 10px 24px rgba(7, 37, 61, .25);
  transition: transform .1s, box-shadow .1s;
}
.fab:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #07253D, 0 1px 0 #07253D; }
/* "Info" in basso a sinistra, per aprire le Useful info senza passare dal menu */
.fab-info { right: auto; left: 16px; padding: 14px 20px 14px 16px; background: var(--pink); }

/* ---------- Schermata vuota (computer) ---------- */
.chat-empty-wrap { flex: 1; display: flex; flex-direction: column; background: var(--brand); }
.chat-empty { margin: auto; text-align: center; color: #fff; padding: 20px; font-weight: 600; }
.empty-logo { width: 420px; max-width: 100%; height: auto; display: block; margin: 0 auto; }
.chat-empty p { margin-top: 18px; }
.waves-band { height: 140px; background: url(/waves.jpg) repeat-x center bottom / auto 140px; }

/* ---------- Chat aperta ---------- */
#chat-view .bar { gap: 6px; padding-left: 8px; }
.chat-title {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; background: none; border: 0; color: inherit;
  text-align: left; padding: 2px 4px; border-radius: 12px;
}
.chat-title > span:last-child { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
#chat-title {
  font-family: var(--display); font-size: 21px; letter-spacing: .4px; text-transform: uppercase; line-height: 1.05;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#chat-subtitle { color: rgba(255, 255, 255, .8); font-size: 12px; font-weight: 600; }

.messages {
  flex: 1; overflow-y: auto; padding: 12px max(12px, 5%) 10px; display: flex; flex-direction: column;
  gap: 2px; overscroll-behavior: contain;
}
.day {
  align-self: center; margin: 12px 0 8px;
  background: rgba(7, 37, 61, .78); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; padding: 5px 12px; border-radius: 999px;
}
.load-more {
  align-self: center; margin: 6px 0; background: var(--panel); border: 0; color: var(--link); font-weight: 700;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; box-shadow: var(--shadow);
}

.msg {
  max-width: min(78%, 560px); padding: 7px 11px 5px; border-radius: 18px; background: var(--bubble-other);
  align-self: flex-start; box-shadow: var(--shadow); position: relative; margin-top: 8px;
  border-top-left-radius: 6px;
}
.msg.cont { margin-top: 2px; border-top-left-radius: 18px; }
.msg.me {
  align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-text);
  border-top-left-radius: 18px; border-top-right-radius: 6px;
}
.msg.me.cont { border-top-right-radius: 18px; }
.msg .author { font-size: 13px; font-weight: 800; margin-bottom: 2px; cursor: pointer; display: block; }
.c-0 { color: var(--c0); } .c-1 { color: var(--c1); } .c-2 { color: var(--c2); } .c-3 { color: var(--c3); } .c-4 { color: var(--c4); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.38; font-size: 15.5px; }
.msg .text.jumbo { font-size: 38px; line-height: 1.15; }
.msg .meta { float: right; font-size: 11px; color: var(--muted); margin: 9px 0 -3px 12px; line-height: 1; font-variant-numeric: tabular-nums; }
.msg.me .meta { color: var(--bubble-me-meta); }
.msg::after { content: ""; display: block; clear: both; }
.msg.deleted { opacity: .75; }
.msg.deleted .text { font-style: italic; color: var(--muted); }
.msg.me.deleted .text { color: var(--bubble-me-meta); }
.msg.system {
  align-self: center; background: rgba(237, 251, 138, .9); color: #07253D; box-shadow: none; font-size: 13px; font-weight: 600;
  text-align: center; border-radius: 999px; padding: 5px 14px; margin: 10px 0;
}
.msg.appear { animation: pop .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }


.chat-hello {
  margin: auto; text-align: center; background: var(--panel); border-radius: 24px; padding: 22px 26px; box-shadow: var(--shadow);
  max-width: 300px;
}
.chat-hello .big { font-size: 42px; display: block; }
.chat-hello strong { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: .4px; text-transform: uppercase; display: block; margin: 6px 0 4px; }
.chat-hello span { color: var(--muted); font-size: 14px; }

.to-bottom {
  position: absolute; right: 16px; bottom: 84px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--panel); color: var(--text); box-shadow: 0 4px 14px rgba(7, 37, 61, .2); z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
}
.to-bottom .n {
  position: absolute; top: -6px; right: -4px; background: var(--pink); color: #07253D; font-size: 11px; font-weight: 800;
  border-radius: 999px; min-width: 20px; height: 20px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center;
}

.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 10px; margin: 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  /* Blu come la testata: su iPhone si fonde con lo spazio che iOS lascia in fondo. */
  background: var(--brand); border-radius: 22px 22px 0 0;
}
.composer textarea {
  flex: 1; resize: none; border: 0; border-radius: 24px; padding: 13px 18px; background: var(--panel);
  max-height: 140px; outline: none; line-height: 1.3; font-size: 16px; box-shadow: var(--shadow);
}
.composer textarea:focus { box-shadow: 0 0 0 2px var(--lime); }
.composer button {
  width: 48px; height: 48px; border-radius: 50%; border: 0; flex: none;
  background: rgba(255, 255, 255, .16); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; transition: background .15s, color .15s, transform .1s;
}
.composer.has-text button { background: var(--lime); color: #07253D; box-shadow: inset 0 0 0 2px #07253D; }
.composer button:active { transform: scale(.92); }
.composer button:disabled { opacity: .6; }
.readonly {
  margin: 0; text-align: center; color: #fff; font-size: 14px; font-weight: 600;
  padding: 16px 12px max(16px, env(safe-area-inset-bottom)); background: var(--brand); border-radius: 22px 22px 0 0;
}

/* ---------- Finestre (bottom sheet su telefono) ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(7, 23, 40, .55); display: flex; align-items: center; justify-content: center;
  z-index: 10; padding: 16px; animation: fade .18s ease-out;
}
.modal-card {
  background: var(--panel); width: 100%; max-width: 460px; max-height: 85dvh; border-radius: var(--sheet-radius);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: rise .22s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 8px 20px; }
.modal-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .4px; text-transform: uppercase; }
.modal-head .icon { color: var(--muted); font-size: 18px; background: var(--bg); width: 36px; height: 36px; }
#modal-body { padding: 8px 16px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
#modal-body .list { max-height: 50dvh; padding: 0; flex: none; }
#modal-body .list:empty::after { content: attr(data-empty); display: block; padding: 18px; color: var(--muted); text-align: center; font-size: 14px; }
#modal-body p { margin: 0 0 4px; line-height: 1.4; }
.menu-btn {
  display: flex; align-items: center; gap: 12px; font-weight: 700; text-align: left; background: var(--bg); border: 0;
  border-radius: 16px; padding: 14px 16px; color: var(--text); transition: background .12s;
}
.menu-btn:hover { background: var(--hover); }
.menu-btn.danger { color: var(--danger); }
.menu-btn.primary { background: var(--lime); color: #07253D; box-shadow: inset 0 0 0 2px #07253D; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { background: var(--lime); color: #07253D; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 700; }
.section-label { font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin: 6px 4px 0; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 999px; z-index: 20; max-width: calc(100vw - 32px); font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: rise .2s ease-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.toast { animation-name: toastIn; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Telefono: un pannello alla volta ---------- */
@media (max-width: 760px) {
  /* La chat entra da destra sopra la lista, come su WhatsApp/iOS: la lista resta sotto
     (e mantiene il punto in cui eri). Solo transform: fluido anche sui telefoni lenti. */
  #app { position: relative; }
  #sidebar { width: 100%; border-right: 0; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
  #chat {
    position: absolute; inset: 0; z-index: 5; transform: translate3d(100%, 0, 0); visibility: hidden;
    box-shadow: -8px 0 24px rgba(7, 37, 61, .18);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s;
  }
  body.in-chat #chat { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
  body.in-chat #sidebar { transform: translate3d(-28%, 0, 0); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s; }
  .back { display: inline-flex; }
  .msg { max-width: 86%; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: none; border-radius: var(--sheet-radius) var(--sheet-radius) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal-card::before { content: ""; width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 10px auto 0; }
}

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

/* Guida "Mettila sulla Home" */
.home-link {
  display: block; margin: 16px auto 0; padding: 10px 16px; border: 0; border-radius: 999px;
  background: rgba(7, 37, 61, .35); color: #fff; font-weight: 700; font-size: 14px;
}
.seg { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; }
.seg button {
  flex: 1; border: 0; border-radius: 999px; padding: 10px; background: transparent; color: var(--muted);
  font-weight: 800; font-size: 15px;
}
.seg button.on { background: var(--ink); color: var(--lime); }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 16px; padding: 12px 14px; }
.step-n {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--lime); color: #07253D;
  box-shadow: inset 0 0 0 2px #07253D; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 17px;
}
.step-t { flex: 1; min-width: 0; line-height: 1.4; font-size: 15px; }
.step-ic {
  flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--panel); color: var(--link);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow);
}
.note { background: #FFF4CC; color: #4A3A00; border-radius: 12px; padding: 10px 12px; font-size: 14px; }

/* Risposte */
.quote {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; margin: 2px 0 5px; padding: 6px 10px;
  border: 0; border-left: 4px solid currentColor; border-radius: 10px; background: rgba(7, 37, 61, .07); color: var(--c0); cursor: pointer;
}
.msg.me .quote { background: rgba(7, 37, 61, .08); }
.quote-name { font-size: 12.5px; font-weight: 800; }
.quote-text {
  color: var(--text); opacity: .8; font-size: 13.5px; line-height: 1.3; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap;
}
.msg.me .quote-text { color: var(--bubble-me-text); }
.msg.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 4px var(--sky); } 100% { box-shadow: var(--shadow); } }
.reply-bar {
  display: flex; align-items: center; gap: 8px; margin: 0 10px -2px; padding: 8px 6px 8px 12px; background: var(--panel);
  border-radius: 16px 16px 6px 6px; box-shadow: var(--shadow); border-left: 4px solid var(--brand);
}
.reply-quote { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; }
.reply-quote strong { font-size: 12.5px; }
#reply-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar .icon { color: var(--muted); width: 34px; height: 34px; }

/* Info utili: pagina */
.info-page { display: flex; flex-direction: column; gap: 12px; }
.info-title { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.05; letter-spacing: .4px; text-transform: uppercase; margin: 2px 0 0; }
.info-intro { margin: -4px 0 0; color: var(--muted); line-height: 1.45; }
.info-card { background: var(--bg); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.info-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.info-icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.ic-0 { background: #EDFB8A; } .ic-1 { background: #F8A0F8; } .ic-2 { background: #07A2FF; } .ic-3 { background: #286AD8; }
.info-card-title { margin: 0; font-size: 17px; font-weight: 800; }
.info-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 12px;
  background: var(--panel); border-radius: 12px; line-height: 1.35;
}
.info-row.single { display: block; }
.info-label { font-weight: 700; }
.info-value { color: var(--muted); text-align: right; min-width: 0; overflow-wrap: anywhere; }
.info-updated { font-size: 12px; margin-top: 2px !important; }
.info-edit-btn {
  align-self: flex-end; margin: -6px 0 -4px; border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 14px;
  background: var(--ink); color: var(--lime);
}

/* Info utili: editor */
.info-editor-wrap { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.ed-card { background: var(--bg); border-radius: 20px; padding: 12px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.ed-label { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.ed-card input[type=text] {
  width: 100%; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1.5px solid transparent; background: var(--panel);
  font-size: 16px; outline: none;
}
.ed-card input[type=text]:focus { border-color: var(--brand); }
.ed-title { font-weight: 800; }
.ed-head { display: flex; align-items: center; gap: 8px; }
.ed-sec-title { font-weight: 800; flex: 1; }
.ed-icon { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--lime); font-size: 22px; }
.ed-icons {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; background: var(--panel); border-radius: 14px; padding: 8px;
  box-shadow: var(--shadow);
}
.ed-icons button { border: 0; background: transparent; font-size: 22px; padding: 6px 0; border-radius: 10px; }
.ed-icons button:hover { background: var(--bg); }
.ed-tools { display: flex; gap: 2px; flex: none; }
.ed-tool { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--panel); font-size: 15px; font-weight: 800; color: var(--text); }
.ed-tool:disabled { opacity: .3; }
.ed-row { display: flex; gap: 6px; align-items: center; }
.ed-row .ed-t { flex: 0 0 38%; font-weight: 700; }
.ed-row .ed-v { flex: 1; }
.ed-del { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 14px; }
.ed-add { align-self: flex-start; border: 0; background: transparent; color: var(--link); font-weight: 800; padding: 6px 4px; }
.ed-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-chip { border: 0; border-radius: 999px; padding: 8px 12px; background: var(--panel); font-weight: 700; font-size: 14px; box-shadow: var(--shadow); }
.ed-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border-radius: 14px; padding: 8px 10px; font-weight: 700; }
.ed-confirm span { flex: 1; }
.ed-confirm .btn { padding: 8px 14px; font-size: 14px; }
.ed-bar {
  position: sticky; bottom: -20px; margin: 4px -16px -20px; padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
}
.ed-notify { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ed-btns { display: flex; gap: 10px; }
.ed-btns .btn { flex: 1; }
@media (max-width: 420px) {
  .ed-row { flex-wrap: wrap; }
  .ed-row .ed-t { flex: 1 1 100%; }
  .ed-row .ed-v { flex: 1; }
  .info-row { flex-direction: column; gap: 2px; }
  .info-value { text-align: left; }
}


/* ---------- Azioni sul messaggio (reagisci, rispondi, elimina) ---------- */
.msg-tools {
  position: absolute; top: 50%; left: 100%; transform: translateY(-50%); margin-left: 8px; display: flex; gap: 6px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.msg.me .msg-tools { left: auto; right: 100%; margin: 0 8px 0 0; flex-direction: row-reverse; }
.msg:hover .msg-tools, .msg.show-actions .msg-tools { opacity: 1; pointer-events: auto; }
.msg-act {
  border: 0; background: var(--panel); color: var(--link); width: 30px; height: 30px; border-radius: 50%; box-shadow: var(--shadow);
  display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer;
}
.msg-act.msg-del { color: var(--danger); }
.msg-act.msg-react { color: var(--muted); }
@media (max-width: 760px) {
  .msg-tools { position: static; transform: none; margin: 6px 0 0; display: none; opacity: 1; pointer-events: auto; justify-content: flex-end; clear: both; }
  .msg.me .msg-tools { margin: 6px 0 0; flex-direction: row; }
  .msg.show-actions .msg-tools { display: flex; }
  .msg-act { width: 32px; height: 32px; background: var(--bg); box-shadow: none; }
  .msg.me .msg-act { background: rgba(7, 37, 61, .08); }
}
@media (hover: none) { .msg:hover:not(.show-actions) .msg-tools { opacity: 0; } }

/* ---------- Reazioni ---------- */
.msg.has-reacts { margin-bottom: 16px; }
.reacts {
  position: absolute; bottom: -17px; left: 10px; display: inline-flex; align-items: center; gap: 1px; height: 26px; padding: 0 7px;
  border: 0; border-radius: 999px; background: var(--panel); box-shadow: 0 0 0 2px var(--chat-bg), var(--shadow); cursor: pointer;
  font-size: 14px; line-height: 1; color: var(--text); z-index: 1; animation: reactIn .25s cubic-bezier(.3, 1.6, .5, 1);
}
.msg.me .reacts { left: auto; right: 10px; }
.reacts .r-count { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; }
@keyframes reactIn { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.react-pop {
  position: fixed; z-index: 60; display: flex; gap: 2px; padding: 6px; border-radius: 999px; background: var(--panel);
  box-shadow: 0 8px 30px rgba(7, 37, 61, .25), 0 0 0 1px var(--line); animation: popIn .2s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes popIn { from { transform: scale(.6) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.react-opt {
  border: 0; background: transparent; font-size: 26px; width: 42px; height: 42px; border-radius: 50%; line-height: 1; padding: 0;
  cursor: pointer; transition: transform .12s;
}
.react-opt:hover { transform: scale(1.25); }
.react-opt:active { transform: scale(.9); }
.react-opt.on { background: var(--lime); }
.react-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.react-chip { background: var(--bg); border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 14px; }
.react-big { font-size: 24px; flex: none; }

/* ---------- Profili ---------- */
button.avatar { border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.profile-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 4px 8px 6px; }
.profile-card .avatar { width: 84px; height: 84px; font-size: 30px; margin-bottom: 4px; box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--lime); }
.profile-name { font-size: 21px; font-weight: 800; }
.profile-badge { font-size: 12px; font-weight: 800; color: #07253D; background: var(--lime); border-radius: 999px; padding: 3px 10px; }
.profile-city { color: var(--muted); font-weight: 600; font-size: 14px; }
.profile-bio { margin: 4px 0 0; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-links { display: flex; flex-direction: column; background: var(--bg); border-radius: 18px; overflow: hidden; }
.profile-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.profile-link + .profile-link { border-top: 1px solid var(--line); }
.profile-link:hover { background: var(--hover); }
.pl-icon { font-size: 20px; width: 26px; text-align: center; }
.pl-label { font-weight: 700; flex: 1; }
.pl-value { color: var(--link); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.muted.small { font-size: 12.5px; margin: 0; }
.muted.center, .center { text-align: center; margin: 0; }
.profile-form { display: flex; flex-direction: column; gap: 12px; }
.modal .profile-form .ed-input {
  width: 100%; min-width: 0; padding: 11px 14px; border-radius: 14px; border: 1.5px solid transparent; background: var(--bg);
  background-image: none; font-size: 16px; outline: none; resize: none; box-shadow: none;
}
.modal .profile-form .ed-input:focus { border-color: var(--brand); }

/* ---------- Animazione di apertura (~4,5 s), tutta vettoriale ----------
   0.0–2.4 s l'alba: dal blu notte stellato al blu WeRoad, sorge il sole lime · 0.0–1.1 s il
   mare sale: quattro file di onde (azzurro, rosa, lime, blu) che scorrono in direzioni opposte
   · 0.4 s la nave entra da sinistra dondolando · 0.9–1.9 s il logo si svela con un rimbalzo,
   poi un riflesso di luce e i coriandoli · 1.5 s "Setting sail…" → 2.8 s "Welcome aboard!" ·
   3.8–4.3 s due onde salgono e coprono lo schermo, poi tutto sfuma sulla chat. Un tocco salta. */
#splash {
  position: fixed; inset: 0; z-index: 100; overflow: hidden; cursor: pointer;
  background: linear-gradient(180deg, #286AD8 0%, #286AD8 35%, #4A8EF0 100%);
  display: flex; align-items: center; justify-content: center;
  animation: splashOut .4s ease-in 4.2s forwards;
}
#splash.out { animation: splashOut .35s ease-in forwards; }
@keyframes splashOut { to { opacity: 0; visibility: hidden; } }
#splash i { font-style: normal; }
.splash-night {
  /* l'alba sale dall'orizzonte: il bordo in alto resta del blu WeRoad, così su iPhone la
     barra di stato (che prende quel colore all'apertura) non diventa scura */
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(40, 106, 216, 0) 30%, rgba(237, 251, 138, .28) 78%, rgba(248, 160, 248, .25) 100%);
  animation: dawn 2.4s ease-out .3s both;
}
@keyframes dawn { from { opacity: 0; } to { opacity: 1; } }
.splash-stars i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, .7); animation: star 2.1s ease-in both;
}
.splash-stars i:nth-child(1) { left: 12%; top: 9%; }
.splash-stars i:nth-child(2) { left: 30%; top: 21%; animation-delay: .1s; }
.splash-stars i:nth-child(3) { left: 52%; top: 6%; width: 2px; height: 2px; }
.splash-stars i:nth-child(4) { left: 71%; top: 16%; animation-delay: .2s; }
.splash-stars i:nth-child(5) { left: 88%; top: 8%; width: 4px; height: 4px; }
.splash-stars i:nth-child(6) { left: 7%; top: 33%; width: 2px; height: 2px; animation-delay: .15s; }
.splash-stars i:nth-child(7) { left: 93%; top: 30%; animation-delay: .05s; }
.splash-stars i:nth-child(8) { left: 42%; top: 28%; width: 2px; height: 2px; animation-delay: .25s; }
.splash-stars i:nth-child(9) { left: 22%; top: 44%; width: 2px; height: 2px; animation-delay: .3s; }
.splash-stars i:nth-child(10) { left: 79%; top: 41%; animation-delay: .12s; }
@keyframes star { 0% { opacity: 0; transform: scale(.4); } 15%, 35% { opacity: 1; transform: scale(1); } 25% { opacity: .35; } 100% { opacity: 0; transform: scale(.3); } }
.splash-sun {
  position: absolute; left: 50%; bottom: 17vh; width: 52vmin; height: 52vmin; margin-left: -26vmin; border-radius: 50%;
  background: radial-gradient(circle, #FBFFD9 0%, #EDFB8A 34%, rgba(237, 251, 138, .45) 48%, rgba(237, 251, 138, 0) 70%);
  animation: sunrise 2.6s cubic-bezier(.25, .7, .3, 1) .3s both;
}
.splash-sun::after {
  content: ""; position: absolute; inset: -55%; border-radius: 50%;
  background: repeating-conic-gradient(rgba(237, 251, 138, .18) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 22%, transparent 68%); mask: radial-gradient(circle, #000 22%, transparent 68%);
  animation: rays 14s linear infinite;
}
@keyframes sunrise { from { transform: translateY(30vh) scale(.6); opacity: 0; } 35% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes rays { to { transform: rotate(360deg); } }
.splash-gulls span { position: absolute; top: 17%; left: -12%; width: 30px; animation: fly 3.6s linear .7s both; }
.splash-gulls .g2 { top: 12%; width: 22px; animation-delay: .95s; animation-duration: 3.9s; }
.splash-gulls .g3 { top: 24%; width: 18px; animation-delay: 1.3s; animation-duration: 3.4s; }
.splash-gulls svg { display: block; width: 100%; overflow: visible; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; animation: flap .4s ease-in-out infinite alternate; }
@keyframes fly { from { transform: translate(0, 0); } 50% { transform: translate(64vw, -4vh); } to { transform: translate(128vw, 2vh); } }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(.2); } }
.splash-center { position: relative; z-index: 2; text-align: center; margin-bottom: 20vh; }
.splash-logo-wrap { position: relative; width: min(84vw, 480px); }
.splash-logo { width: 100%; height: auto; display: block; animation: logoReveal 1.05s cubic-bezier(.3, 1.35, .5, 1) .9s both, logoFloat 2.2s ease-in-out 1.95s infinite alternate; }
@keyframes logoReveal {
  0% { clip-path: inset(0 100% 0 0); transform: translateX(-14px) scale(.92); opacity: 0; filter: blur(6px); }
  20% { opacity: 1; }
  65% { clip-path: inset(0 0 0 0); transform: translateX(3px) scale(1.04); filter: blur(0); }
  100% { clip-path: inset(0 0 0 0); transform: none; opacity: 1; filter: blur(0); }
}
@keyframes logoFloat { to { transform: translateY(-5px); } }
/* riflesso di luce che attraversa il logo, ritagliato sulla sua forma */
.splash-shine {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(/wordmark.svg) center / 100% 100% no-repeat; mask: url(/wordmark.svg) center / 100% 100% no-repeat;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .95) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; background-position: 160% 0;
  animation: shine 1s ease-in-out 2.05s both, logoFloat 2.2s ease-in-out 1.95s infinite alternate;
}
@keyframes shine { from { background-position: 160% 0; } to { background-position: -60% 0; } }
.splash-burst { position: absolute; left: 50%; top: 55%; }
.splash-burst i {
  position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 2px; background: #EDFB8A; opacity: 0;
  animation: burst 1.4s cubic-bezier(.15, .8, .3, 1) 1.8s both;
}
.splash-burst i:nth-child(3n) { background: #F8A0F8; border-radius: 50%; }
.splash-burst i:nth-child(3n+1) { background: #07A2FF; width: 7px; height: 15px; }
.splash-burst i:nth-child(4n) { background: #fff; }
.splash-burst i:nth-child(1) { --x: -46vw; --y: -18vh; --r: 320deg; }
.splash-burst i:nth-child(2) { --x: -36vw; --y: -30vh; --r: -260deg; }
.splash-burst i:nth-child(3) { --x: -20vw; --y: -36vh; --r: 200deg; }
.splash-burst i:nth-child(4) { --x: -5vw; --y: -40vh; --r: -340deg; }
.splash-burst i:nth-child(5) { --x: 10vw; --y: -34vh; --r: 280deg; }
.splash-burst i:nth-child(6) { --x: 26vw; --y: -30vh; --r: -220deg; }
.splash-burst i:nth-child(7) { --x: 42vw; --y: -22vh; --r: 360deg; }
.splash-burst i:nth-child(8) { --x: 47vw; --y: -2vh; --r: -300deg; }
.splash-burst i:nth-child(9) { --x: 38vw; --y: 14vh; --r: 240deg; }
.splash-burst i:nth-child(10) { --x: 22vw; --y: 20vh; --r: -200deg; }
.splash-burst i:nth-child(11) { --x: -12vw; --y: 22vh; --r: 300deg; }
.splash-burst i:nth-child(12) { --x: -30vw; --y: 16vh; --r: -280deg; }
.splash-burst i:nth-child(13) { --x: -45vw; --y: 2vh; --r: 220deg; }
.splash-burst i:nth-child(14) { --x: 4vw; --y: 26vh; --r: -360deg; }
.splash-burst i:nth-child(15) { --x: -28vw; --y: -12vh; --r: 180deg; }
.splash-burst i:nth-child(16) { --x: 30vw; --y: -10vh; --r: -180deg; }
@keyframes burst {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(.3); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 8vh)) rotate(var(--r)) scale(1); }
}
.splash-tags { position: relative; height: 34px; margin-top: 18px; }
.splash-tag {
  position: absolute; left: 0; right: 0; margin: 0; color: #fff; font-family: var(--display); font-size: 22px;
  letter-spacing: 3px; text-transform: uppercase; text-shadow: 0 2px 14px rgba(3, 15, 31, .35);
}
.splash-tag.t1 { animation: tagIn .55s ease-out 1.5s both, tagOut .35s ease-in 2.6s forwards; }
.splash-tag.t2 { color: #EDFB8A; animation: tagIn .6s cubic-bezier(.3, 1.5, .5, 1) 2.85s both; }
@keyframes tagIn { from { opacity: 0; letter-spacing: 12px; transform: translateY(6px); } to { opacity: 1; letter-spacing: 3px; transform: none; } }
@keyframes tagOut { to { opacity: 0; transform: translateY(-10px); filter: blur(3px); } }
/* il mare: ogni fila di onde è larga il doppio dello schermo e scorre di metà, così il giro è continuo */
.splash-sea { position: absolute; left: 0; right: 0; bottom: 0; height: 34vh; z-index: 1; animation: seaUp 1.1s cubic-bezier(.2, .9, .25, 1) both; }
@keyframes seaUp { from { transform: translateY(100%); } to { transform: none; } }
.wv { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; display: block; }
.wv .foam { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 3; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.wv.w1 { fill: #07A2FF; opacity: .7; animation: driftR 9s linear infinite, bobA 3s ease-in-out infinite alternate; }
.wv.w2 { fill: #F8A0F8; animation: driftL 7s linear infinite, bobB 2.6s ease-in-out infinite alternate; }
.wv.w3 { fill: #EDFB8A; animation: driftR 6s linear infinite, bobA 2.3s ease-in-out infinite alternate; }
.wv.w4 { fill: #1D55B8; animation: driftL 5s linear infinite, bobB 2s ease-in-out infinite alternate; }
@keyframes driftL { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes driftR { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes bobA { from { translate: 0 0; } to { translate: 0 6px; } }
@keyframes bobB { from { translate: 0 4px; } to { translate: 0 -4px; } }
.splash-boat { position: absolute; left: 0; bottom: 44%; width: 128px; animation: sail 4.6s cubic-bezier(.3, .6, .5, 1) .35s both; }
.splash-ship { display: block; width: 100%; overflow: visible; transform-origin: 50% 90%; animation: rock 1.3s ease-in-out infinite alternate; }
.splash-ship .smoke circle { fill: rgba(255, 255, 255, .85); animation: smoke 1.6s ease-out infinite; }
.splash-ship .smoke circle:nth-child(2) { animation-delay: .5s; }
.splash-ship .smoke circle:nth-child(3) { animation-delay: 1s; }
@keyframes sail { from { transform: translateX(-150px); } to { transform: translateX(calc(62vw - 64px)); } }
@keyframes rock { from { transform: translateY(0) rotate(-2.5deg); } to { transform: translateY(-5px) rotate(2deg); } }
@keyframes smoke { from { opacity: .9; transform: translate(0, 0) scale(.6); } to { opacity: 0; transform: translate(-16px, -18px) scale(1.6); } }
/* uscita: due onde salgono e coprono lo schermo */
.splash-surge {
  position: absolute; left: -10%; right: -10%; bottom: 0; height: 130vh; z-index: 4; transform: translateY(105%);
  border-radius: 50% 50% 0 0 / 9vh 9vh 0 0;
}
.splash-surge.s1 { background: #F8A0F8; animation: surge .6s cubic-bezier(.6, 0, .3, 1) 3.75s forwards; }
.splash-surge.s2 { background: #286AD8; animation: surge .6s cubic-bezier(.6, 0, .3, 1) 3.9s forwards; }
@keyframes surge { to { transform: translateY(0); } }
.splash-skip {
  position: absolute; left: 0; right: 0; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 3; margin: 0; text-align: center;
  color: rgba(255, 255, 255, .8); font-size: 12px; letter-spacing: .5px; animation: fade .5s ease-out 1.6s both;
}
@media (prefers-reduced-motion: reduce) {
  #splash, #splash *, #splash *::after { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  #splash { animation: splashOut .3s ease-in .9s forwards !important; }
  .splash-tag.t1, .splash-gulls, .splash-burst, .splash-surge, .splash-shine, .splash-stars, .splash-night { display: none; }
}


.reset-code {
  align-self: center; margin: 4px 0; padding: 12px 22px; border-radius: 16px; background: var(--lime); color: #07253D;
  font-size: 34px; font-weight: 900; letter-spacing: 8px; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all;
}
