/* MonetaZen Website • Stylesheet
   Componenti del sito. Le utility Tailwind arrivano dalla CDN (script in <head>,
   che inserisce il suo CSS dopo questo file: le sue utility hanno quindi la precedenza).
   Colori: docs/brand/brand-identity.md & spence_theme.dart
*/

/* ==========================================================================
   TOKENS
   ========================================================================== */

:root {
  /* Bianco Light: testi scuriti per contrasto AA su sfondo chiaro */
  --bg-scaffold: #F4F7FB;
  --bg-card: #FFFFFF;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --border-surface: rgba(15, 23, 42, 0.10);
  --border-card: rgba(15, 23, 42, 0.07);
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-subtle: #64748B;

  --brand-accent: #0369A1;
  --brand-accent-glow: rgba(3, 105, 161, 0.12);
  --brand-purple: #7C3AED;
  --brand-purple-glow: rgba(124, 58, 237, 0.12);
  --brand-emerald: #047857;
  --brand-coral: #E11D48;
  --brand-amber: #B45309;

  --aurora-1: rgba(56, 189, 248, 0.20);
  --aurora-2: rgba(139, 92, 246, 0.14);
  --grid-dot: rgba(15, 23, 42, 0.05);

  --phone-bezel: #E2E8F0;
  --phone-bezel-rim: #CBD5E1;
  --shadow-float: 0 20px 40px -12px rgba(15, 23, 42, 0.07), 0 2px 8px rgba(15, 23, 42, 0.03);
  --shadow-phone: 0 40px 90px -20px rgba(15, 23, 42, 0.18), 0 16px 32px -8px rgba(15, 23, 42, 0.08);

  --header-h: 64px;
}

@media (min-width: 640px) {
  :root { --header-h: 80px; }
}

html.dark {
  /* Blu Dark (tema scuro ufficiale) */
  --bg-scaffold: #090D16;
  --bg-card: #0F172A;
  --bg-surface: rgba(15, 23, 42, 0.82);
  --border-surface: rgba(56, 189, 248, 0.18);
  --border-card: rgba(255, 255, 255, 0.07);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #7C8CA3;

  --brand-accent: #38BDF8;
  --brand-accent-glow: rgba(56, 189, 248, 0.22);
  --brand-purple: #A855F7;
  --brand-purple-glow: rgba(168, 85, 247, 0.2);
  --brand-emerald: #10B981;
  --brand-coral: #F43F5E;
  --brand-amber: #FBBF24;

  --aurora-1: rgba(56, 189, 248, 0.15);
  --aurora-2: rgba(79, 70, 229, 0.18);
  --grid-dot: rgba(255, 255, 255, 0.04);

  --phone-bezel: #1E293B;
  --phone-bezel-rim: #334155;
  --shadow-float: 0 24px 60px -12px rgba(0, 0, 0, 0.6), 0 0 24px rgba(56, 189, 248, 0.06);
  --shadow-phone: 0 45px 100px -20px rgba(0, 0, 0, 0.9), 0 0 45px rgba(56, 189, 248, 0.1);
}

/* ==========================================================================
   BASE
   ========================================================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-scaffold);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Focus visibile per chi naviga da tastiera */
:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text-main);
  color: var(--bg-scaffold);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus { transform: translateY(0); }

/* Sfondo decorativo: gradienti radiali (nessun filter: blur, scroll più fluido) */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 28px 28px;
}

.aurora-blob {
  position: fixed;
  border-radius: 9999px;
  pointer-events: none;
  z-index: 0;
}

.aurora-top-left {
  top: -200px;
  left: -200px;
  width: 760px;
  height: 760px;
  background: radial-gradient(circle, var(--aurora-1) 0%, transparent 68%);
}

.aurora-top-right {
  top: 0;
  right: -240px;
  width: 820px;
  height: 820px;
  background: radial-gradient(circle, var(--aurora-2) 0%, transparent 68%);
}

/* Il contenuto sta sopra lo sfondo */
main, footer { position: relative; z-index: 1; }

/* ==========================================================================
   CARD
   ========================================================================== */

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-float);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  border-color: var(--brand-accent);
  transform: translateY(-3px);
}

/* ==========================================================================
   REEL / SLOT-MACHINE (parola animata nel titolo)
   ========================================================================== */

.twist-container {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

.reel-word {
  display: inline-flex;
  vertical-align: baseline;
  cursor: pointer;
  position: relative;
  color: var(--brand-accent);
  padding: 0 0 0 2px;
  user-select: none;
}

.reel-letter-box {
  display: inline-block;
  overflow: hidden;
  height: 1.15em;
  vertical-align: -0.18em;
  line-height: 1.15;
}

/* A riposo la traccia mostra l'ultima riga (la lettera giusta). */
.reel-track {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(-100% + 1.15em));
  transition: transform 0.95s cubic-bezier(0.34, 1.3, 0.64, 1);
  will-change: transform;
}

/* Per rigirare: salto istantaneo in cima, poi scorre fino alla lettera finale. */
.reel-word.resetting .reel-track {
  transition: none;
  transform: translateY(0);
}

.reel-letter-row {
  display: block;
  height: 1.15em;
  text-align: center;
}

/* Il pulsante "rigioca" è fuori dal flusso: non sposta il punto finale del titolo */
.twist-btn {
  position: absolute;
  left: 100%;
  top: 50%;
  translate: 12px -50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-accent-glow);
  color: var(--brand-accent);
  border: 1px solid var(--border-surface);
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, color 0.2s ease;
}

@media (max-width: 420px) {
  .twist-btn { display: none; }
}

.twist-btn:hover {
  transform: scale(1.15) rotate(180deg);
  background: var(--brand-accent);
  color: var(--bg-scaffold);
}

.zen-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--brand-accent-glow);
  color: var(--brand-accent);
  border: 1px solid var(--border-surface);
}

/* ==========================================================================
   LANGUAGE SWITCHER + MENU MOBILE
   ========================================================================== */

.lang-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

.lang-btn {
  display: inline-block;
  text-decoration: none;
  padding: 5px 7px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--brand-accent-glow);
  color: var(--brand-accent);
  font-weight: 800;
}

.lang-btn:hover:not(.active) { color: var(--text-main); }

.lang-divider {
  color: var(--text-subtle);
  opacity: 0.5;
  padding: 0 1px;
  user-select: none;
}

.mobile-menu {
  display: flex;
  flex-direction: column;
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border-card);
}

.mobile-menu[hidden] { display: none; }

.mobile-menu a {
  padding: 12px 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px solid var(--border-card);
}

.mobile-menu a:last-child { border-bottom: none; }

/* ==========================================================================
   BANNER PRINCIPI
   ========================================================================== */

.principles-banner {
  border-top: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ==========================================================================
   TELEFONO (mockup con tilt 3D)
   ========================================================================== */

.phone-stage {
  perspective: 1200px;
  position: relative;
  max-width: 100%;
}

.iphone-frame {
  width: 320px;
  max-width: 100%;
  height: 650px;
  border-radius: 50px;
  background: #000000;
  border: 10px solid var(--phone-bezel);
  outline: 1px solid var(--phone-bezel-rim);
  box-shadow: var(--shadow-phone);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.workflow-phone {
  width: 300px;
  height: 580px;
}

.iphone-dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 24px;
  background: #000000;
  border-radius: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.island-camera {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #111827;
  border: 1px solid #1f2937;
}

.island-sensor {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0a192f;
}

/* padding-top = spazio sotto la Dynamic Island (non usare pt-* di Tailwind qui) */
.iphone-screen {
  flex: 1;
  background: var(--bg-scaffold);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  padding-top: 46px;
}

.home-bar {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 4px;
  border-radius: 4px;
  background: var(--text-subtle);
  opacity: 0.6;
  z-index: 40;
}

.phone-back {
  position: absolute;
  top: 40px;
  right: -50px;
  transform: rotate(8deg) scale(0.92);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}

.phone-front {
  position: relative;
  z-index: 10;
  margin: 0 auto;
}

.mock-action-btn {
  transition: transform 0.15s ease;
  border-radius: 16px;
}

.mock-action-btn.pressed { transform: scale(0.88); }

.phone-mini-toast {
  position: absolute;
  top: 46px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text-main);
  color: var(--bg-scaffold);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 60;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.phone-mini-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#mock-balance-display { display: inline-block; transition: transform 0.2s ease; }

/* ==========================================================================
   WORKFLOW TABS
   ========================================================================== */

.workflow-tabs-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.workflow-tab-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 22px 26px;
  border-radius: 24px;
  background: transparent;
  border: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
  color: inherit;
  font: inherit;
}

@media (max-width: 480px) {
  .workflow-tab-btn { padding: 18px 16px; }
}

.workflow-tab-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border-card);
}

.workflow-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-float);
}

.workflow-tab-btn.active .tab-num {
  color: var(--brand-accent);
  border-color: var(--brand-accent);
  background: var(--brand-accent-glow);
}

.tab-num {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  border: 1px solid var(--border-card);
  transition: all 0.25s ease;
}

.phone-view-panel {
  /* Sempre renderizzati (già rasterizzati): niente display:none, quindi niente flash bianco */
  display: flex;
  flex-direction: column;
  position: absolute;
  inset: 0;
  visibility: hidden;
  z-index: 0;
}

.phone-view-panel.leaving {
  visibility: visible;
  z-index: 1;
}

.phone-view-panel.active {
  visibility: visible;
  z-index: 2;
  animation: panel-in 0.35s ease-out;
}

/* Il nuovo pannello sfuma SOPRA il vecchio, che resta visibile sotto */
@keyframes panel-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ==========================================================================
   SCROLL REVEAL (usa `translate`, indipendente da `transform` degli hover)
   ========================================================================== */

.reveal-on-scroll {
  opacity: 0;
  translate: 0 24px;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), translate 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  translate: 0 0;
}

/* ==========================================================================
   BARRA DOWNLOAD FLOTTANTE
   ========================================================================== */

.floating-download-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 100;
  background: var(--bg-surface);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--border-surface);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.35), 0 0 24px var(--brand-accent-glow);
  border-radius: 9999px;
  padding: 8px 10px 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease, visibility 0s linear 0.45s;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.floating-download-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

/* ==========================================================================
   FAQ
   ========================================================================== */

.faq-item {
  border-bottom: 1px solid var(--border-card);
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 24px 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.faq-question:hover { color: var(--brand-accent); }

.faq-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
}

/* L'altezza reale viene impostata da JS (scrollHeight): nessun testo tagliato */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
}

.faq-answer-inner { padding-bottom: 24px; }

.faq-item.open .faq-icon {
  transform: rotate(45deg);
  color: var(--brand-accent);
}

/* ==========================================================================
   BOTTONI
   ========================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 16px;
  background: var(--text-main);
  color: var(--bg-scaffold);
  font-weight: 800;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, opacity 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
  opacity: 0.95;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 16px;
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid var(--border-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.btn-secondary:hover {
  border-color: var(--brand-accent);
  background: var(--bg-card);
  transform: translateY(-2px);
}

/* Store non ancora collegato (nessun URL in app.js → STORE_LINKS) */
[data-store][aria-disabled="true"] {
  cursor: default;
  opacity: 0.85;
}

[data-store][aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   MOVIMENTO RIDOTTO
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .reveal-on-scroll { opacity: 1; translate: none; }
}

/* ==========================================================================
   SUGGERIMENTO LINGUA (visitatori non italiani sulla home italiana)
   ========================================================================== */

.lang-suggest {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 10px 12px 10px 16px;
  border-radius: 9999px;
  background: var(--text-main);
  color: var(--bg-scaffold);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.4);
}

.lang-suggest a { color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

.lang-suggest button {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(127, 127, 127, 0.25);
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

/* ==========================================================================
   SCHERMATE DELL'APP (repliche fedeli, disegnate a 360 px di larghezza e scalate)
   --s = larghezza schermo del telefono / 360 (impostata da app.js, con fallback)
   ========================================================================== */

.iphone-screen { --s: 0.8333; }
.workflow-phone .iphone-screen { --s: 0.7778; }

.app-ui {
  --a-bg: #EDF1F8;
  --a-glow1: rgba(170, 213, 243, 0.46);
  --a-glow2: rgba(228, 205, 243, 0.34);
  --a-text: #0F1729;
  --a-muted: #5F6F86;
  --a-card: rgba(255, 255, 255, 0.94);
  --a-line: rgba(15, 23, 42, 0.07);
  --a-shadow: 0 10px 28px -10px rgba(30, 50, 90, 0.16), 0 1px 3px rgba(30, 50, 90, 0.05);
  --a-accent: #0B6AAE;
  --a-green: #14A06A;
  --a-green-bg: #DFF5EA;
  --a-green-line: #A3DFC3;
  --a-red: #E0304A;
  --a-red-bg: #FCDCE1;
  --a-chip: #FFFFFF;
  --a-field: #F3F5F9;
  --a-nav-bg: #FCFDFE;
  --a-nav-on: #E3EAF6;
  --a-nav-on-line: #BFCADB;
  --a-nav-off: #6B7A90;
  --a-sheet: #F8F8FA;
  --a-btn: #101114;

  --t-red: #FBD6DB;     --i-red: #E3445D;
  --t-green: #D2F1E2;   --i-green: #1BA56E;
  --t-indigo: #E3E5FA;  --i-indigo: #5557D3;
  --t-amber: #FCEFCB;   --i-amber: #E09E0A;
  --t-blue: #D8EBF8;    --i-blue: #1C86C6;
  --t-mint: #D3F1E2;    --i-mint: #1BA56E;
  --t-peach: #FCEBC8;   --i-peach: #E6A216;
  --t-lilac: #EEE2FA;   --i-lilac: #9A55D1;

  font-family: Roboto, 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--a-text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

html.dark .app-ui {
  /* Tema scuro ricavato dagli screen reali (iOS): fondo blu notte, riquadri piatti con contorno azzurro */
  --a-bg: #070B15;
  --a-glow1: rgba(16, 104, 150, 0.52);
  --a-glow2: rgba(88, 64, 176, 0.20);
  --a-text: #FFFFFF;
  --a-muted: #8E9DB5;
  --a-card: #0A1220;
  --a-line: rgba(64, 146, 208, 0.34);
  --a-shadow: none;
  --a-accent: #2FB4F5;
  --a-green: #1FBF7F;
  --a-green-bg: rgba(31, 191, 127, 0.13);
  --a-green-line: rgba(31, 191, 127, 0.50);
  --a-red: #F43F5E;
  --a-red-bg: rgba(244, 63, 94, 0.18);
  --a-chip: #0F1A2D;
  --a-field: #0C1526;
  --a-nav-bg: #0A1424;
  --a-nav-on: #123B5C;
  --a-nav-on-line: #2A7DB5;
  --a-nav-on-text: #3DB8F7;
  --a-nav-off: #8FA0B8;
  --a-sheet: #0B1424;
  --a-btn: #F1F5F9;

  --t-red: #3A1426;     --i-red: #F43F5E;
  --t-green: #0D3B30;   --i-green: #1FBF7F;
  --t-indigo: #1E2347;  --i-indigo: #8088F2;
  --t-amber: #3A2E14;   --i-amber: #F5B50A;
  --t-blue: #0F2D45;    --i-blue: #38A8EA;
  --t-mint: #0D3B30;    --i-mint: #1FBF7F;
  --t-peach: #3A2E14;   --i-peach: #F5B50A;
  --t-lilac: #2A1F45;   --i-lilac: #A872E8;
}

.app-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  height: calc(100% / var(--s));
  scale: var(--s);
  transform-origin: 0 0;
  overflow: hidden;
  background:
    radial-gradient(300px 230px at 18% 4%, var(--a-glow1), transparent 72%),
    radial-gradient(240px 200px at 88% 62%, var(--a-glow2), transparent 72%),
    var(--a-bg);
  font-size: 14px;
  line-height: 1.25;
}

.app-screen *, .app-screen *::before, .app-screen *::after { box-sizing: border-box; }
.app-screen .ic { width: 1em; height: 1em; flex: none; display: block; }
.app-screen hr { border: 0; margin: 0; }
.app-screen p, .app-screen h3 { margin: 0; }

.a-body { position: absolute; inset: 0; padding: 46px 18px 0; }
.a-row { display: flex; align-items: center; }
.a-between { justify-content: space-between; }

/* Header */
.a-top { display: flex; justify-content: flex-end; gap: 8px; height: 32px; }
.a-circ {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px;
  background: var(--a-card); border: 1px solid var(--a-line);
  box-shadow: 0 3px 10px -3px rgba(30, 50, 90, 0.18);
  color: var(--a-text);
}
.a-circ.dark { background: linear-gradient(160deg, #6a6a6e, #3b3b3f); color: #fff; border-color: transparent; font-size: 17px; }
.a-avatar {
  background: linear-gradient(140deg, #d3e8f8, #9ccbea); border-color: #84b7da;
  color: #1C69A3; font-weight: 800; font-size: 12.5px;
}
html.dark .a-avatar { background: linear-gradient(140deg, #2b5075, #1f3a58); border-color: #3e6a95; color: #9fd3f6; }

.a-title { font-size: 21.5px; line-height: 26px; font-weight: 900; letter-spacing: -0.045em; margin-top: 16px; }
.a-title.greet { font-size: 18.8px; line-height: 24px; margin-top: 10.7px; }
.a-sub { font-size: 10.9px; font-weight: 500; color: var(--a-muted); margin-top: 2px; letter-spacing: 0.005em; }

/* Selettore mese */
.a-monthrow { justify-content: space-between; margin-top: 11px; }
.a-monthsel {
  display: flex; align-items: center; justify-content: space-between; width: 144px; height: 31px;
  padding: 0 12px; border-radius: 99px; background: var(--a-card); border: 1px solid var(--a-line);
  box-shadow: var(--a-shadow); font-size: 12px; font-weight: 500;
}
.a-ch { font-size: 13px; display: grid; place-items: center; }
.a-mtxt { display: flex; align-items: center; gap: 4px; }
.a-down { font-size: 13px; color: var(--a-muted); }
.a-curr {
  display: flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px; border-radius: 99px;
  background: #CFE3F4; border: 1px solid #9DC4E4; color: #1B6BA6;
  font-size: 8.9px; font-weight: 700; letter-spacing: 0.09em;
}
.a-curr i { width: 6px; height: 6px; border-radius: 50%; background: #1B6BA6; }
html.dark .a-curr { background: rgba(56, 160, 230, 0.2); border-color: rgba(91, 182, 238, 0.45); color: #7CC4F2; }
html.dark .a-curr i { background: #7CC4F2; }

/* Card */
.a-card { background: var(--a-card); border: 1px solid var(--a-line); border-radius: 25px; box-shadow: var(--a-shadow); }
.a-cap { font-size: 9.9px; font-weight: 700; letter-spacing: 0.12em; color: var(--a-muted); text-transform: uppercase; }
.a-cap.sm { font-size: 8.7px; letter-spacing: 0.1em; }
.a-cap-eye { display: flex; align-items: center; gap: 10px; }
.a-eye { font-size: 18px; color: var(--a-muted); background: none; border: 0; padding: 0; display: grid; place-items: center; cursor: pointer; line-height: 1; }
button.a-eye:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 3px; border-radius: 6px; }

.a-balance { margin-top: 16px; padding: 18px 18px 11px; }
.a-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 11px; border-radius: 99px;
  background: var(--a-green-bg); border: 1px solid var(--a-green-line); color: var(--a-green);
  font-size: 10.6px; font-weight: 700; letter-spacing: 0.01em;
}
.a-badge.neg { background: var(--a-red-bg); border-color: rgba(224, 48, 74, 0.35); color: var(--a-red); }
.a-badge.neg .a-bi { transform: scaleY(-1); }
.a-bi { font-size: 14px; display: grid; place-items: center; }
.a-badge.wide { height: 23px; margin-top: 11px; padding: 0 10px 0 9px; font-weight: 700; font-size: 10.4px; color: #11874F; background: #D9F4E6; }
html.dark .a-badge.wide { color: var(--a-green); background: var(--a-green-bg); }

.a-big { font-size: 30px; line-height: 34px; font-weight: 900; letter-spacing: -0.03em; margin-top: 15px; }
.a-big2 { margin-top: 16.3px; font-size: 29.8px; }
.a-note { font-size: 10.1px; font-weight: 500; color: var(--a-muted); margin-top: 7px; }
.a-hr { height: 1.5px; background: var(--a-line); margin: 14px 0 12px !important; opacity: 1; }
.a-balance .a-hr, .a-nw .a-hr { background: rgba(80, 95, 120, 0.4); height: 1px; }
html.dark .a-balance .a-hr, html.dark .a-nw .a-hr { background: rgba(255,255,255,0.18); }
.a-inex { display: flex; align-items: center; }
.a-ie { display: flex; align-items: center; gap: 9px; flex: 1; }
.a-vsep { width: 1.5px; height: 32px; background: rgba(80, 95, 120, 0.35); margin: 0 14px 0 4px; flex: none; }
.a-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; flex: none; }
.a-dot.g { background: #D5F2E4; color: var(--a-green); }
.a-dot.r { background: var(--a-red-bg); color: var(--a-red); }
.a-dot.sm { width: 23px; height: 23px; font-size: 12px; }
html.dark .a-dot.g { background: var(--a-green-bg); }
.a-val { font-size: 11.9px; font-weight: 800; margin-top: 3px; letter-spacing: -0.005em; }
.a-val.g, .a-st-v.g, .a-avg-v.g { color: var(--a-green); }
.a-val.r, .a-st-v.r, .a-avg-v.r { color: var(--a-red); }

/* Azioni rapide */
.a-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.a-act {
  height: 77px; border-radius: 21px; background: var(--a-card); border: 1px solid var(--a-line);
  box-shadow: var(--a-shadow); display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 11px 0 0; gap: 8px; font-family: inherit; color: var(--a-text); cursor: default;
}
button.a-act { cursor: pointer; }
button.a-act:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }
.a-act-ic { width: 35px; height: 35px; border-radius: 14px; display: grid; place-items: center; font-size: 19px; }
.a-act-ic.red { background: var(--t-red); color: var(--i-red); }
.a-act-ic.green { background: var(--t-green); color: var(--i-green); }
.a-act-ic.indigo { background: var(--t-indigo); color: var(--i-indigo); }
.a-act-ic.amber { background: var(--t-amber); color: var(--i-amber); }
.a-act-l { font-size: 10.3px; font-weight: 700; letter-spacing: -0.01em; }

/* Sezioni */
.a-sec { margin-top: 18px; }
.a-link { font-size: 11.2px; font-weight: 700; color: var(--a-accent); }
.a-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 7.5px; }
.a-acc { height: 98px; padding: 11px 11px 0 12px; border-radius: 22px; background: var(--a-card); border: 1px solid var(--a-line); box-shadow: var(--a-shadow); }
.a-acc-top { display: flex; align-items: center; justify-content: space-between; }
.a-tile { width: 28px; height: 28px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: none; }
.a-tile.lg { width: 38px; height: 38px; border-radius: 14px; font-size: 21px; border: 1px solid rgba(0,0,0,0.04); }
.a-tile.round { border-radius: 50%; width: 32px; height: 32px; font-size: 17px; border: 1px solid #A7CFEB; }
.a-tile.blue { background: var(--t-blue); color: var(--i-blue); }
.a-tile.mint { background: var(--t-mint); color: var(--i-mint); }
.a-tile.peach { background: var(--t-peach); color: var(--i-peach); }
.a-tile.lilac { background: var(--t-lilac); color: var(--i-lilac); }
.a-tag { height: 14px; padding: 0 8px; gap: 3px; border-radius: 99px; font-size: 9.1px; font-weight: 700; display: inline-flex; align-items: center; border: 1px solid; }
.a-tag.bank, .a-tag.blue { background: #DCEFFA; border-color: #A6D3EE; color: #2F9AD0; }
.a-tag.mint { background: #DAF5E8; border-color: #A5E0C3; color: #2BBB86; }
.a-tag.amber { background: #FDF1CC; border-color: #F0D88B; color: #DDA21C; }
.a-tag.lilac { background: #F1E5FB; border-color: #D9C0F0; color: #A468D8; }
html.dark .a-tag.bank, html.dark .a-tag.blue { background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.4); color: #6FC8F2; }
html.dark .a-tag.mint { background: rgba(52,211,153,0.14); border-color: rgba(52,211,153,0.4); color: #4ADE9F; }
html.dark .a-tag.amber { background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.4); color: #FBBF24; }
html.dark .a-tag.lilac { background: rgba(192,132,252,0.16); border-color: rgba(192,132,252,0.4); color: #C99BFF; }
.a-acc-n { font-size: 11.3px; font-weight: 700; margin-top: 12px; letter-spacing: -0.01em; }
.a-acc-v { font-size: 12.9px; font-weight: 800; margin-top: 4px; letter-spacing: -0.01em; }

/* Barra di navigazione */
.a-nav {
  position: absolute; left: 22px; right: 22px; bottom: 14px; height: 59px; border-radius: 99px;
  background: var(--a-nav-bg); border: 1px solid var(--a-line); box-shadow: 0 8px 26px -6px rgba(30, 50, 90, 0.28);
  display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; padding: 0 5px; z-index: 5;
}
.a-nav-i { height: 49px; border-radius: 99px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 13.5px; font-weight: 500; color: var(--a-nav-off); letter-spacing: -0.01em; border: 1px solid transparent; font-size: 0; }
.a-nav-i .ic { font-size: 22px; }
.a-nav-i > span { font-size: 9.6px; }
.a-nav-i.on { background: var(--a-nav-on); border-color: var(--a-nav-on-line); color: var(--a-nav-on-text, var(--a-text)); font-weight: 700; }
.a-nav-i.on > span { font-weight: 700; }

/* Dettaglio spesa */
.a-shift { position: absolute; inset: 0; transform: translateY(-262px); }
.a-shift .a-nav { display: none; }
.a-scrim { position: absolute; inset: 0; background: rgba(34, 44, 62, 0.58); z-index: 8; }
.a-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; height: 259px; z-index: 9; background: var(--a-sheet);
  border-radius: 30px 30px 0 0; padding: 22.7px 22px 0; box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}
.a-grab { display: block; width: 32px; height: 4px; border-radius: 4px; background: rgba(120, 130, 150, 0.45); margin: 0 auto 16px; }
.a-sh-top { align-items: flex-start; }
.a-sh-t { font-size: 20.8px; font-weight: 900; letter-spacing: -0.04em; line-height: 25px; }
.a-sh-d { font-size: 10.9px; font-weight: 500; color: var(--a-muted); margin-top: 1px; }
.a-sh-r { gap: 11px; margin-top: 2px; }
.a-sh-amt { font-size: 16.7px; font-weight: 800; color: var(--a-red); letter-spacing: -0.01em; }
.a-x { width: 28px; height: 28px; border-radius: 50%; background: rgba(120, 130, 150, 0.2); display: grid; place-items: center; font-size: 16px; }
.a-chips { display: flex; gap: 8px; margin-top: 19px; }
.a-chip { height: 24px; padding: 0 11px; border-radius: 99px; background: var(--a-chip); border: 1px solid var(--a-line); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; }
.a-chip.dk { background: rgba(120, 130, 150, 0.28); border-color: rgba(60, 70, 90, 0.5); }
.a-bk { font-size: 12.9px; font-weight: 800; margin-top: 19.3px; letter-spacing: -0.01em; }
.a-bkr { margin-top: 7px; }
.a-bkl { gap: 10px; font-size: 12.8px; font-weight: 500; }
.a-bkl .ic { font-size: 16px; }
.a-bkv { font-size: 12.9px; font-weight: 500; }
.a-btns { gap: 10px; margin-top: 24.6px; }
.a-btn-dark { flex: 1; height: 41px; border-radius: 99px; background: var(--a-btn); color: var(--a-bg); display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 12.4px; font-weight: 700; }
html.dark .a-btn-dark { color: #0B1220; }
.a-btn-dark .ic { font-size: 13px; }
.a-btn-del { width: 41px; height: 41px; border-radius: 16px; background: rgba(224, 48, 74, 0.12); color: var(--a-red); display: grid; place-items: center; font-size: 15px; }

/* Patrimonio */
.a-nw { margin-top: 13px; padding: 20px 18px 16px; }
.a-nw .a-big { margin-top: 11px; }
.a-nw .a-hr { margin: 16px 0 12px !important; }
.a-tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.a-t3 { height: 47px; border-radius: 15px; border: 1px solid; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.a-t3l { display: flex; align-items: center; gap: 5px; font-size: 9.4px; font-weight: 700; letter-spacing: -0.01em; }
.a-t3l .ic { font-size: 13px; }
.a-t3v { font-size: 11.9px; font-weight: 800; color: var(--a-text); }
.a-t3.indigo { background: #E9E8FB; border-color: #C5C3F0; color: #4F46C8; }
.a-t3.amber { background: #FDF1DC; border-color: #F3D9A4; color: #D9871A; }
.a-t3.lilac { background: #F4E9FA; border-color: #DCC3EE; color: #8E44AD; }
html.dark .a-t3.indigo { background: rgba(129,140,248,0.16); border-color: rgba(129,140,248,0.4); color: #A5B0FF; }
html.dark .a-t3.amber { background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.4); color: #FBBF24; }
html.dark .a-t3.lilac { background: rgba(192,132,252,0.16); border-color: rgba(192,132,252,0.4); color: #C99BFF; }
.a-sec2 { margin-top: 24px; min-height: 26px; }
.a-sec2.solo { min-height: 0; }
.a-addbtn { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 9px; border-radius: 99px; background: var(--a-card); border: 1px solid var(--a-line); font-size: 11.9px; font-weight: 700; box-shadow: var(--a-shadow); letter-spacing: -0.01em; }
.a-addbtn .ic { font-size: 12px; }
.a-li { display: flex; align-items: center; gap: 15px; height: 66px; margin-top: 4.2px; padding: 0 14px 0 14px; border-radius: 26px; }
.a-li-n { font-size: 14px; font-weight: 800; letter-spacing: -0.02em; flex: 1; }
.a-li-v { font-size: 14.5px; font-weight: 800; letter-spacing: -0.015em; }
.a-li.ed { height: 66px; padding-right: 14px; }
.a-li-m { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.a-li-m .a-li-n { flex: none; }
.a-li-s { font-size: 10.3px; font-weight: 500; color: var(--a-muted); }
.a-li-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.a-exp { height: 18px; padding: 0 9px; border-radius: 99px; background: var(--a-green-bg); border: 1px solid var(--a-green-line); color: var(--a-green); font-size: 8.4px; font-weight: 700; display: inline-flex; align-items: center; }
.a-empty { height: 41px; margin-top: 5px; margin-bottom: 4px; display: grid; place-items: center; font-size: 11.9px; font-weight: 400; color: var(--a-muted); border-radius: 22px; }

/* Statistiche */
.a-an { margin-top: 13px; padding: 20px 18px 16px; }
.a-yearsel { display: flex; align-items: center; gap: 10px; height: 25px; padding: 0 10px; border-radius: 99px; background: var(--a-field); border: 1px solid rgba(80,95,120,0.28); font-size: 13px; }
.a-yearsel b { font-weight: 800; font-size: 12.3px; }
.a-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 15.2px; }
.a-st { height: 77px; border-radius: 19px; background: var(--a-field); border: 1px solid rgba(80,95,120,0.3); padding: 7px 13px 0; }
.a-st-h { display: flex; align-items: center; gap: 8px; font-size: 10.3px; font-weight: 500; letter-spacing: -0.005em; }
.a-st-v { font-size: 15.6px; font-weight: 800; margin-top: 3.5px; letter-spacing: -0.01em; }
.a-st-s { font-size: 8.2px; color: var(--a-muted); font-weight: 400; margin-top: 3px; }
.a-avg { display: flex; align-items: center; height: 51px; margin-top: 10px; padding: 0 13px; border-radius: 19px; background: var(--a-field); border: 1px solid rgba(80,95,120,0.3); }
.a-avg > div:first-child { flex: 1; }
.a-avg > div:last-child { flex: 1; }
.a-avg .a-vsep { height: 26px; margin: 0 14px 0 0; }
.a-avg-l { font-size: 9.2px; font-weight: 500; color: var(--a-muted); }
.a-avg-v { font-size: 12px; font-weight: 700; margin-top: 3px; }
.a-trend { margin-top: 12.7px; padding: 14px 16px 12px; height: 168px; }
.a-tr-h { align-items: baseline; }
.a-tr-h .a-cap { font-size: 9.9px; white-space: nowrap; }
.a-hint { white-space: nowrap; font-size: 9.9px; font-weight: 500; color: var(--a-muted); }
.a-chart { position: relative; height: 112px; margin-top: 8px; display: grid; grid-template-columns: repeat(12, 1fr); align-items: end; }
.a-mc { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 7.6px; font-weight: 500; color: var(--a-muted); gap: 7px; }
.a-mc.on { color: var(--a-text); font-weight: 700; }
.a-bars { height: 88px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.a-bars i { display: block; border-radius: 3px; }
.a-bars i.d { width: 6px; height: 3.5px; background: rgba(120,130,150,0.28); border-radius: 2px; }
.a-bars i.bg { width: 6px; height: 85px; background: #2DC76D; border-radius: 3px; }
.a-bars i.br { width: 6px; height: 6px; background: #EF4B5F; border-radius: 3px; }
.a-rec { margin-top: 16px; padding: 14px 16px; display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; border-radius: 25px; height: 96px; }
.a-rec-t { font-size: 12.7px; font-weight: 900; letter-spacing: -0.02em; line-height: 21px; padding-top: 0; }
.a-rec .a-link { font-size: 12.3px; }

/* Demo hero: privacy (occhio) e interazioni */
.app-screen.is-live.amounts-hidden .amt { filter: blur(7px); transition: filter 0.25s ease; user-select: none; }
.app-screen .amt { transition: filter 0.25s ease; }

/* Il telefono "dietro" mostra la stessa app, solo più piccolo */
.phone-back .iphone-screen { opacity: 1; }

.a-eye .i-off { display: none; }
.a-eye[aria-pressed="true"] .i-off { display: block; }
.a-eye[aria-pressed="true"] .i-eye { display: none; }

/* Tema scuro: rifiniture dei componenti (colori letti dagli screen) */
html.dark .a-circ { background: #0B1424; border-color: rgba(64, 146, 208, 0.40); box-shadow: none; }
html.dark .a-circ.dark { background: linear-gradient(160deg, #9b9b9e, #55555a); border-color: transparent; }
html.dark .a-avatar { background: #12395A; border-color: #2A7DB5; color: #38B6F5; }
html.dark .a-curr { background: #0A2540; border-color: #0F5A8C; color: #2AA6E8; }
html.dark .a-curr i { background: #2AA6E8; }
html.dark .a-monthsel, html.dark .a-addbtn { background: #0A1220; box-shadow: none; }
html.dark .a-card, html.dark .a-act, html.dark .a-acc { border-width: 1.3px; }
html.dark .a-dot.g { background: #0F3B33; }
html.dark .a-tag.bank, html.dark .a-tag.blue { background: #0B2A44; border-color: #1B6FA8; color: #38A8F0; }
html.dark .a-tag.mint { background: #0C2F2A; border-color: #167A5A; color: #1FBF7F; }
html.dark .a-tag.amber { background: #2E2410; border-color: #8A6A10; color: #F5B50A; }
html.dark .a-tag.lilac { background: #231A3C; border-color: #5B3FA0; color: #A872E8; }
html.dark .a-t3.indigo { background: #131838; border-color: #2F3A8A; color: #8B93FF; }
html.dark .a-t3.amber { background: #201A15; border-color: #6B4A18; color: #F59E0B; }
html.dark .a-t3.lilac { background: #1D1233; border-color: #4A2F7A; color: #B58AF0; }
html.dark .a-badge.wide { background: var(--a-green-bg); color: var(--a-green); }
html.dark .a-balance .a-hr, html.dark .a-nw .a-hr { background: #17405F; }
html.dark .a-vsep { background: #17405F; }
html.dark .a-st, html.dark .a-avg { background: #0C1526; border-color: rgba(64, 146, 208, 0.30); }
html.dark .a-yearsel { background: #0C1526; border-color: rgba(64, 146, 208, 0.34); }
html.dark .a-btn-dark { color: #0B1220; }
html.dark .a-tile.round { border-color: rgba(64, 146, 208, 0.45); }
html.dark .a-exp { background: rgba(31,191,127,0.13); }
html.dark .a-nav { box-shadow: 0 8px 26px -6px rgba(0, 0, 0, 0.7); }
