/* =========================================================
   GrowingApp · Smart Link — tema dark green/black
   Palette dal brand reale dell'app:
   sfondo quasi nero · accento verde vivo hsl(145 63% 42%)
   ========================================================= */

:root {
  --bg: #0a0d0b;             /* off-black con velo verde */
  --bg-2: #0e130f;
  --brand: hsl(145 63% 48%);      /* verde vivo (accento unico) */
  --brand-deep: hsl(145 63% 38%);
  --brand-glow: hsl(145 72% 46%);
  --surface: rgba(255, 255, 255, 0.045); /* vetro scuro */
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-bright: rgba(255, 255, 255, 0.16);
  --ink: #eef3ef;            /* off-white */
  --ink-soft: #8fa399;       /* verde-grigio secondario */
  --radius: 26px;
  --radius-btn: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 28px 24px;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(140% 110% at 50% -20%, var(--bg-2) 0%, var(--bg) 55%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Sfondi decorativi ---------- */
/* Alone verde che "respira" dietro la card (tema crescita). */
.bg-glow {
  position: fixed;
  top: -16%;
  left: 50%;
  width: min(640px, 120vw);
  height: min(640px, 120vw);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 50%, hsl(145 72% 46% / 0.28) 0%, transparent 62%);
  filter: blur(14px);
  animation: breathe 9s ease-in-out infinite;
}

/* Grana fine per profondità: pseudo-elemento fisso, non interattivo. */
.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Card centrale (vetro scuro) ---------- */
.card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 390px;
  background:
    linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 28px 32px;
  text-align: center;
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 30px 80px -28px rgba(0, 0, 0, 0.85);
  animation: rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---------- Logo con alone ---------- */
.logo-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
}
.logo-wrap::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 30px;
  background: radial-gradient(circle, var(--brand-glow) 0%, transparent 70%);
  opacity: 0.5;
  filter: blur(8px);
  z-index: -1;
}
.logo {
  width: 92px;
  height: 92px;
  border-radius: 23px;
  display: block;
  border: 1px solid var(--border-bright);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.7);
}

.app-name {
  margin: 0;
  font-size: 1.68rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.app-tagline {
  margin: 5px 0 0;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}
.app-intro {
  margin: 12px auto 0;
  max-width: 30ch;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--ink);
}

/* ---------- Dettagli / feature list ---------- */
.features {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}
.feature { display: flex; gap: 13px; align-items: flex-start; }
.feature-ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: hsl(145 63% 45% / 0.12);
  border: 1px solid hsl(145 63% 50% / 0.22);
}
.feature-ico svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feature-txt strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--ink);
}
.feature-txt span {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---------- Gestione stati ---------- */
/* CTA nascoste finché il JS non sceglie lo stato: niente flash. */
.state { display: none; margin-top: 24px; }
body.show-countdown .state--countdown { display: block; }
body.show-fallback .state--fallback { display: block; }
body.is-loading .state { display: none; }

/* ---------- Stato: countdown ---------- */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: conic-gradient(from 90deg, transparent 0%, var(--brand) 95%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
          mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
  animation: spin 0.85s linear infinite;
}
.countdown-msg {
  margin: 0 0 16px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}
#countdownValue {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* ---------- Stato: fallback ---------- */
.fallback-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.fallback-sub {
  margin: 6px 0 18px;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.store-buttons { display: flex; flex-direction: column; gap: 12px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 15px 18px;
  border-radius: var(--radius-btn);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.18s ease, box-shadow 0.2s ease,
    border-color 0.2s ease, background 0.2s ease;
}
.btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-bright);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.8);
}
.btn:active { transform: translateY(0); }

/* Bottone primario: pieno verde brand */
.btn--primary {
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  border-color: transparent;
  color: #06150d;
  box-shadow: 0 12px 30px -12px hsl(145 63% 42% / 0.6);
}
.btn--primary:hover {
  background: linear-gradient(180deg, hsl(145 63% 52%), var(--brand));
  border-color: transparent;
  box-shadow: 0 16px 36px -12px hsl(145 63% 42% / 0.75);
}
.btn--primary .btn-glyph { fill: #06150d; stroke: none; }

.btn-glyph { width: 22px; height: 22px; fill: var(--brand); flex: none; }

.btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}
.btn-text small { font-size: 0.7rem; font-weight: 500; opacity: 0.8; }
.btn-text strong { font-size: 1rem; font-weight: 700; }

/* Bottone con link non configurato */
.btn.is-disabled {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--ink-soft);
  pointer-events: none;
  box-shadow: none;
}
.btn.is-disabled .btn-glyph { fill: var(--ink-soft); }

.config-warning {
  margin: 18px 0 0;
  font-size: 0.8rem;
  color: hsl(40 80% 65%);
}

/* ---------- Footer ---------- */
.page-footer {
  position: relative;
  z-index: 2;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* ---------- Animazioni ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  50%      { opacity: 0.85; transform: translateX(-50%) scale(1.08); }
}

/* ---------- Accessibilità: meno movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .bg-glow { animation: none; }
  .spinner { animation-duration: 1.8s; }
  .btn { transition: none; }
}

/* ---------- Fallback se la trasparenza è ridotta ---------- */
@media (prefers-reduced-transparency: reduce) {
  .card {
    background: #11160f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
