/* ===========================
   OCTOPUS CAA — ESTILOS v2
   =========================== */

:root {
  --color-primary: #2e86c1;
  --color-primary-dark: #1a5276;
  --color-success: #27ae60;
  --color-danger: #e74c3c;
  --color-light: #f0f7ff;
  --color-border: #d6eaf8;
}

main {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── HERO ── */
.app-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.big-emoji { font-size: 2rem; flex-shrink: 0; }

.app-hero h2 {
  font-size: 1.2rem;
  color: var(--color-primary-dark);
  margin: 0 0 2px 0;
}

.app-hero p {
  font-size: 0.8rem;
  color: #888;
  margin: 0;
}

/* ── CONTENEDOR ── */
#modo-nino {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

/* ── CATEGORÍAS ── */
#categorias {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  background: white;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#categorias button {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

#categorias button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

#categorias button:active {
  transform: scale(0.96);
}

/* ── BARRA DE FRASE ── */
#frase-bar {
  background: linear-gradient(135deg, #eaf4fb, #ddeef8);
  border: 2px solid rgba(46, 134, 193, 0.25);
  padding: 12px;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

#frase-bar-label {
  font-size: 0.7rem;
  font-weight: bold;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

#frase-visual {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 90px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  align-content: flex-start;
}

/* Placeholder cuando está vacío */
#frase-visual:empty::before {
  content: "Toca una imagen para agregarla aquí...";
  color: #aaa;
  font-size: 0.8rem;
  font-style: italic;
  display: flex;
  align-items: center;
  width: 100%;
  height: 60px;
}

.frase-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 75px;
  background: white;
  border-radius: 10px;
  padding: 6px 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border: 2px solid var(--color-border);
  animation: slideIn 0.25s ease;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.frase-item:active {
  transform: scale(0.92);
}

.frase-item img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.frase-item span {
  font-size: 0.65rem;
  text-align: center;
  color: var(--color-primary-dark);
  font-weight: bold;
  margin-top: 3px;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── BOTONES ACCIÓN ── */
.botones-accion {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn-accion {
  padding: 10px 0;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-hablar {
  background: var(--color-success);
  color: white;
  box-shadow: 0 3px 8px rgba(39, 174, 96, 0.35);
}

.btn-hablar:hover { background: #229954; transform: translateY(-1px); }
.btn-hablar:active { transform: scale(0.96); }

.btn-limpiar {
  background: var(--color-danger);
  color: white;
  box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

.btn-limpiar:hover { background: #c0392b; transform: translateY(-1px); }
.btn-limpiar:active { transform: scale(0.96); }

/* ── TABLERO DE PICTOGRAMAS ── */
#tablero {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@media (min-width: 481px) {
  #tablero { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 769px) {
  #tablero { grid-template-columns: repeat(5, 1fr); }
}

/* ── BOTÓN PICTOGRAMA ── */
.picto-btn {
  background: white;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all 0.18s ease;
  aspect-ratio: 1;
}

.picto-btn:hover {
  border-color: var(--color-primary);
  background: #eaf4fb;
  transform: translateY(-3px);
  box-shadow: 0 5px 12px rgba(46, 134, 193, 0.2);
}

.picto-btn:active {
  transform: scale(0.93);
  background: var(--color-light);
}

.picto-btn img {
  width: 75%;
  height: 65%;
  object-fit: contain;
}

.picto-btn span {
  font-size: 0.7rem;
  text-align: center;
  color: var(--color-primary-dark);
  font-weight: bold;
  line-height: 1.2;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── LOADING ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  grid-column: 1 / -1;
}

.loading p {
  font-size: 1rem;
  color: var(--color-primary);
  animation: pulse 1.5s infinite;
}

/* ── PANTALLA DE INICIO ── */
.pantalla-inicio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px 12px;
  text-align: center;
  grid-column: 1 / -1;
}

.intro-icon {
  font-size: 3.5rem;
  animation: bounce 2s infinite;
}

.pantalla-inicio h2 {
  color: var(--color-primary-dark);
  font-size: 1.4rem;
  margin: 0;
  font-weight: 900;
}

.pantalla-inicio > p {
  color: #666;
  font-size: 0.9rem;
  max-width: 280px;
  margin: 0;
  line-height: 1.5;
}

.pasos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.paso {
  background: linear-gradient(135deg, #fff, #f8fbff);
  border-left: 4px solid var(--color-primary);
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(46, 134, 193, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.paso .num {
  font-size: 1.2rem;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  font-weight: bold;
  flex-shrink: 0;
}

.paso p {
  margin: 0;
  text-align: left;
  color: #333;
  font-size: 0.88rem;
  font-weight: 500;
}

/* ── ALERTAS ── */
.alerta-flotante {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-weight: bold;
  font-size: 0.88rem;
  z-index: 1000;
  animation: slideUp 0.3s ease;
  max-width: 85%;
  text-align: center;
}

/* ── ANIMACIONES ── */
@keyframes slideIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

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

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

/* ── TABLET ── */
@media (min-width: 768px) {
  main { padding: 20px; gap: 14px; }

  .frase-item { width: 85px; }
  .frase-item img { width: 68px; height: 68px; }

  .pasos { flex-direction: row; justify-content: center; }
  .paso { flex: 1; max-width: 180px; flex-direction: column; align-items: center; }
  .paso p { text-align: center; }

  .btn-accion { max-width: 160px; padding: 12px 0; font-size: 1rem; }
}

/* ── DESKTOP ── */
@media (min-width: 1024px) {
  main { max-width: 1200px; margin: 0 auto; padding: 24px; }

  .frase-item { width: 90px; }
  .frase-item img { width: 74px; height: 74px; }

  .btn-accion { max-width: 180px; }
  .botones-accion { max-width: 400px; margin: 0 auto; }
}