:root {
  --cor-fundo: #fffbe6;
  --cor-header: #6a1b9a;
  --cor-destaque: #f9844a;
  --cor-primaria: #f9c74f;
  --cor-secundaria: #90be6d;
  --cor-acerto: #4caf50;
  --fonte: 'Comic Sans MS', cursive, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--fonte);
  background: var(--cor-fundo);
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  user-select: none;
  padding: 0 10px 40px;
}

.btn-voltar {
  position: fixed;
  top: 12px;
  left: 12px;
  background: var(--cor-destaque);
  color: white;
  padding: 10px 16px;
  border-radius: 30px;
  font-weight: bold;
  text-decoration: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: background-color 0.3s ease;
}
.btn-voltar:hover,
.btn-voltar:focus {
  background: #e3722e;
  outline: none;
}

header {
  margin-top: 60px;
  background: var(--cor-header);
  color: white;
  padding: 1.5rem 1rem 1rem;
  border-radius: 0 0 20px 20px;
  width: 100%;
  max-width: 760px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  text-align: center;
  user-select: none;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}

header p {
  margin-top: 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f9c74f;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* Nível de dificuldade */
#nivelSelection {
  margin: 20px auto 30px;
  max-width: 760px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

#nivelSelection button {
  background: var(--cor-secundaria);
  border: none;
  color: white;
  padding: 12px 22px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
  transition: background-color 0.3s ease, transform 0.2s ease;
  user-select: none;
  min-width: 100px;
}

#nivelSelection button[aria-pressed="true"],
#nivelSelection button:hover,
#nivelSelection button:focus {
  background: var(--cor-destaque);
  transform: scale(1.05);
  outline: none;
}

/* Game Container */
#gameContainer {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  user-select: none;
}

#grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: 4px;
  background: linear-gradient(135deg, #fef9f1, #cce5cc);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.1);
  user-select: none;
}

.cell {
  background-color: #f0e6f9;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.6rem;
  color: #333;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.25s ease, color 0.25s ease;
  border: 2px solid transparent;
  aspect-ratio: 1 / 1;
}

.cell span {
  user-select: none;
}

.cell.selected {
  background-color: var(--cor-destaque);
  color: white;
  border-color: #fff;
  box-shadow: 0 0 10px #f9c74f;
}

.cell.found {
  background-color: var(--cor-acerto);
  color: white;
  cursor: default;
  border-color: #4caf50;
  box-shadow: 0 0 15px #4caf50;
}

/* Palavras encontradas */
#wordList {
  margin-top: 25px;
  font-weight: 700;
  color: var(--cor-header);
  font-size: 1.15rem;
  text-align: center;
  user-select: none;
}

#wordList ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 300px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

#wordList li {
  background: #ececec;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 1rem;
  color: #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#wordList li.found {
  background: var(--cor-acerto);
  color: white;
  text-decoration: none;
  font-weight: 800;
}

/* Reiniciar */
#btnRestart {
  margin: 30px auto 50px;
  display: block;
  background: var(--cor-header);
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.25);
  transition: background-color 0.3s ease;
  user-select: none;
}

#btnRestart:hover,
#btnRestart:focus {
  background: #4a0c78;
  outline: none;
}

/* Canvas partículas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

/* Responsivo */

@media (max-width: 600px) {
  body {
    padding: 0 5px 30px;
  }

  header {
    margin-top: 50px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  header p {
    font-size: 1rem;
  }

  #nivelSelection {
    gap: 8px;
  }

  #nivelSelection button {
    min-width: 80px;
    padding: 10px 14px;
    font-size: 1rem;
  }

  #grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
  }

  .cell {
    font-size: 1.2rem;
    border-radius: 5px;
  }

  #wordList ul {
    flex-wrap: wrap;
    gap: 6px;
  }

  #wordList li {
    font-size: 0.95rem;
    padding: 4px 10px;
  }
}
