/* ==========================================================================
   MATEMATICA NELLA DIVINA COMMEDIA - COMPONENTI INTERATTIVI
   Stili specifici per simulatori, scacchiere, dadi, logica e quiz
   ========================================================================== */

/* --- 1. Teorema di Talete & Semicerchio --- */
.thales-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 600;
}

/* --- Scatola Display Matematico (Elegante & Rigoroso, No Monospace) --- */
.math-display-card {
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  margin: 0.75rem 0;
  text-align: center;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
  overflow-x: auto;
}
.math-display-card .katex-display {
  margin: 0.25rem 0 !important;
}

/* --- 2. Quadratura del Cerchio & Archimede --- */
.archimede-steps {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.step-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  transition: var(--transition-smooth);
}

.step-btn.active, .step-btn:hover {
  background: var(--gold-primary);
  color: #000;
  font-weight: 700;
  border-color: var(--gold-light);
}

.pi-comparison-box {
  background: rgba(14, 19, 32, 0.7);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.pi-digits-match {
  color: #34d399;
  font-weight: bold;
}

.pi-digits-diff {
  color: var(--text-muted);
}

/* --- 3. Tribunale del Diavolo Logico --- */
.logic-court-panel {
  background: radial-gradient(circle at 50% 0%, rgba(244, 63, 94, 0.1), transparent 70%),
              rgba(11, 15, 25, 0.95);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.15);
}

.devil-avatar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(244, 63, 94, 0.2);
}

.devil-avatar-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.6));
}

.devil-speech {
  font-style: italic;
  font-size: 0.95rem;
  color: #fecdd3;
  line-height: 1.5;
}

.truth-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.truth-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.truth-table th {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(244, 63, 94, 0.3);
  font-weight: 600;
}

.truth-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.truth-table tr.highlight-row {
  background: rgba(244, 63, 94, 0.25);
  color: #fff;
  font-weight: bold;
}

.val-true {
  color: #34d399;
  font-weight: bold;
}

.val-false {
  color: #f43f5e;
  font-weight: bold;
}

.syllogism-card {
  background: rgba(7, 9, 14, 0.7);
  border-left: 3px solid #f43f5e;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* --- 4. Ipersfera Dantesca 3D --- */
.cosmos-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  font-size: 0.8rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-earth { background: #38bdf8; box-shadow: 0 0 6px #38bdf8; }
.dot-god { background: #fef08a; box-shadow: 0 0 8px #fef08a; }
.dot-heavens { background: #818cf8; }
.dot-angels { background: #f472b6; }

/* --- 5. Scacchiera Esponenziale & Inmillarsi --- */
.chessboard-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.chessboard-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  border: 2px solid var(--gold-dark);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

.chess-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
  position: relative;
}

.chess-cell.light {
  background: #252e42;
  color: #94a3b8;
}

.chess-cell.dark {
  background: #131926;
  color: #64748b;
}

.chess-cell.active-cell {
  background: var(--gold-primary) !important;
  color: #000 !important;
  font-weight: 800;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  transform: scale(1.06);
  z-index: 5;
}

.chess-cell.passed-cell {
  background: rgba(212, 175, 55, 0.25);
  color: var(--gold-light);
}

.chess-stats-board {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.grain-visualizer-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.grain-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, var(--gold-light), #f43f5e);
  width: 0%;
  transition: width 0.2s ease;
}

/* --- 6. Ottica Geometrica & Specchi di Beatrice --- */
.optics-canvas-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--celestial-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  pointer-events: none;
}

.candle-glow-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

/* --- 7. Il Gioco della Zara --- */
.zara-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.dice-container {
  display: flex;
  gap: 1.5rem;
  perspective: 600px;
}

.die {
  width: 64px;
  height: 64px;
  background: linear-gradient(145deg, #ffffff, #e2e8f0);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.die.rolling {
  animation: rollDie 0.5s ease infinite alternate;
}

@keyframes rollDie {
  0% { transform: rotate(0deg) scale(0.9); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.95); }
}

.zara-result-banner {
  background: rgba(14, 19, 32, 0.85);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.zara-sum-badge {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
}

.zara-prob-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.zara-chart-container {
  width: 100%;
  height: 180px;
  position: relative;
}

/* --- 8. Architettura Numerica & Divina Proporzione --- */
.matrix-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 650px) {
  .matrix-overview {
    grid-template-columns: 1fr;
  }
}

.cantica-card {
  background: rgba(14, 19, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition-smooth);
}

.cantica-card:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.cantica-card.inferno { border-top: 3px solid var(--inferno-crimson); }
.cantica-card.purgatorio { border-top: 3px solid var(--emerald-purgatory); }
.cantica-card.paradiso { border-top: 3px solid var(--celestial-blue); }

.cantica-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.cantica-metric {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-light);
}

.cantica-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.terzina-chain-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: rgba(7, 9, 14, 0.5);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.chain-link {
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.chain-link.rima-a { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.4); }
.chain-link.rima-b { background: rgba(212, 175, 55, 0.2); color: #fbe083; border: 1px solid rgba(212, 175, 55, 0.4); }
.chain-link.rima-c { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.chain-link.rima-d { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }

/* --- 9. Quiz & Sfide STEM-Umanesimo --- */
.quiz-wrapper {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2.2rem;
  max-width: 900px;
  margin: 0 auto;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-primary), var(--celestial-blue));
  width: 10%;
  transition: width 0.3s ease;
}

.question-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.question-quote {
  font-family: var(--font-poetic);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-terzina);
  background: rgba(7, 9, 14, 0.6);
  border-left: 3px solid var(--gold-primary);
  padding: 0.8rem 1.2rem;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition-smooth);
}

.option-btn:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--gold-primary);
  color: var(--text-primary);
}

.option-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}

.option-btn.wrong {
  background: rgba(244, 63, 94, 0.2) !important;
  border-color: #f43f5e !important;
  color: #fda4af !important;
}

.option-letter {
  font-family: var(--font-mono);
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-feedback {
  background: rgba(14, 19, 32, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  margin-top: 1rem;
  display: none;
  animation: fadeIn 0.3s ease;
}

.certificate-card {
  text-align: center;
  padding: 2.5rem;
  border: 2px solid var(--gold-primary);
  border-radius: var(--radius-md);
  background: radial-gradient(circle at 50% 30%, rgba(212, 175, 55, 0.15), transparent 70%),
              rgba(11, 15, 25, 0.95);
  box-shadow: 0 0 35px var(--gold-glow);
}

.certificate-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--gold-light);
  margin-bottom: 0.5rem;
  letter-spacing: 2px;
}

.certificate-seal {
  width: 80px;
  height: 80px;
  margin: 1.5rem auto;
  border-radius: 50%;
  border: 3px double var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--gold-light);
  box-shadow: 0 0 20px var(--gold-glow);
}

/* --- Finestra Modale Video & Info Laboratorio --- */
dialog.app-modal {
  margin: auto;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-md);
  background: rgba(14, 19, 32, 0.96);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  width: min(92vw, 840px);
  max-height: 90vh;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px var(--gold-glow);
  padding: 0;
  overflow: hidden;
}

dialog.app-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 15, 25, 0.8);
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  color: var(--inferno-crimson);
  transform: scale(1.15);
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  max-height: calc(85vh - 75px);
  line-height: 1.7;
}

.video-embed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --- 10. Modulo Intro: Metrica, Formula del Canto & Simmetrie --- */
.syllable-display-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0;
  justify-content: center;
}

.syllable-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 0.6rem 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
  position: relative;
}

.syllable-pos {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.syllable-char {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

.syllable-box.accented {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(245, 158, 11, 0.2));
  border-color: var(--gold-primary);
  box-shadow: 0 0 14px var(--gold-glow);
  transform: translateY(-2px);
}

.syllable-box.accented .syllable-char {
  color: var(--gold-light);
  font-weight: 700;
}

.syllable-beat {
  font-size: 0.6rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.5px;
  margin-top: 0.3rem;
  text-transform: uppercase;
}

.syllable-box.elision {
  border-style: dashed;
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.syllable-sinalefe {
  font-size: 0.55rem;
  color: #38bdf8;
  font-weight: 700;
  margin-top: 0.3rem;
  letter-spacing: 0.5px;
}

.canto-formula-card {
  background: radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 70%),
              rgba(11, 15, 25, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
}

.symmetry-tabs-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.symmetry-nav-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.symmetry-nav-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border-color: var(--gold-primary);
}

.symmetry-nav-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(56, 189, 248, 0.2));
  border-color: var(--gold-primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 12px var(--gold-glow);
}

.symmetry-content-card {
  display: none;
  background: rgba(14, 19, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  line-height: 1.7;
  animation: fadeIn 0.3s ease;
}

.symmetry-content-card.active {
  display: block;
}

.intro-metric-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.intro-pill-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  text-align: center;
  transition: var(--transition-smooth);
}

.intro-pill-item:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.05);
}

.intro-pill-val {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold-light);
}

.intro-pill-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 0.25rem;
}

/* ==========================================================================
   MODALITÀ DIMOSTRATIVA (ATTRACT / DEMO MODE) STILI
   ========================================================================== */

/* 1. Cursore Virtuale */
.demo-virtual-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
  will-change: transform;
}

.demo-virtual-cursor.active {
  opacity: 1;
}

.demo-cursor-svg {
  display: block;
  transform-origin: 2px 2px;
  transition: transform 0.15s ease;
}

.demo-virtual-cursor.clicking .demo-cursor-svg {
  transform: scale(0.85);
}

.demo-virtual-cursor.dragging .demo-cursor-svg {
  transform: rotate(-12deg) scale(0.92);
}

/* Anello d'impatto / Ripple sul click */
.demo-cursor-ring {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gold-light);
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0;
  pointer-events: none;
}

.demo-virtual-cursor.clicking .demo-cursor-ring {
  animation: demoCursorPulse 0.45s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

@keyframes demoCursorPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 1;
    border-color: #fbe083;
  }
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
    border-color: #38bdf8;
  }
}

/* Targhetta del cursore virtuale */
.demo-cursor-tag {
  position: absolute;
  left: 24px;
  top: 14px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.95), rgba(180, 83, 9, 0.95));
  color: #07090e;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 10px rgba(212, 175, 55, 0.4);
  white-space: nowrap;
  pointer-events: none;
  animation: tagGlow 2s infinite alternate ease-in-out;
}

@keyframes tagGlow {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.05); filter: brightness(1.2); }
}

/* 2. Banner Notifica Demo Lampeggiante in cima allo schermo ("Demo Mode Attivo") */
.demo-active-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translate(-50%, -140%);
  z-index: 999990;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1.5px solid rgba(244, 63, 94, 0.8);
  padding: 0.5rem 1.35rem;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(244, 63, 94, 0.4);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  opacity: 0;
  pointer-events: auto;
}

.demo-active-banner.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  animation: demoBannerGlow 1.8s infinite ease-in-out;
}

@keyframes demoBannerGlow {
  0%, 100% {
    border-color: rgba(244, 63, 94, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 25px rgba(244, 63, 94, 0.6);
  }
  50% {
    border-color: rgba(212, 175, 55, 0.85);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 22px rgba(212, 175, 55, 0.5);
  }
}

.demo-banner-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Luce lampeggiante "REC / LIVE" */
.demo-live-dot {
  width: 10px;
  height: 10px;
  background: #f43f5e;
  border-radius: 50%;
  box-shadow: 0 0 10px #f43f5e;
  animation: demoLiveDotBlink 0.9s infinite alternate ease-in-out;
}

@keyframes demoLiveDotBlink {
  0% { transform: scale(0.75); opacity: 0.25; }
  100% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 16px #f43f5e; }
}

.demo-banner-title {
  color: #ffffff;
  font-weight: 800;
  font-family: var(--font-serif);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.88rem;
  animation: demoTextBlink 1.2s infinite alternate ease-in-out;
}

@keyframes demoTextBlink {
  0% { opacity: 0.75; text-shadow: 0 0 6px rgba(244, 63, 94, 0.4); }
  100% { opacity: 1; text-shadow: 0 0 14px rgba(244, 63, 94, 0.95), 0 0 22px rgba(212, 175, 55, 0.7); }
}

.demo-banner-sub {
  color: var(--text-muted);
  font-size: 0.78rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding-left: 0.5rem;
}

.demo-banner-stop {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: var(--transition-smooth);
}

.demo-banner-stop:hover {
  background: #f43f5e;
  color: #fff;
}

/* Sfondo e Spotlight Cinematografico */
.demo-cinematic-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(7, 9, 14, 0.3) 0%, rgba(7, 9, 14, 0.78) 100%);
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-cinematic-backdrop.active {
  opacity: 1;
}

/* Effetto Zoom Cinematografico sul punto focale (card laboratorio) - Rallentato al 50% di velocità */
.demo-focus-target {
  transition: transform 1.8s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 1.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 1.4s ease,
              opacity 1s ease !important;
  transform: scale(1.045) !important;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.9), 0 0 50px rgba(212, 175, 55, 0.45) !important;
  position: relative !important;
  z-index: 40 !important;
}

/* Dissolvenza in ingresso ed uscita tra sezioni - Rallentata e morbida */
.demo-crossfade-out {
  opacity: 0 !important;
  transform: scale(0.97) !important;
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.demo-crossfade-in {
  animation: demoCrossfadeZoom 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes demoCrossfadeZoom {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* 3. Card Spotlight "Succo della Dimostrazione" */
.demo-takeaway-overlay {
  position: fixed;
  inset: 0;
  z-index: 999980;
  background: rgba(7, 9, 14, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-takeaway-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.demo-takeaway-card {
  position: relative;
  max-width: 640px;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.18), transparent 75%),
              rgba(14, 19, 32, 0.95);
  border: 1.5px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem 1.75rem 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 35px rgba(212, 175, 55, 0.35);
  text-align: center;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.demo-takeaway-overlay.visible .demo-takeaway-card {
  transform: translateY(0) scale(1);
}

.demo-takeaway-badge {
  display: inline-block;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-light);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 0.3rem 0.9rem;
  border-radius: 9999px;
  margin-bottom: 0.85rem;
}

.demo-takeaway-title {
  color: var(--text-primary);
  font-family: var(--font-serif);
  font-size: 1.55rem;
  margin-bottom: 0.75rem;
}

.demo-takeaway-verse {
  font-family: var(--font-poetic);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-terzina);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold-primary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.demo-takeaway-body {
  font-size: 0.98rem;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: left;
  margin-bottom: 1.5rem;
}

.demo-takeaway-body strong {
  color: var(--gold-light);
}

.demo-takeaway-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 1rem;
}

.demo-takeaway-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-primary), var(--celestial-blue));
  border-radius: 2px;
}



