/* styles.css corrigé avec patch nth-child -> data-index */

body {
  margin: 0;
  padding: 0;
  background: linear-gradient(to bottom, #0f1117, #1b1e25);
  font-family: 'Segoe UI', sans-serif;
  color: #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
  height: 100%;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 600px;
  padding: 2rem;
  margin-top: 8rem;
  text-align: center;
  animation: fadeIn 1.2s ease-in-out;
  z-index: 5;
}

h1, h2, .question {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #ffffff;
}

#bg-video {
  position: fixed;
  top: 50%;
  left: 50%;
  width: auto;
  height: auto;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: -1;
  opacity: 0.5;
  filter: brightness(0.6) contrast(1.2);
  pointer-events: none;
}

#codeRainCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
  z-index: 2;
}

.intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.1);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.ego-btn {
  font-size: 1.3rem;
  padding: 1.2rem 2.4rem;
  border-radius: 30px;
  background: linear-gradient(to right, #00ff88, #00aa66);
  color: black;
  font-weight: bold;
  border: none;
  cursor: pointer;
  animation: pulse 2.5s infinite ease-in-out;
  box-shadow: 0 0 20px rgba(0,255,136,0.4);
  transition: transform 0.3s ease, background 0.3s ease;
}

.ego-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(to right, #00dd77, #009955);
}

.answer, .response {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
  color: #b0bec5;
}

.title {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.baseline-typewriter {
  font-family: 'Courier New', monospace;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 90vw;
  margin: 20px auto;
  min-height: 2.5em;
}

.cursor {
  display: inline-block;
  width: 1px;
  height: 1.2em;
  background: rgba(255,255,255,0.7);
  animation: blink 1s step-end infinite;
  vertical-align: bottom;
  margin-left: 1px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.start-btn {
  display: inline-block;
  padding: 15px 30px;
  background: linear-gradient(to right, #3a3a3a, #5a5a5a);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
  text-decoration: none;
}

.start-btn.visible {
  opacity: 0;
  animation: fadeInSlow 3s forwards;
}

.start-btn.pulse {
  animation: pulse 2.5s infinite ease-in-out;
}

.start-btn:hover {
  background: #7a7a7a;
  transform: scale(1.05);
}

@keyframes fadeInSlow {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.8;
  }
}

.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}

.visible {
  opacity: 1;
  pointer-events: auto;
  animation: pulse 1.8s ease-in-out infinite;
}

.commentaire {
  margin: 40px 0;
  font-style: italic;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.2rem;
  text-align: center;
}

.next-btn {
  padding: 12px 24px;
  font-size: 1.1rem;
  border: none;
  border-radius: 30px;
  background: linear-gradient(to right, #444, #666);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s, opacity 1s ease;
  margin-top: 20px;
  opacity: 0;
  pointer-events: none;
}

.next-btn.visible {
  opacity: 1;
  pointer-events: auto;
  animation: pulse 1.8s ease-in-out infinite;
}

.next-btn:hover {
  background: #888;
  transform: scale(1.05);
}

button {
  background: #2c3e50;
  color: #fff;
  padding: 0.9rem 1.5rem;
  margin: 0.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

button:hover {
  background: #34495e;
  transform: scale(1.05);
}

.sound-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.sound-toggle button {
  background: none;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
}

.progress-bar-container {
  width: 100%;
  background-color: #2b2b2b;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 2rem;
  height: 10px;
}

.progress-bar {
  height: 100%;
  background-color: #29b6f6;
  transition: width 0.8s ease;
}

footer {
  margin-top: auto;
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: #777;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.action-btn {
  transition: background-color 0.3s, transform 0.3s;
}

.action-btn:hover {
  background-color: rgba(255, 255, 255, 0.1); /* léger survol */
  transform: scale(1.03);
  cursor: pointer;
}

/* État sélectionné prioritaire */
.action-btn.selected {
  background-color: #00ffaa; /* ou ta couleur */
  color: black;
  transform: scale(1.05);
}

/* Désactive l'effet hover si déjà sélectionné */
.action-btn.selected:hover {
  background-color: #00ffaa;
  transform: scale(1.05);
  cursor: default;
}

.action-btn[data-index='1'] { animation-delay: 0.1s; }
.action-btn[data-index='2'] { animation-delay: 0.2s; }
.action-btn[data-index='3'] { animation-delay: 0.3s; }
.action-btn[data-index='4'] { animation-delay: 0.4s; }
.action-btn[data-index='5'] { animation-delay: 0.5s; }

.result {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #000000, #121212);
  color: #00fff7;
  text-align: center;
  padding: 2rem;
}

.result-card {
  background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(15,15,25,0.3));
  border: 1px solid rgba(0,255,136,0.3);
  box-shadow: 0 0 40px rgba(0,255,136,0.2), 0 0 10px rgba(255,255,255,0.05);
  border-radius: 20px;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 600px;
  text-align: center;
  color: #00ff88;
  font-family: 'Inter', sans-serif;
  backdrop-filter: blur(2px);
  position: relative;
  z-index: 2;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.result-card::before {
  content: "";
  position: absolute;
  top: -5%;
  left: -5%;
  width: 110%;
  height: 110%;
  opacity: 0.3;
  z-index: -1;
  filter: blur(4px);
  border-radius: 20px;
}

.result-card:hover {
  transform: scale(1.02);
  box-shadow: 0 0 60px rgba(0,255,136,0.3), 0 0 20px rgba(255,255,255,0.1);
}

.result-card h2 {
  font-size: 2rem;
  color: #ffffff;
  margin-bottom: 1.2rem;
  text-shadow: 0 0 2px #00ff88;
}

.result-card p {
  font-size: 1.1rem;
  color: #cceedd;
  line-height: 1.6;
  white-space: pre-wrap;
}

.result-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.result-text {
  font-size: 1.2rem;
  line-height: 1.6;
}

.result-tagline {
  font-style: italic;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #999;
}

/* Explosion visuelle au résultat */
.result-card {
  background: radial-gradient(circle at center, rgba(0, 255, 136, 0.1) 0%, rgba(0, 0, 0, 0.8) 100%);
  border: 2px solid rgba(0,255,136,0.5);
  box-shadow:
    0 0 40px rgba(0, 255, 136, 0.3),
    0 0 80px rgba(0, 255, 200, 0.2),
    inset 0 0 20px rgba(0, 255, 136, 0.1);
  animation: flashPulse 3s ease-in-out infinite, glowShift 10s linear infinite;
  transition: all 0.6s ease-in-out;
  position: relative;
  overflow: hidden;
}

@keyframes flashPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 40px rgba(0, 255, 136, 0.3),
      0 0 80px rgba(0, 255, 200, 0.2),
      inset 0 0 20px rgba(0, 255, 136, 0.1);
  }
  50% {
    transform: scale(1.03);
    box-shadow:
      0 0 80px rgba(0, 255, 200, 0.5),
      0 0 120px rgba(0, 255, 200, 0.3),
      inset 0 0 30px rgba(0, 255, 200, 0.15);
  }
}

@keyframes glowShift {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* Ajout de particules lumineuses internes */
.result-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 255, 136, 0.05) 10%, transparent 70%);
  animation: rotateParticles 30s linear infinite;
  pointer-events: none;
  z-index: -1;
}

.fade-in-delayed {
  opacity: 0;
  animation: fadeInEgo 2.5s ease-in-out forwards;
}

@keyframes fadeInEgo {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rotateParticles {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  .container {
    margin-top: 4rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }
  h1, h2 {
    font-size: 1.4rem;
  }
  .answer, .response {
    font-size: 1rem;
  }
  button {
    font-size: 0.95rem;
    padding: 0.8rem 1.2rem;
  }
}