/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #05050a;
  --bg2: #0b0b14;
  --bg3: #111122;
  --accent: #5d5fef;
  --accent2: #7d7ffd;
  --text: #f3f3fa;
  --muted: #8b8ba9;
  --muted2: #58587d;
  --border: rgba(255,255,255,0.05);
  --border2: rgba(255,255,255,0.1);
  --card: rgba(255,255,255,0.02);
  --radius: 14px;
  --radius-lg: 24px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
p { color: var(--muted); line-height: 1.8; }

/* ===== CANVAS BACKGROUND ===== */
#heroCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  padding: 150px 24px 0;
  overflow: hidden;
  background: var(--bg);
  
  /* MASCHERA AVANZATA NATIVA: Sfuma a 0 le icone ai lati e sui bordi in modo morbido e impercettibile */
  mask-image: radial-gradient(circle at 50% 50%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 20%, transparent 75%);
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), #4a4cee);
  color: #fff;
  padding: 14px 30px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  font-family: 'Space Grotesk', sans-serif;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(93,95,239,0.2);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(93,95,239,0.4);
  background: linear-gradient(135deg, var(--accent2), var(--accent));
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  padding: 14px 30px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.92rem;
  border: 1px solid var(--border2);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-secondary:hover {
  border-color: var(--accent2);
  background: rgba(93,95,239,0.08);
  transform: translateY(-2px);
}

.btn-full { width: 100%; justify-content: center; padding: 16px; font-size: 0.95rem; }

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 64px;
  background: rgba(5,5,10,0.75);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}
.nav.scrolled {
  padding: 14px 64px;
  background: rgba(5,5,10,0.9);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.15em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
}
.nav-links a {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: #fff; }

.nav-cta {
  color: #fff !important;
  background: rgba(93,95,239,0.1);
  border: 1px solid rgba(93,95,239,0.25);
  padding: 9px 22px;
  border-radius: 9px;
  transition: all 0.2s ease !important;
}
.nav-cta:hover { background: rgba(93,95,239,0.25) !important; border-color: var(--accent2) !important; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MOBILE MENU ===== */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px; left: 0; right: 0;
  z-index: 99;
  background: rgba(11,11,20,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
}
.mobile-menu a {
  padding: 18px 32px;
  font-size: 1rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  transition: all 0.2s;
}
.mobile-menu a:hover { color: #fff; background: rgba(255,255,255,0.02); }
.mobile-menu.open { display: flex; }

/* Chat wrapper */
.chat-wrap { max-width: 720px; margin: 0 auto; }

.chat-output {
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px 16px 0 0;
}

.chat-message { padding: 14px 18px; border-radius: 12px; font-size: 0.95rem; line-height: 1.6; }
.chat-message--user    { background: rgba(255,255,255,0.08); align-self: flex-end; max-width: 80%; }
.chat-message--assistant { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }
.chat-message--error   { background: rgba(255,80,80,0.1); border: 1px solid rgba(255,80,80,0.2); }

.chat-topic   { font-weight: 600; margin-bottom: 6px; }
.chat-sources, .chat-tools { font-size: 0.8rem; opacity: 0.5; margin-top: 8px; }

/* Loader puntini */
.chat-loader { display: flex; gap: 6px; padding: 18px; }
.chat-loader span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.4; animation: blink 1.2s infinite; }
.chat-loader span:nth-child(2) { animation-delay: 0.2s; }
.chat-loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{ opacity:0.2 } 40%{ opacity:1 } }

.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: none;
  border-radius: 0 0 16px 16px;
}
.chat-form input { flex: 1; background: transparent; border: none; outline: none; color: inherit; font-size: 0.95rem; }
.chat-form .btn-primary { display: flex; align-items: center; gap: 8px; white-space: nowrap; }

.chat-footer { text-align: right; margin-top: 10px; }
.chat-reset  { background: none; border: none; color: inherit; opacity: 0.4; font-size: 0.8rem; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chat-reset:hover { opacity: 0.8; }

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
  padding: 150px 24px 0;
  overflow: hidden;
  /* MIGLIORATO: Gradiente radiale scuro potenziato per nascondere la comparsa/scomparsa delle icone sui bordi dello schermo */
  background: radial-gradient(circle at 50% 50%, transparent 10%, var(--bg) 80%);
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 1;
}
.hero-glow--1 {
  width: 600px; height: 600px;
  background: rgba(93,95,239,0.15);
  top: -80px; left: 50%;
  transform: translateX(-50%);
}
.hero-glow--2 {
  width: 500px; height: 500px;
  background: rgba(168,85,247,0.06);
  bottom: 50px; right: -50px;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.015) 1px, transparent 0);
  background-size: 40px 40px;
  /* Maschera progressiva che sfuma dolcemente gli elementi dello sfondo */
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 30%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

.hero-inner { position: relative; z-index: 2; max-width: 800px; }

.hero-badge {
  display: inline-block;
  background: rgba(93,95,239,0.1);
  border: 1px solid rgba(93,95,239,0.3);
  color: var(--accent2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 7px 20px;
  border-radius: 99px;
  margin-bottom: 32px;
  font-family: 'DM Mono', monospace;
}

.hero-title {
  font-size: clamp(3.2rem, 9vw, 5.8rem);
  font-weight: 700;
  line-height: 1.05;
  color: #fff;
  margin-bottom: 28px;
  letter-spacing: -0.03em;
}
.hero-title span {
  background: linear-gradient(135deg, var(--accent2), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 44px;
  line-height: 1.8;
}

.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.hero-stats-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  margin-top: 90px;
  padding: 32px 56px;
  background: rgba(11,11,20,0.5);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 760px;
}
.hero-stat { flex: 1; text-align: center; }
.hero-stat-num {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  font-family: 'DM Mono', monospace;
  margin-bottom: 4px;
}
.hero-stat-label {
  font-size: 0.75rem;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.hero-stat-divider { width: 1px; height: 44px; background: var(--border); flex-shrink: 0; }

/* ===== SECTIONS ===== */
.section { padding: 130px 24px; position: relative; z-index: 3; }
.section--dark { background: var(--bg2); }
.container { max-width: 1140px; margin: 0 auto; }

.section-header { margin-bottom: 64px; text-align: left; }
.section-header .section-sub { max-width: 560px; margin-top: 14px; font-size: 1.05rem; }

.section-label {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ===== PREMIUM GAMES GRID ===== */
.games-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-card {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 32px 40px;
  background: linear-gradient(145deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  color: inherit;
  position: relative;
}
.game-card:hover {
  background: linear-gradient(145deg, rgba(93,95,239,0.06) 0%, rgba(255,255,255,0.01) 100%);
  border-color: rgba(93,95,239,0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.game-card-icon {
  width: 110px;
  height: 110px;
  border-radius: 22px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border2);
  box-shadow: 0 12px 32px rgba(0,0,0,0.6);
}
.game-card-icon img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.game-card:hover .game-card-icon img { transform: scale(1.08); }

.game-card-body { flex: 1; min-width: 0; }

.game-card-top { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.game-card-top h3 { font-size: 1.25rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }

.game-badge {
  font-size: 0.72rem; font-weight: 600; font-family: 'DM Mono', monospace;
  color: var(--accent2); background: rgba(93,95,239,0.08);
  border: 1px solid rgba(93,95,239,0.2); padding: 4px 12px; border-radius: 99px;
}

.game-card-body > p { font-size: 0.95rem; color: var(--muted); margin-bottom: 20px; }

.game-stats { display: flex; gap: 36px; }
.gs-num {
  display: block; font-size: 1.05rem; font-weight: 600; color: #fff;
  font-family: 'DM Mono', monospace; margin-bottom: 2px;
}
.gs-label { font-size: 0.72rem; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.1em; }

.game-card-arrow { color: var(--muted2); flex-shrink: 0; transition: all 0.3s; }
.game-card:hover .game-card-arrow { color: var(--accent2); transform: translateX(6px); }

/* ===== ABOUT ===== */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 88px; align-items: center; }
.about-left p { margin-bottom: 24px; font-size: 1.02rem; }
.about-features { display: flex; flex-direction: column; gap: 12px; }

.feature {
  display: flex; gap: 20px; padding: 28px;
  background: rgba(255,255,255,0.01);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: all 0.3s;
}
.feature:hover { border-color: var(--border2); background: rgba(255,255,255,0.03); }

.feature-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(93,95,239,0.08); border: 1px solid rgba(93,95,239,0.15);
  display: flex; align-items: center; justify-content: center; color: var(--accent2); flex-shrink: 0;
}
.feature h4 { font-size: 1rem; font-weight: 600; color: #fff; margin-bottom: 6px; }
.feature p { font-size: 0.88rem; color: var(--muted); line-height: 1.6; }

/* ===== STEPS ===== */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.step {
  padding: 44px 40px; background: rgba(255,255,255,0.01);
  border: 1px solid var(--border); border-radius: var(--radius-lg); transition: all 0.3s;
}
.step:hover { border-color: rgba(93,95,239,0.2); background: rgba(93,95,239,0.02); }
.step-num {
  font-family: 'DM Mono', monospace; font-size: 0.8rem; font-weight: 600;
  color: var(--accent2); letter-spacing: 0.1em; margin-bottom: 24px;
}
.step h3 { font-size: 1.2rem; font-weight: 700; color: #fff; margin-bottom: 12px; }
.step p { font-size: 0.92rem; color: var(--muted); line-height: 1.7; }

/* ===== CONTACT ===== */
.contact-wrap { display: grid; grid-template-columns: 1fr 1.3fr; gap: 88px; align-items: start; }
.contact-left p { margin: 20px 0 32px; font-size: 1.05rem; }
.contact-email {
  font-family: 'DM Mono', monospace; font-size: 0.95rem; color: var(--accent2);
  border-bottom: 1px solid rgba(93,95,239,0.2); padding-bottom: 4px; transition: all 0.2s;
}
.contact-email:hover { border-color: var(--accent2); color: #fff; }

.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 10px; }
.form-group label {
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em; font-family: 'DM Mono', monospace;
}
.contact-form input, .contact-form textarea {
  background: rgba(5,5,10,0.5); border: 1px solid var(--border2);
  border-radius: 10px; padding: 14px 18px; color: var(--text);
  font-family: 'Space Grotesk', sans-serif; font-size: 0.92rem; transition: all 0.2s; outline: none;
}
.contact-form input:focus, .contact-form textarea:focus {
  border-color: var(--accent); background: rgba(93,95,239,0.04);
  box-shadow: 0 0 0 4px rgba(93,95,239,0.15);
}
.checkbox-label { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; color: var(--muted); cursor: pointer; }
.checkbox-label input { width: auto; accent-color: var(--accent); }

/* ===== FOOTER ===== */
.footer { background: #030306; border-top: 1px solid var(--border); padding-top: 72px; position: relative; z-index: 3; }
.footer-inner { display: flex; justify-content: space-between; gap: 48px; padding-bottom: 64px; flex-wrap: wrap; }
.footer-brand p { font-size: 0.88rem; color: var(--muted2); margin-top: 16px; max-width: 240px; }
.footer-links { display: flex; gap: 80px; flex-wrap: wrap; }
.footer-col h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15em; color: var(--muted2); margin-bottom: 20px; font-family: 'DM Mono', monospace; font-weight: 600; }
.footer-col a { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 14px; transition: color 0.2s; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid var(--border); padding: 24px; text-align: center; }
.footer-bottom p { font-size: 0.8rem; color: var(--muted2); font-family: 'DM Mono', monospace; }

/* ===== SCROLL REVEAL ===== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  .about-grid, .contact-wrap { grid-template-columns: 1fr; gap: 56px; }
  .steps { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 768px) {
  .nav { padding: 18px 24px; }
  .nav.scrolled { padding: 14px 24px; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero-stats-bar { flex-wrap: wrap; gap: 24px; padding: 24px; }
  .hero-stat-divider { display: none; }
  .game-card { flex-wrap: wrap; gap: 20px; padding: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 40px; }
  .footer-links { gap: 48px; }
}