/* Accesso a ClaudeBot: stesso aspetto dell'app (tema scuro, tondeggiante). Autonomo: non usa style.css. */

:root {
  --sfondo: #12141A;
  --superficie: #1C1F27;
  --testo: #F2F4F8;
  --testo-2: #9AA3B5;
  --accento: #6CE5B1;
  --su-accento: #0B2A1E;
  --ambra: #FFC861;
  --errore: #FFB4A8;
  --font: "Nunito", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--sfondo);
  color: var(--testo);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.carta { width: 100%; max-width: 420px; padding: 36px 24px 28px; }

@media (min-width: 600px) {
  body { align-items: center; }
  .carta { padding: 40px 32px; }
}

button, input { font-family: inherit; }
a { color: var(--testo-2); }

/* Focus sempre visibile (i campi lo mostrano con il bordo menta) */
:focus-visible { outline: 3px solid var(--accento); outline-offset: 3px; }
input[type="text"]:focus-visible, input[type="password"]:focus-visible { outline: none; }

.attesa { text-align: center; color: var(--testo-2); font-weight: 600; margin: 120px 0; }

/* --- Avatar ---------------------------------------------------------------------- */

.av { display: block; border-radius: 22%; }

.avatar-trio { display: flex; justify-content: center; align-items: center; margin: 8px 0 22px; }
.avatar-trio .av-sx { width: 72px; height: 72px; transform: rotate(-8deg); }
.avatar-trio .av-dx { width: 72px; height: 72px; transform: rotate(8deg); }
.avatar-trio .av-centro { width: 104px; height: 104px; position: relative; z-index: 1; margin: 0 -14px; }

.avatar-lucchetto { position: relative; width: 96px; margin: 4px auto 20px; }
.avatar-lucchetto .av { width: 96px; height: 96px; }
.badge-ambra {
  position: absolute; right: -8px; bottom: -8px;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ambra); color: #3A2A00; border: 3px solid var(--sfondo);
}

/* --- Testi ----------------------------------------------------------------------- */

h1 { margin: 0; text-align: center; font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.sotto { margin: 8px 0 26px; text-align: center; color: var(--testo-2); font-size: 16px; font-weight: 600; line-height: 1.4; }
.sotto strong { color: var(--testo); font-weight: 800; }

label { display: block; margin: 0 0 8px 6px; font-size: 14px; font-weight: 700; color: var(--testo-2); }

/* --- Campi ----------------------------------------------------------------------- */

input[type="text"], input[type="password"] {
  width: 100%; height: 56px; border-radius: 28px;
  border: 2px solid transparent; background: var(--superficie); color: var(--testo);
  padding: 0 22px; font-size: 17px; font-weight: 600; margin-bottom: 18px;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--accento); }

.campo-occhio { position: relative; }
.campo-occhio input { padding-right: 60px; }
.occhio {
  position: absolute; right: 8px; top: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--testo-2); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.occhio:hover { color: var(--testo); }

/* Casella "ricorda": l'input vero resta (invisibile, sopra), la grafica e' lo span accanto */
.spunta {
  display: flex; align-items: center; gap: 12px; margin: 2px 0 22px 4px;
  font-size: 15px; font-weight: 600; color: var(--testo); cursor: pointer; position: relative;
}
.spunta input { position: absolute; left: 0; opacity: 0; width: 26px; height: 26px; margin: 0; cursor: pointer; }
.casella {
  flex: none; width: 26px; height: 26px; border-radius: 9px; background: var(--superficie);
  border: 2px solid #3A4050; display: flex; align-items: center; justify-content: center;
}
.spunta input:checked + .casella { background: var(--accento); border-color: var(--accento); }
.spunta input:checked + .casella::after {
  content: ""; width: 6px; height: 12px; margin-top: -2px;
  border: solid var(--su-accento); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.spunta input:focus-visible + .casella { outline: 3px solid var(--accento); outline-offset: 3px; }

/* --- Pulsanti -------------------------------------------------------------------- */

.primario, .secondario {
  width: 100%; border: 0; border-radius: 999px; font-size: 18px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.primario { height: 58px; background: var(--accento); color: var(--su-accento); }
.secondario { height: 56px; background: var(--superficie); color: var(--testo); font-size: 17px; }
.primario:disabled, .secondario:disabled { opacity: 0.6; cursor: default; }

.oppure { display: flex; align-items: center; gap: 14px; margin: 20px 0; color: var(--testo-2); font-size: 14px; font-weight: 600; }
.oppure::before, .oppure::after { content: ""; flex: 1; height: 1px; background: #2C303B; }

.link {
  display: block; margin: 22px auto 0; padding: 10px 16px; border: 0; background: none;
  color: var(--accento); font-size: 16px; font-weight: 800; cursor: pointer; border-radius: 999px;
}
.link:disabled { opacity: 0.6; cursor: default; }

.indietro {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--superficie); color: var(--testo);
  display: flex; align-items: center; justify-content: center; cursor: pointer; margin-bottom: 4px;
}

.nota-fondo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 26px 0 0; padding: 14px 16px; border-radius: 20px; background: var(--superficie);
  color: var(--testo-2); font-size: 14px; font-weight: 700;
}

.classico { margin: 22px 0 0; text-align: center; font-size: 13px; font-weight: 600; }
.classico a { padding: 6px 10px; }

/* --- Errori ---------------------------------------------------------------------- */

.errore { min-height: 22px; margin: -6px 0 12px 6px; font-size: 14px; font-weight: 700; color: var(--errore); }
#vista-2fa .errore { text-align: center; margin: 14px 0; }

/* --- Cifre ----------------------------------------------------------------------- */

.cifre { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 8px 0 0; }
.cifra {
  width: 100%; min-width: 0; height: 60px; border-radius: 20px; border: 2px solid transparent;
  background: var(--superficie); color: var(--testo); text-align: center; padding: 0;
  font-family: var(--mono); font-size: 24px; font-weight: 500;
}
.cifra:focus { border-color: var(--accento); outline: none; }
.cifre.sbagliato .cifra { border-color: var(--errore); }

@media (prefers-reduced-motion: no-preference) {
  .primario, .secondario, .cifra, input { transition: border-color 0.15s, opacity 0.15s; }
}
