:root {
  --accent: #2ecc71; /* verde */
  --bg-dark: #0d1117;
  --muted: #cbd5e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, rgba(34, 34, 34, 0.9), rgba(27, 27, 27, 0.555)),
              url("../img/sopaletra.jpg") no-repeat center center / cover;
  background-size: cover;
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  position: relative;
}

/* 🔹 Fondo opacado */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 0;
}

/* 🔹 Contenedor principal */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
}

/* 🔹 Encabezado */
.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  color: var(--accent);
}

.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* 🔹 Contenedor del juego */
.game-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* 🔹 Lista de palabras */
.word-list {
  flex: 1 1 200px;
  min-width: 180px;
}

.word-list h3 {
  margin-top: 0;
  color: var(--accent);
}

.word-list ul {
  list-style: none;
  padding: 0;
}

.word-list li {
  padding: 5px 0;
  font-weight: bold;
  cursor: pointer;
  color: #fff;
  transition: color 0.2s;
}

.word-list li.found {
  color: var(--accent);
  text-decoration: line-through;
}

/* 🔹 Cuadro de la sopa */
.grid-container {
  flex: 2 1 400px;
  display: flex;
  justify-content: center;
}

/* 🔹 Cuadrícula */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
}

/* 🔹 Celdas */
.cell {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  color: #fff;
}

/* 🔹 Al pasar el ratón */
.cell:hover {
  background: rgba(255,255,255,0.2);
}

/* 🔹 Efecto al seleccionar (sombreado suave) */
.cell.selected {
  background: rgba(255, 255, 255, 0.25);
  color: #42a9bb;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
  transition: all 0.15s ease;
}

/* 🔹 Letras correctas */
.cell.correct {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 8px var(--accent);
  transform: scale(1);
}

/* 🔹 Letras incorrectas (al marcar 3 mal) */
.cell.error {
  background: rgba(231, 76, 60, 0.8);
  color: #fff;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.8);
  transform: scale(1.05);
  transition: all 0.3s ease;
}

/* 🔹 Controles */
.controls {
  text-align: center;
  margin-top: 20px;
}

.btn {
  background: var(--accent);
  border: none;
  padding: 10px 16px;
  color: #ffffff;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover {
  background: #27ae60;
}

/* === PANEL DE CATEGORÍAS SOPA === */
.categories-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border-radius: 10px;
  border: 1px solid var(--accent);
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.categories-toggle:hover {
  background: rgba(0, 0, 0, 0.95);
}

.categories-panel {
  position: fixed;
  top: 15px;
  left: 15px;
  right: 15px;
  bottom: 15px;
  background: rgba(0, 0, 0, 0.92);
  border-radius: 18px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.9);
  z-index: 9;
  transform-origin: top left;
  transform: scale(0.1);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  padding: 20px 24px;
}
.categories-panel.open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

.categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.categories-header h2 {
  margin: 0;
  color: var(--accent);
}
.close-categories {
  background: transparent;
  border: 1px solid var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}
.categories-grid button {
  border: none;
  border-radius: 12px;
  padding: 14px 12px;
  background: rgba(46, 204, 113, 0.12);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.categories-grid button:hover {
  background: rgba(46, 204, 113, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.8);
}

/* 🔹 Responsive */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(10, 1fr);
  }
  .cell {
    width: 25px;
    height: 25px;
    font-size: 14px;
  }
}
