body, header{
  transition: background-color 0.5s, color 0.5s;
}

body.dark {
  background-color: #121212;
  color: #ddd;
}

header.dark {
  background-color: #121212;
  border-bottom: none;
}

header.dark nav a {
  color: #ddd;
}

#response {
  max-width: 100%;
  height: 30vh;
  margin-top: 0.5rem;
  padding: 2rem;
  border-radius: 8px;
  background:rgba(200,200,200,0.1);
  color: inherit;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
  font-size: 2.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5%;
  border-radius: 30px;
  text-align: center;
}

#falling-text-container {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 500; /* Diminuído para não sobrepor modais */
}

.falling-char {
  position: absolute;
  font-weight: bold;
  user-select: none;
  color: #0078d7;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh);
    opacity: 0;
  }
}

#particles-canvas {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 100; /* Bem baixo para não interferir */
}

#memory-game {
  width:100%;
  margin: 1rem auto;
  display: none;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 100px;
  border: 2px solid #888;
  border-radius: 8px;
  padding: 1rem;
  background: white;
}

#memory-game.active {
  display: grid;
}

.memory-card {
  background: #d61d92;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  color: white;
  user-select: none;
  transition: background 0.3s;
}

.memory-card.flipped {
  background: #ddd;
  color: #222;
}

#jogodamemoria {
  display: none;
  position: fixed;
  z-index: 10000; /* Aumentado para ficar acima de tudo */
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

#modal {
  display: none; 
}

.modal {
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

/* Conteúdo do modal */
.modal-content {
  position: relative;
  width: 95%;
  height: 95%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  z-index: 10001; /* Garantir que está acima do fundo do modal */
}

/* Botão fechar */
.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 25px;
  color: white;
  cursor: pointer;
  z-index: 10002; /* Máximo z-index para ficar acima de tudo */
  background: rgba(0,0,0,0.5); /* Adicionar fundo para melhor visibilidade */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  user-select: none; /* Evitar seleção de texto */
  pointer-events: auto; /* Garantir que aceita cliques */
  border: none;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}