/* ==================== GAMMALAB - TEMA SCURO ASTRONOMICO ==================== */

/* Reset e Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colori tema astronomico */
  --bg-space: #0a0e1a;
  --bg-card: #111827;
  --bg-elevated: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --border-color: rgba(148, 163, 184, 0.2);
  --shadow: rgba(0, 0, 0, 0.5);
  
  /* Palette energetica per simulazioni */
  --energy-low: #0066ff;
  --energy-medium: #00ffff;
  --energy-high: #00ff00;
  --energy-very-high: #ffff00;
  --energy-intense: #ff8800;
  --energy-extreme: #ff0000;
  --energy-saturated: #ffffff;

  /* Breakpoints mobili-first */
  --mobile: 480px;
  --tablet: 768px;
  --desktop: 1024px;
  --wide: 1200px;
  --ultra-wide: 1600px;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-space);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

/* Animazione stelle di sfondo */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 33% 80%, white, transparent),
    radial-gradient(1px 1px at 15% 90%, white, transparent);
  background-size: 200% 200%;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  animation: twinkle 8s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

/* Container principale */
.container {
  width: 100%;
  max-width: var(--ultra-wide);
  margin: 0 auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 8px;
  }
}

/* ==================== IMMAGINI RESPONSIVE ==================== */

/* Immagini responsive universali */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Immagini nei contenuti */
.image-content img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

/* Hero images */
.hero-image {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  .hero-image {
    max-height: 250px;
  }
}

/* ==================== LAYOUT CONTENT ==================== */

/* Layout con immagini responsive */
.content-with-image {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
  align-items: start;
}

/* Variante con immagine più larga */
.content-with-image--wide {
  grid-template-columns: 1fr 1.5fr;
}

/* Variante con immagine più stretta */
.content-with-image--narrow {
  grid-template-columns: 1.5fr 1fr;
}

.content-with-image.reverse {
  grid-template-columns: 1fr 1fr;
}

.content-with-image--wide.reverse {
  grid-template-columns: 1.5fr 1fr;
}

.content-with-image--narrow.reverse {
  grid-template-columns: 1fr 1.5fr;
}

.content-with-image.reverse .text-content {
  order: 2;
}

.content-with-image.reverse .image-content {
  order: 1;
}

.image-content {
  position: sticky;
  top: 20px;
}

@media (max-width: 768px) {
  .content-with-image,
  .content-with-image.reverse {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .content-with-image.reverse .text-content,
  .content-with-image.reverse .image-content {
    order: initial;
  }
  
  .image-content {
    position: static;
  }
}

/* ==================== HEADER E NAVIGAZIONE ==================== */

header {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 16px 0;
  box-shadow: 0 4px 20px var(--shadow);
  position: relative;
  z-index: 10;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-title {
  font-size: 2.5em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.site-subtitle {
  color: var(--text-secondary);
  font-size: 1em;
  margin-bottom: 16px;
}

/* Menu navigazione */
nav {
  margin-top: 16px;
  position: relative; /* Necessario per il menu a tendina mobile */
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-toggle:hover {
  background: var(--bg-elevated);
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.nav-menu li a {
  display: block;
  padding: 8px 16px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.9rem;
}

.nav-menu li a:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-menu li a.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

/* ==================== CARDS E SECTIONS ==================== */

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--accent-blue);
  padding: 48px;
  margin-bottom: 32px;
}

.container .hero-section {
  padding: 48px;
}

.hero-title {
  font-size: 2.5rem;
  line-height: 1.3;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.card {
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px var(--shadow);
  position: relative;
  z-index: 1;
}

.card h2 {
  color: var(--accent-cyan);
  margin-bottom: 16px;
  font-size: 1.8em;
}

.card h3 {
  color: var(--accent-blue);
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1.4em;
}

.card p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.card ul {
  color: var(--text-secondary);
  margin-left: 24px;
  margin-bottom: 12px;
}

/* ==================== SIMULATORE LAYOUT ==================== */

.simulator-section {
  margin-top: 32px;
}

.cameras-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 colonne per layout orizzontale */
  gap: 16px;
  margin-bottom: 24px;
  max-width: 1400px; /* Larghezza ottimale per 3 colonne */
  margin-left: auto;
  margin-right: auto;
}

.camera-container {
  position: relative;
  min-width: 0; /* Previene overflow */
}

.camera-label {
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 1.1em;
  text-align: center;
}

.camera-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3/2;
  background: #000;
  border: 3px solid var(--border-color);
  border-radius: 8px;
  cursor: crosshair;
  display: block;
  transition: box-shadow 0.3s ease;
}

.camera-canvas.flash {
  animation: flash 0.4s ease-out;
}

@keyframes flash {
  0% { 
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
    border-color: var(--border-color);
  }
  50% { 
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.9), inset 0 0 20px rgba(59, 130, 246, 0.3);
    border-color: var(--accent-cyan);
  }
  100% { 
    box-shadow: 0 0 0 rgba(59, 130, 246, 0);
    border-color: var(--border-color);
  }
}

.viewer-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  background: #000;
  border: 2px solid var(--border-color);
  border-radius: 8px;
}

.overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent !important; /* CRITICO: overlay deve essere trasparente */
}

/* Ricostruzione stereoscopica */
.stereo-container {
  margin-top: 24px;
  text-align: center;
}

.stereo-canvas {
  max-width: 960px;
  width: 100%;
  height: auto;
  background: #000;
  border: 2px solid var(--accent-purple);
  border-radius: 8px;
  margin: 0 auto;
  display: block;
}

/* ==================== PANNELLO PARAMETRI HILLAS ==================== */

.hillas-panel {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(59, 130, 246, 0.4);
  border-radius: 8px;
  padding: 24px;
  margin-top: 24px;
}

.hillas-panel h3 {
  color: var(--accent-cyan);
  margin-bottom: 16px;
}

.hillas-parameters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.param-item {
  background: var(--bg-card);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.param-label {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.param-value {
  color: var(--accent-cyan);
  font-size: 1.4em;
  font-weight: 600;
}

.param-unit {
  color: var(--text-secondary);
  font-size: 0.85em;
  margin-left: 4px;
}

/* Tooltip */
.tooltip-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: var(--accent-blue);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  cursor: help;
  position: relative;
}

.tooltip-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 1000;
  font-size: 13px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px var(--shadow);
}

/* ==================== BUTTONS ==================== */

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--accent-blue);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-danger {
  background: #ef4444;
  color: white;
}

/* Focus states accessibili */
.btn:focus,
.btn:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.nav-menu li a:focus,
.nav-menu li a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

.camera-canvas:focus,
.camera-canvas:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* ==================== TABELLE ==================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

table th {
  background: var(--bg-elevated);
  color: var(--accent-cyan);
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-color);
}

table td {
  padding: 12px;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

table tr:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* ==================== QUIZ SPECIFICO ==================== */

.quiz-container {
  max-width: 1600px;
  margin: 0 auto;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: 8px;
}

.timer {
  font-size: 2em;
  color: var(--accent-cyan);
  font-weight: 700;
}

.timer.warning {
  color: var(--energy-intense);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.score {
  font-size: 1.5em;
  color: var(--accent-purple);
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.quiz-option {
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-weight: 600;
  color: #ffffff !important; /* Force white text for mobile */
  -webkit-text-fill-color: #ffffff !important;
}

.quiz-option:hover {
  border-color: var(--accent-blue);
  transform: scale(1.05);
}

.quiz-option.selected {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.quiz-option.correct {
  background: #10b981;
  border-color: #10b981;
}

.quiz-option.incorrect {
  background: #ef4444;
  border-color: #ef4444;
}

.feedback-panel {
  background: var(--bg-elevated);
  border: 2px solid var(--accent-purple);
  border-radius: 8px;
  padding: 20px;
  margin-top: 24px;
}

.hint-panel {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--accent-purple);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

/* ==================== TABS SYSTEM ==================== */

.tab-navigation {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.tab-link {
  padding: 12px 24px;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  font-weight: 500;
  cursor: pointer;
}

.tab-link:hover {
  color: var(--accent-cyan);
  background: rgba(59, 130, 246, 0.05);
}

.tab-link.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

.tab-content-container {
  min-height: 400px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== ACCORDION SYSTEM ==================== */

.accordion-card {
  margin-bottom: 16px;
}

.accordion-card summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.accordion-card summary::-webkit-details-marker {
  display: none;
}

.accordion-card summary:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.accordion-card summary h2 {
  color: var(--accent-cyan);
  margin: 0;
  display: inline;
}

.accordion-card summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 12px;
  transition: transform 0.3s ease;
  color: var(--accent-blue);
}

.accordion-card[open] summary::before {
  transform: rotate(90deg);
}

.accordion-content {
  padding: 20px 16px;
  animation: fadeIn 0.3s ease;
}

/* ==================== IMAGE HOTSPOTS ==================== */

.snr-hotspot {
  position: absolute;
  z-index: 10;
}

.hotspot-marker {
  width: 32px;
  height: 32px;
  background: rgba(59, 130, 246, 0.8);
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.hotspot-marker:hover {
  background: rgba(59, 130, 246, 1);
  transform: scale(1.2);
  animation: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
  50% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
}

.hotspot-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--bg-elevated);
  border: 2px solid var(--accent-blue);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 100;
}

.hotspot-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--accent-blue);
}

.snr-hotspot:hover .hotspot-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

.hotspot-tooltip strong {
  color: var(--accent-cyan);
  display: block;
  margin-bottom: 4px;
}

/* ==================== TELESCOPE GRID 2x2 ==================== */

.telescopes-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 16px;
}

.telescope-container {
  position: relative;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.telescope-label {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(0,0,0,0.7);
  color: var(--accent-cyan);
  font-weight: bold;
  font-size: 1.2rem;
  padding: 8px 16px;
  border-radius: 8px;
  border: 2px solid var(--accent-cyan);
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.telescope-container .camera-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #000;
  display: block;
}

/* Barra Scala Colori */
.color-scale-bar {
  max-width: 800px;
  margin: 24px auto;
  padding: 16px;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  border-radius: 8px;
}

.scale-label {
  text-align: center;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.scale-gradient {
  height: 30px;
  background: linear-gradient(to right, 
    rgb(20, 120, 200) 0%,      /* Cyan - 50 GeV */
    rgb(24, 80, 220) 25%,      /* Blue - 500 GeV */
    rgb(20, 160, 150) 50%,     /* Teal - 2 TeV */
    rgb(100, 220, 80) 75%,     /* Green - 8 TeV */
    rgb(255, 240, 80) 100%     /* Yellow - 30 TeV */
  );
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.scale-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==================== LIGHTBOX ==================== */

.gl-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.gl-lightbox.active {
  display: flex;
}

.gl-lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  cursor: zoom-out;
}

.gl-lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  z-index: 10001;
  animation: lightboxZoomIn 0.3s ease;
}

@keyframes lightboxZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gl-lightbox-image {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.gl-lightbox-caption {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0,0,0,0.8);
  color: var(--text-primary);
  text-align: center;
  border-radius: 4px;
  font-size: 0.9rem;
}

.gl-lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.gl-lightbox-close:hover {
  background: rgba(255,255,255,0.2);
  transform: rotate(90deg);
}

.gl-lightbox-prev,
.gl-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 48px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.gl-lightbox-prev {
  left: -80px;
}

.gl-lightbox-next {
  right: -80px;
}

.gl-lightbox-prev:hover,
.gl-lightbox-next:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-50%) scale(1.1);
}

/* ==================== VIDEO CONTAINER ==================== */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  background: #000;
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid var(--border-color);
}

.video-container iframe,
.video-container object,
.video-container embed,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1024px) {
  .cameras-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .telescopes-grid-2x2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .hillas-parameters {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Tipografia responsive - Tablet */
  .site-title {
    font-size: 2.2em;
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .card h2 {
    font-size: 1.6em;
  }
  
  .card h3 {
    font-size: 1.3em;
  }
}

@media (max-width: 767px) {
  .cameras-grid {
    grid-template-columns: 1fr;
  }
  
  .telescopes-grid-2x2 {
    grid-template-columns: 1fr;
  }
  
  .nav-menu {
    flex-direction: column;
  }
  
  .site-title {
    font-size: 2em;
  }
  
  .hillas-parameters {
    grid-template-columns: 1fr;
  }

  /* Hero images responsive */
  .hero-images {
    flex-direction: column;
  }
  
  .hero-images img {
    width: 100%;
  }

  /* Menu mobile */
  .nav-toggle {
    display: block;
  }
  
  .nav-menu {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    z-index: 1000;
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-menu li {
    width: 100%;
  }
  
  .nav-menu li a {
    display: block;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 4px;
  }
  
  /* Tipografia responsive - Mobile */
  .hero-title {
    font-size: 1.8rem;
  }
  
  .hero-text {
    font-size: 1rem;
  }
  
  .card h2 {
    font-size: 1.4em;
  }
  
  .card h3 {
    font-size: 1.2em;
  }
  
  .card p {
    font-size: 0.95rem;
  }
  
  /* Pulsanti responsive */
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  /* Card responsive */
  .card {
    padding: 20px;
    margin-bottom: 20px;
  }
  
  .hero-section {
    padding: 32px 20px !important;
  }
}

@media (max-width: 480px) {
  /* Tipografia responsive - Small mobile */
  .site-title {
    font-size: 1.8em;
  }
  
  .hero-title {
    font-size: 1.6rem;
  }
  
  .hero-text {
    font-size: 0.95rem;
  }
  
  .card h2 {
    font-size: 1.3em;
  }
  
  .card h3 {
    font-size: 1.1em;
  }
  
  .card p {
    font-size: 0.9rem;
  }
  
  /* Pulsanti responsive - Small */
  .btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
  
  /* Card responsive - Small */
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .hero-section {
    padding: 24px 16px !important;
  }
  
  /* Tabelle responsive */
  table {
    font-size: 0.85rem;
  }
  
  table th,
  table td {
    padding: 8px;
  }
}

/* ==================== TABELLE RESPONSIVE ==================== */

@media (max-width: 768px) {
  /* Wrapper per tabelle responsive */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
  }
  
  .table-responsive table {
    min-width: 600px; /* Larghezza minima per evitare compressione eccessiva */
  }
}

/* ==================== UTILITY CLASSES ==================== */

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden {
  display: none;
}

/* ==================== QUIZ LAYOUT ENHANCEMENT ==================== */

/* Aumenta larghezza container per il quiz */
#quizScreen .container {
  max-width: 1800px;
  padding: 30px;
}

/* Camere affiancate orizzontalmente come nei simulatori */
#quizScreen .cameras-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

#quizScreen .camera-container {
  position: relative;
  width: 280px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
}

/* Wrapper per sovrapporre i canvas con grid */
#quizScreen .canvas-wrapper {
  display: grid;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}

#quizScreen .canvas-wrapper > * {
  grid-area: 1 / 1; /* Tutti gli elementi nella stessa cella della griglia */
}

/* Canvas più grandi e leggibili con stile esagonale */
#quizScreen .camera-canvas {
  display: block;
  width: 100%;
  height: 100%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  /* RIMOSSO clip-path: il clipping esagonale è gestito dal JavaScript */
  border-radius: 8px;
}

#quizScreen .overlay-canvas {
  display: block;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  /* RIMOSSO clip-path: il clipping esagonale è gestito dal JavaScript */
  border-radius: 8px;
}

#quizScreen .camera-label {
  font-size: 1.2em;
  padding: 8px;
  background: rgba(14, 165, 233, 0.1);
  border-radius: 6px;
  margin-bottom: 16px;
}

/* ==================== STEREO RECONSTRUCTION PANEL ==================== */

.stereo-panel {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  margin: 32px auto;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px var(--shadow);
  max-width: 1200px;
}

.stereo-panel h3 {
  color: var(--accent-cyan);
  font-size: 1.6em;
  margin-bottom: 16px;
  text-align: center;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

#stereo-canvas {
  display: block;
  margin: 0 auto;
  background: #020617;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6),
              inset 0 1px 3px rgba(59, 130, 246, 0.1);
}

/* Info badge per stereo */
.stereo-info {
  margin-top: 16px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  border-left: 4px solid var(--accent-blue);
  font-size: 0.95em;
  color: var(--text-secondary);
}

.stereo-info strong {
  color: var(--accent-cyan);
}

/* ==================== ANIMAZIONI E MICRO-INTERAZIONI ==================== */

/* Transizioni fluide per tutti gli elementi interattivi */
* {
  transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

/* Animazioni di entrata per le sezioni */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Applicazione animazioni di entrata */
.card {
  animation: slideInUp 0.6s ease-out;
}

.card:nth-child(odd) {
  animation-delay: 0.1s;
}

.card:nth-child(even) {
  animation-delay: 0.2s;
}

.hero-section {
  animation: fadeInScale 0.8s ease-out;
}

/* Micro-interazioni per le card */
.card {
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left 0.5s ease;
}

.card:hover::before {
  left: 100%;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Effetti hover avanzati per i bottoni */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Effetto glow per bottoni primari */
.btn-primary {
  box-shadow: 0 0 0 rgba(59, 130, 246, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
  }
  to {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.4);
  }
}

/* Animazioni per i link di navigazione */
.nav-menu li a {
  position: relative;
}

.nav-menu li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-cyan);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-menu li a:hover::after {
  width: 80%;
}

.nav-menu li a.active::after {
  width: 80%;
}

/* Effetti per le tabelle */
table tr {
  transition: all 0.3s ease;
}

table tr:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* Animazioni per i canvas dei simulatori */
.camera-canvas, .viewer-canvas, .stereo-canvas {
  transition: all 0.3s ease;
}

.camera-canvas:hover, .viewer-canvas:hover, .stereo-canvas:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

/* Loading animation per i canvas */
.canvas-loading {
  position: relative;
  overflow: hidden;
}

.canvas-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid rgba(59, 130, 246, 0.3);
  border-top: 4px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animazioni per i parametri Hillas */
.param-item {
  transition: all 0.3s ease;
}

.param-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.param-value {
  transition: color 0.3s ease;
}

.param-item:hover .param-value {
  color: var(--accent-purple);
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Effetti per il quiz */
.quiz-option {
  position: relative;
  overflow: hidden;
}

.quiz-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.quiz-option:hover::before {
  left: 100%;
}

.quiz-option.selected {
  animation: bounceIn 0.3s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* Animazioni per i tooltip */
.tooltip-icon:hover::after {
  animation: tooltipFadeIn 0.3s ease;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(-5px);
  }
}

/* Effetti per gli hotspot */
.hotspot-marker {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
}

.hotspot-marker:hover {
  animation: none;
}

/* Transizioni per i tab */
.tab-content {
  animation: slideInUp 0.4s ease;
}

/* Effetti per l'accordion */
.accordion-content {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

/* Animazioni per la lightbox */
.gl-lightbox-content {
  animation: zoomInBounce 0.4s ease;
}

@keyframes zoomInBounce {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Effetto shimmer per elementi di caricamento */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-shimmer {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* Effetto typing per testi importanti */
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

.typing-effect {
  overflow: hidden;
  border-right: 2px solid var(--accent-cyan);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-cyan); }
}

/* Micro-interazioni per i controlli del simulatore */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-cyan);
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

input[type="range"]::-webkit-slider-track {
  background: var(--border-color);
  height: 4px;
  border-radius: 2px;
}

/* Effetto focus per accessibilità */
*:focus {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

/* Animazioni di successo/errore */
.success-animation {
  animation: successPulse 0.6s ease;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.error-animation {
  animation: errorShake 0.5s ease;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Effetto parallax per sfondi */
.parallax-bg {
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Animazione di scorrimento per elementi lunghi */
.scroll-fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.scroll-fade-in.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Performance optimizations */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* Riduce movimento per utenti che preferiscono meno animazioni */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Effetto ripple per i bottoni */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ==================== CAMERE ANTEPRIMA ==================== */

.cameras-preview-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.camera-preview-container {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 320px;
}

.camera-preview-label {
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9em;
  text-align: center;
}

.camera-preview-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 3/2;
  background: #000;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: block;
  transition: all 0.3s ease;
}

.camera-preview-canvas:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Loading state per anteprime */
.camera-preview-loading {
  position: relative;
  overflow: hidden;
}

.camera-preview-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-top: 2px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
  .cameras-preview-grid {
    flex-direction: column;
    align-items: center;
  }

  .camera-preview-container {
    min-width: 250px;
    max-width: 300px;
  }
}

/* ==================== QUIZ RESPONSIVE ==================== */

@media (max-width: 600px) {
  .quiz-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .quiz-header > div {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 768px) {
  #quizScreen .container {
    padding: 15px;
  }
}

/* ==================== HOMEPAGE ACTION BUTTONS ==================== */

.action-buttons-container {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .action-buttons-container {
    flex-direction: column;
    align-items: stretch;
    padding: 0 20px;
  }
  
  .action-buttons-container .btn {
    display: block;
    width: 100%;
    margin-bottom: 12px;
    text-align: center;
  }
}

/* ==================== COMPACT QUIZ LAYOUT (NO SCROLL) ==================== */

/* Forza il container del quiz a occupare l'altezza disponibile */
.quiz-container {
  max-width: 100% !important;
  padding: 8px !important;
  height: calc(100vh - 70px); /* Sottrae header sito */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Previene scroll sulla pagina principale */
}

/* Layout Grid per il Quiz Screen */
#quizScreen {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Desktop: 50% Camera, 50% Domande */
  grid-template-rows: auto 1fr; /* Header auto, resto flessibile */
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

/* Header del Quiz (Score/Timer) */
.quiz-header {
  grid-column: 1 / -1;
  padding: 8px 16px;
  margin-bottom: 0;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

/* Sezione Simulatore (Sinistra su Desktop) */
#quizScreen .simulator-section {
  grid-column: 1;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* Scroll interno se necessario */
  padding: 12px;
}

/* Sezione Domande (Destra su Desktop) */
#quizScreen .card:last-child {
  grid-column: 2;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
}

/* Ottimizzazione Camera */
#quizScreen .camera-container {
  max-width: 100% !important;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

#quizScreen .camera-canvas {
  max-height: 45vh; /* Limita altezza camera su desktop */
  width: auto;
  aspect-ratio: 1/1;
}

/* Nascondi elementi meno utili in modalità compatta */
#quizInstruction, 
#quizInfoContent p {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* Griglia Opzioni Risposta */
.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 colonne */
  gap: 10px;
  margin-top: 10px;
}

.quiz-option {
  padding: 12px 8px;
  font-size: 0.95rem;
  white-space: normal;
  line-height: 1.2;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ==================== MOBILE QUIZ OPTIMIZATION ==================== */

@media (max-width: 900px) {
  .quiz-container {
    height: auto; /* Su mobile lasciamo scorrere se serve, ma proviamo a compattare */
    min-height: 100vh;
    overflow-y: auto;
  }

  #quizScreen {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 8px;
  }

  /* Riduci header */
  .quiz-header {
    padding: 6px 10px;
  }
  
  .quiz-header strong {
    font-size: 1.1em !important;
  }

  /* Camera molto più piccola su mobile */
  #quizScreen .camera-canvas {
    max-height: 30vh; 
    max-width: 100%;
  }
  
  /* Nascondi info box su mobile per risparmiare spazio */
  .quiz-info-box {
    display: none !important;
  }
  
  /* Nascondi titolo sezione Hillas */
  .hillas-panel h3 {
    display: none;
  }
  
  /* Parametri Hillas in riga singola */
  .hillas-parameters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    font-size: 0.8rem;
  }

  /* Card Domande */
  #quizScreen .card:last-child {
    padding: 12px;
    flex: 1;
  }

  #questionTitle {
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
  }

  .quiz-options {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .quiz-option {
    padding: 10px 4px;
    font-size: 0.85rem;
  }
  
  /* Hint buttons più piccoli */
  #hint1Btn, #hint2Btn, #hint3Btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    margin: 4px !important;
  }
}



/* ==================== QUIZ SPECIFIC STYLES (Moved from quiz.html) ==================== */

/* ============ CRITICAL FIX - HIDDEN CLASS MUST WORK ============ */
.hidden {
    display: none !important;
}

/* ============ EMERGENCY FIX - FORCE VISIBILITY ============ */
#startScreen:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
    background: #111827 !important;
    color: #e2e8f0 !important;
    padding: 30px !important;
    margin: 20px !important;
    border-radius: 12px !important;
}

#startScreen * {
    visibility: visible !important;
    opacity: 1 !important;
}

#startScreen h2, #startScreen h3 {
    color: #06b6d4 !important;
}

#startScreen p, #startScreen li {
    color: #e2e8f0 !important;
}

#startQuizBtn {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #22c55e !important;
    color: white !important;
    padding: 16px 32px !important;
    font-size: 1.2em !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    z-index: 1000 !important;
}

/* ============ END EMERGENCY FIX ============ */

/* Compact Quiz Layout */
html, body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh;
}

.container, .quiz-container, main {
    overflow: visible !important;
    height: auto !important;
}

#startScreen {
    max-height: none !important;
    overflow: visible !important;
}

/* ============ THEORETICAL QUESTION STYLING ============ */
/* Layout affiancato per domande teoriche */
#theoreticalQuestionContainer {
    margin-bottom: 20px;
}

.theoretical-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: stretch;
    flex-wrap: wrap;
}

/* Box domanda teorica (sinistra) */
.theoretical-question-box {
    flex: 1 1 400px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    border: 2px solid var(--accent-cyan);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.theoretical-question-box .theory-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.theoretical-question-box .theory-label {
    font-size: 0.9em;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.theoretical-question-box .theory-text {
    font-size: 1.3em;
    line-height: 1.5;
    color: #e2e8f0;
    margin: 0;
    font-weight: 500;
    text-align: center;
}

/* Box risposte teoriche (destra) */
.theoretical-answers-box {
    flex: 1 1 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.theoretical-answers-box h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--accent-cyan);
}

.theoretical-answers-box .quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.theoretical-answers-box .quiz-option {
    padding: 14px 18px;
    font-size: 1em;
    text-align: left;
}

/* Legacy support - hide old theoretical question div */
.theoretical-question {
    display: none;
}

.theoretical-question .theory-text {
    font-size: 1.4em;
    line-height: 1.5;
    color: #e2e8f0;
    margin: 0;
    font-weight: 500;
}

/* ============ COMPACT QUIZ LAYOUT ============ */
.quiz-main-layout {
    gap: 15px !important;
}

.camera-container {
    flex: 0 0 300px !important;
}

.canvas-wrapper {
    width: 300px !important;
    height: 300px !important;
}

.quiz-controls-card {
    flex: 1 1 300px !important;
    max-height: none !important;
}

.quiz-options {
    gap: 6px !important;
}

.quiz-option {
    padding: 10px 12px !important;
    font-size: 0.95em !important;
}

/* Layout principale del quiz - SOLO quando NON � hidden */
#quizScreen:not(.hidden) {
    display: flex;
    flex-direction: column;
    /* Remove fixed height to avoid clipping and overlap */
    min-height: 600px;
    padding-bottom: 40px;
}

.quiz-header {
    flex: 0 0 auto;
    margin-bottom: 10px;
}

/* Wrapper per mettere simulatore e controlli affiancati */
.quiz-main-layout {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

/* Sezione Simulatore (Sinistra) */
.simulator-section {
    flex: 1 1 500px; /* Grow, shrink, basis */
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    min-width: 300px;
}

.quiz-layout-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.camera-container {
    flex: 0 0 350px; /* Fixed width for camera container */
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
}

.canvas-wrapper {
    position: relative;
    width: 350px; /* Explicit width */
    height: 350px; /* Explicit height */
    margin: 0 auto;
    overflow: visible; /* Assicura che il contenuto sia visibile */
}

.camera-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    /* Background grigio chiaro per modalit� quiz (lightStyle) */
    background: #e0e0e0; 
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
    pointer-events: none;
    z-index: 10;
}

/* Sezione Controlli/Risposte (Destra) */
.quiz-controls-card {
    flex: 0 0 350px; /* Fixed width */
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    /* Sticky positioning for desktop */
    position: sticky;
    top: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.quiz-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.quiz-option {
    padding: 12px;
    font-size: 1em;
    text-align: left;
}

/* Info box dentro il simulatore */
.quiz-info-box {
    font-size: 0.95em;
    padding: 16px !important;
    flex: 1;
    min-width: 250px;
}

/* Adattamento per schermi piccoli */
@media (max-width: 1000px) {
    .quiz-main-layout {
        flex-direction: column;
    }

    .quiz-controls-card {
        flex: 1;
        width: 100%;
        position: static; /* Disable sticky on mobile */
        max-height: none;
    }

    .quiz-options {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .camera-container {
        flex: 1;
        width: 100%;
    }
    
    .canvas-wrapper {
        width: 100%;
        max-width: 350px;
        height: auto;
        aspect-ratio: 1/1;
    }
}

.quiz-container {
    padding-top: 10px;
    padding-bottom: 40px;
    max-width: 100% !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* Ensure feedback panel is visible */
.feedback-panel {
    margin-top: 20px;
    padding: 15px;
    background: rgba(20, 30, 50, 0.95);
    border-radius: 8px;
    border: 2px solid var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 100;
}

/* Make next button very prominent */
#nextQuestionBtn {
    width: 100%;
    padding: 16px;
    font-size: 1.2em;
    margin-top: 10px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#nextQuestionBtn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* === FIXES FOR USER REPORTED ISSUES === */

/* 1. Fix 'Black Band' covering title */
.quiz-container {
    margin-top: 40px; /* Push content down below header */
    position: relative;
    z-index: 5;
}

/* 2. Fix 'Hidden Next Button' */
.feedback-panel {
    z-index: 1000; /* Ensure it's on top */
    position: relative;
    background: rgba(20, 30, 50, 0.98); /* More opaque */
}

#nextQuestionBtn {
    display: block;
    visibility: visible;
    opacity: 1;
    z-index: 1001;
    position: relative;
}

/* 3. Fix 'Black Camera' visibility */
.camera-container {
    background: #000; /* Fallback background */
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    min-height: 350px; /* Ensure height */
}

.canvas-wrapper {
    background: #e0e0e0; /* Visible background if canvas fails */
    border-radius: 8px; /* Angoli arrotondati, NON circolare */
}

/* Ensure sticky controls don't get covered */
.quiz-controls-card {
    z-index: 90;
    background: var(--bg-card);
}


/* ==================== INFO PAGES SPECIFIC STYLES (Moved from crab-nebula.html etc) ==================== */

.highlight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.highlight-box h3 {
    margin-top: 0;
    color: white;
}

.process-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.process-card h3 {
    color: #1a1a1a;
    margin-top: 0;
}

.process-card p {
    color: #333;
    line-height: 1.6;
}

.instruments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}


/* ==================== CRAB NEBULA SPECIFIC ==================== */

.image-content {
    position: sticky;
    top: 20px;
}

.image-content img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.image-content figcaption {
    margin-top: 0.5rem;
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.highlight-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.highlight-box h3 {
    margin-top: 0;
    color: white;
}

.process-card {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.process-card h3 {
    color: #1a1a1a;
    margin-top: 0;
}

.process-card p {
    color: #333;
    line-height: 1.6;
}

.instruments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.instrument-tag {
    background: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.3);
}

/* Timeline Styles */
.timeline-container {
    position: relative;
    margin: 3rem 0;
    padding: 2rem 0;
}

.timeline-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.timeline-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.timeline-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.timeline-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6);
}

.timeline-line {
    position: relative;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    margin: 2rem 0;
    border-radius: 2px;
}

.timeline-progress {
    position: absolute;
    height: 100%;
    background: #ffd700;
    border-radius: 2px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.timeline-events {
    position: relative;
    min-height: 300px;
}

.timeline-event {
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    pointer-events: none;
}

.timeline-event.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.event-marker {
    position: absolute;
    top: -30px;
    width: 20px;
    height: 20px;
    background: white;
    border: 4px solid #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.event-marker:hover {
    transform: scale(1.3);
    border-color: #764ba2;
}

.event-marker.active {
    background: #ffd700;
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.event-content {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-left: 4px solid #667eea;
}

.event-date {
    color: #667eea;
    font-weight: bold;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.event-title {
    color: #1a1a1a;
    font-size: 1.5rem;
    margin: 0.5rem 0;
}

.event-description {
    color: #333;
    line-height: 1.6;
    margin-top: 1rem;
}

.event-image {
    margin-top: 1.5rem;
    text-align: center;
}

.event-image img {
    max-width: 60%;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}


/* ==================== INFO PAGES COMMON & VARIANTS ==================== */

.hero-section {
    position: relative;
    margin-bottom: 3rem;
}

.hero-images {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.hero-images img {
    width: 32%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.content-with-image {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
    align-items: start;
}

.content-with-image.reverse {
    grid-template-columns: 1fr 1.5fr;
}

.content-with-image.reverse .text-content {
    order: 2;
}

.content-with-image.reverse .image-content {
    order: 1;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #667eea; /* Default Purple */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: #1a1a1a; /* Dark text for white background */
}

.feature-card p, .feature-card ul, .feature-card li {
    color: #333;
}

.feature-card h3 {
    color: #1a1a1a;
    margin-top: 0;
}

/* Highlight Box Variants */
.highlight-box.cyan {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.highlight-box.orange {
    background: linear-gradient(135deg, #ff6644 0%, #ff8866 100%);
    box-shadow: 0 4px 15px rgba(255, 102, 68, 0.3);
}

/* Feature Card Variants */
.feature-card.cyan {
    border-left-color: #4facfe;
}

.feature-card.orange {
    border-left-color: #ff6644;
}


/* Magenta Variant (Galactic Center) */
.highlight-box.magenta {
    background: linear-gradient(135deg, #aa66ff 0%, #cc88ff 100%);
    box-shadow: 0 4px 15px rgba(170, 102, 255, 0.3);
}

.feature-card.magenta {
    border-left-color: #aa66ff;
}

/* Single Hero Image (GRB) */
.hero-image {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    background: #ffffff;
}


/* GRB Specific */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.animated-section {
    text-align: center;
    margin: 3rem 0;
}

.animated-section img {
    max-width: 80%;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: inline-block;
    background: #f0f0f0;
}

.animated-section .gif-container {
    margin: 2rem 0;
    padding: 1rem;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-box {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.stat-box .number {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.stat-box .label {
    font-size: 0.9rem;
    opacity: 0.9;
}


/* ==================== VIDEO RESPONSIVE ==================== */
.video-section {
 margin: 32px 0;
 text-align: center;
}

.video-container {
 position: relative;
 width: 100%;
 max-width: 900px; /* Limit width for better viewing on large screens */
 margin: 0 auto;
 border-radius: 12px;
 overflow: hidden;
 box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
 border: 1px solid var(--border-color);
 background: #000;
}

.video-container video {
 width: 100%;
 height: auto;
 display: block;
}

