/* ─────────────────────────────────────────────────────
   Cervellone Landing — mobile-first.
   Identità visiva ripresa dalla landing storica:
    - Montserrat
    - sfondo gradient blu → viola
    - accento giallo #fdd000 sui CTA
    - input "pill" bianchi, 45px di altezza, radius 20px
   ───────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
  --grad-start:  #005bea;           /* blu */
  --grad-end:    #3f00be;           /* viola */
  --fg:          #ffffff;
  --fg-muted:    rgba(255,255,255,.72);
  --fg-dim:      rgba(255,255,255,.55);

  --accent:      #fdd000;           /* giallo CTA */
  --accent-hov:  #ffe04d;
  --accent-ink:  #1a1a1a;

  --card-bg:     rgba(255,255,255,.08);
  --card-brd:    rgba(255,255,255,.18);

  --input-bg:    #ffffff;
  --input-fg:    #222;
  --input-ph:    #9aa0a6;
  --input-brd:   rgba(0,0,0,.05);

  --ok:          #22c55e;
  --err:         #ff5b5b;

  --radius-pill: 999px;
  --radius-card: 18px;
  --shadow:      0 18px 50px rgba(0,0,0,.25);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(255,255,255,.14), transparent 55%),
    radial-gradient(800px 600px at 110% 100%, rgba(253,208,0,.12), transparent 55%),
    linear-gradient(180deg, var(--grad-start) 0%, var(--grad-end) 100%);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0;
  overflow-x: hidden;
}

/* ─── Viste ─── */
.view {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 26px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeIn .25s ease-out;
}
.view[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Hero ─── */
.hero { text-align: center; padding: 8px 4px 0; }
.emoji { font-size: 56px; line-height: 1; margin-bottom: 4px; }
.hero h1 {
  margin: 0 0 6px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.sub { margin: 0; color: var(--fg-muted); font-size: 15px; line-height: 1.45; font-weight: 400; }
.sub strong { color: var(--fg); font-weight: 700; }
.muted { color: var(--fg-muted); }

/* ─── Spinner iniziale ─── */
.spinner {
  width: 42px; height: 42px;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30vh auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Welcome banner (utenti che tornano) ─── */
.welcome-banner {
  background: rgba(253,208,0,.12);
  border: 1px solid rgba(253,208,0,.35);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
  font-size: 14px;
  color: var(--fg);
}
.welcome-banner strong { color: var(--accent); }

/* ─── Banner Cervellone (ex-utente riconosciuto via Spoki) ─── */
.cervellone-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(63,0,190,.10), rgba(253,208,0,.10));
  border: 1px solid rgba(63,0,190,.35);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 10px 0 14px;
  font-size: 14px;
  line-height: 1.35;
}
.cervellone-banner .cb-emoji { font-size: 26px; line-height: 1; flex: 0 0 auto; }
.cervellone-banner .cb-body { display: flex; flex-direction: column; gap: 2px; }
.cervellone-banner .cb-body strong { color: var(--accent); font-size: 15px; }
.cervellone-banner .cb-body b { color: var(--accent); }

/* ─── Card ─── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-brd);
  border-radius: var(--radius-card);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Form fields ─── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--fg);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
}
.bonus {
  background: rgba(253,208,0,.18);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.field-optional {
  color: var(--fg-dim);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

/* Input "pill" come nell'originale */
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"] {
  width: 100%;
  background: var(--input-bg);
  color: var(--input-fg);
  border: 1px solid var(--input-brd);
  border-radius: var(--radius-pill);
  height: 46px;
  padding: 0 18px;
  font-size: 16px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  outline: none;
  transition: box-shadow .15s, transform .05s;
  appearance: none;
  -webkit-appearance: none;
}
.field input:focus {
  box-shadow: 0 0 0 3px rgba(253,208,0,.55);
}
.field input::placeholder { color: var(--input-ph); font-weight: 400; }

.field-hint {
  color: var(--fg-dim);
  font-size: 12px;
  text-align: right;
  padding-right: 4px;
}

/* Griglia 2 colonne per nome/cognome */
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Privacy checkbox */
.privacy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 2px 0;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}
.privacy input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.06);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  transition: border-color .15s, background .15s;
}
.privacy input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.privacy input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid var(--accent-ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.privacy a { color: var(--accent); text-decoration: underline; }

/* ─── Photo widget ─── */
.photo-widget { display: flex; flex-direction: column; gap: 10px; }
.photo-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 2px dashed rgba(255,255,255,.35);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: var(--fg);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.photo-trigger:active { background: rgba(255,255,255,.12); }
.photo-trigger:hover  { border-color: var(--accent); }
.photo-icon { font-size: 20px; }

.photo-preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,.2);
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(255,255,255,.2);
}
.photo-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}

.photo-status {
  margin: 0;
  font-size: 13px;
  color: var(--fg-dim);
  min-height: 18px;
  text-align: center;
}
.photo-status.ok  { color: var(--ok); }
.photo-status.err { color: var(--err); }

.photo-update {
  margin-top: 4px;
  font-size: 14px;
  color: var(--fg-muted);
}
.photo-update summary {
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
  text-align: center;
  font-weight: 600;
}
.photo-update[open] { margin-top: 12px; }

.photo-readonly {
  margin: 0;
  padding: 10px 12px;
  background: rgba(255,255,255,.06);
  border: 1px dashed rgba(255,255,255,.22);
  border-radius: 12px;
  font-size: 13px;
  color: var(--fg-dim);
  text-align: center;
  letter-spacing: .01em;
}

/* ─── Squadra card (inseguitore) ─── */
.squad-card {
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  gap: 12px;
}
.squad-photo {
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(0,0,0,.25);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(253,208,0,.25);
}
.squad-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.squad-photo-ph { font-size: 48px; }
.squad-name {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* ─── Button primario ─── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  min-height: 50px;
  transition: transform .05s, filter .15s, box-shadow .15s;
  box-shadow: 0 6px 18px rgba(253,208,0,.4);
  text-transform: uppercase;
}
.btn-primary:hover   { background: var(--accent-hov); }
.btn-primary:active  { transform: translateY(1px); box-shadow: 0 3px 10px rgba(253,208,0,.35); }
.btn-primary:disabled {
  filter: grayscale(.5) brightness(.75);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-primary .btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(0,0,0,.2);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ─── Errore form ─── */
.err {
  margin: 0;
  padding: 10px 12px;
  background: rgba(255,91,91,.15);
  border: 1px solid rgba(255,91,91,.4);
  border-radius: 10px;
  font-size: 13px;
  color: #fff;
  text-align: center;
}

/* Evidenziazione campo con errore */
.field.has-error input {
  box-shadow: 0 0 0 3px rgba(255,91,91,.55);
}

/* ─── Footer ─── */
.foot {
  text-align: center;
  padding: 16px;
  color: var(--fg-dim);
  font-size: 12px;
  letter-spacing: .02em;
}

/* ─── Tablet/desktop ─── */
@media (min-width: 620px) {
  .view { padding: 40px 24px 20px; }
  .hero h1 { font-size: 30px; }
}
