/* ===================================================================
   NEMITIA · Estilos
   Público: niños de 8 a 12 años con TEA.
   Diseño alegre pero calmado; en las actividades el fondo se atenúa
   para no sobreestimular (diseño accesible).
   =================================================================== */

:root {
  --primary:  #3d8fc7;
  --primary-d:#2f74a5;
  --accent:   #f2994a;
  --accent-d: #dd7f2f;
  --green:    #5aa861;
  --green-d:  #478a4d;
  --purple:   #8256c4;
  --surface:  #ffffff;
  --cream:    #fffdf8;
  --text:     #2f3d4a;
  --muted:    #6e7f8d;
  --border:   #dfe8ef;
  --error-bg: #fdeceb;   --error-tx: #c25a52;
  --ok-bg:    #e9f7ec;   --ok-tx:    #3f8b4c;
  --info-bg:  #e6f3fb;   --info-tx:  #2f74a5;
  --gold:     #f5b731;
  --radius:   22px;
  --shadow:   0 8px 24px rgba(35, 60, 85, 0.14);
  --shadow-sm:0 4px 12px rgba(35, 60, 85, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0; min-height: 100vh;
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--text); line-height: 1.65; font-size: 17px; font-weight: 600;
  background-color: #dceaf4;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  background-attachment: fixed;
}
/* Fondo completo: pantallas de inicio, login, menús */
body.fondo-completo { background-image: url("../img/fondos/parque.jpg"); }
/* Fondo suave: pantallas de actividad (no distrae) */
body.fondo-suave    { background-image: url("../img/fondos/parque-suave.jpg"); }

/* Velo para asegurar legibilidad del texto sobre el fondo */
.velo {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: rgba(255, 255, 255, 0.30);
}
body.fondo-suave .velo { background: rgba(255, 255, 255, 0.55); }

h1, h2, h3, .brand { font-family: "Fredoka", sans-serif; font-weight: 600; }
h1 { font-size: 1.9rem; margin: 0 0 10px; color: var(--primary-d); }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
p.lead { color: var(--muted); font-size: 1.05rem; font-weight: 600; }

/* ---------- Navegación ---------- */
.nav {
  position: relative; z-index: 2;
  background: var(--surface);
  margin: 16px auto 0; max-width: 1060px;
  border-radius: 20px; padding: 13px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; box-shadow: var(--shadow-sm);
}
.brand { font-size: 1.6rem; letter-spacing: 1px; text-decoration: none; color: var(--primary); }
.nav nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav nav a { color: var(--text); text-decoration: none; font-weight: 700; font-family: "Fredoka", sans-serif; }
.nav nav a:hover { color: var(--primary); }
.nav .user { color: var(--muted); font-size: 0.88rem; font-weight: 700; }

.container { position: relative; z-index: 1; max-width: 1000px; margin: 26px auto; padding: 0 20px; }
.foot {
  position: relative; z-index: 1; text-align: center; padding: 26px;
  font-size: 0.88rem; color: #46586a;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}

/* ---------- Tarjetas ---------- */
.card {
  background: var(--cream); border: 2px solid #fff; border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.grid .card { transition: transform .18s ease, box-shadow .18s ease; }
.grid .card:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(35,60,85,0.2); }

/* ---------- Botones ---------- */
.btn, .btn-sm {
  display: inline-block; font-family: "Fredoka", sans-serif;
  background: var(--primary); color: #fff; border: none; border-radius: 999px;
  padding: 13px 26px; font-size: 1.03rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 var(--primary-d);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover, .btn-sm:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--primary-d); }
.btn:active, .btn-sm:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-d); }
.btn-sm { padding: 8px 16px; font-size: 0.9rem; box-shadow: 0 3px 0 var(--primary-d); }
.btn.accent { background: var(--accent); box-shadow: 0 4px 0 var(--accent-d); }
.btn.accent:hover { box-shadow: 0 6px 0 var(--accent-d); }
.btn.verde { background: var(--green); box-shadow: 0 4px 0 var(--green-d); }
.btn.verde:hover { box-shadow: 0 6px 0 var(--green-d); }
.btn.ghost { background: #fff; color: var(--primary); border: 2px solid var(--primary); box-shadow: 0 4px 0 var(--border); }
.btn.danger { background: #e07f6f; box-shadow: 0 4px 0 #c25a52; }
.btn-sm.danger { box-shadow: 0 3px 0 #c25a52; }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.grande { font-size: 1.25rem; padding: 16px 40px; }

/* ---------- Formularios ---------- */
.form-row { margin-bottom: 15px; }
label { display: block; font-weight: 700; margin-bottom: 6px; font-family: "Fredoka", sans-serif; }
input, select, textarea {
  width: 100%; padding: 12px 15px; border: 2px solid var(--border); border-radius: 13px;
  font-size: 1rem; font-family: "Nunito", sans-serif; font-weight: 600;
  background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(61,143,199,0.30); border-color: var(--primary);
}
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
@media (max-width: 560px) { .form-2col { grid-template-columns: 1fr; } }

/* ---------- Flash / badges ---------- */
.flash { padding: 14px 18px; border-radius: 14px; margin-bottom: 15px; font-weight: 700; }
.flash.error { background: var(--error-bg); color: var(--error-tx); }
.flash.ok    { background: var(--ok-bg);    color: var(--ok-tx); }
.flash.info  { background: var(--info-bg);  color: var(--info-tx); }

.badge { display: inline-block; padding: 4px 14px; border-radius: 999px;
         font-size: 0.82rem; font-weight: 800; font-family: "Fredoka", sans-serif; }
.badge.usuario      { background: var(--info-bg); color: var(--info-tx); }
.badge.especialista { background: #f1ebfb; color: var(--purple); }
.badge.admin        { background: #fdefe1; color: var(--accent-d); }
.badge.on  { background: var(--ok-bg); color: var(--ok-tx); }
.badge.off { background: var(--error-bg); color: var(--error-tx); }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 15px; border-bottom: 2px solid var(--border); }
th { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; font-family: "Fredoka", sans-serif; }
tr:hover td { background: #f7fbfd; }

/* ---------- PERSONAJES ---------- */
.pj { display: block; }
.pj-grande  { width: 150px; height: 150px; }
.pj-mediano { width: 100px; height: 100px; }
.pj-chico   { width: 66px;  height: 66px; }
.pj-mini    { width: 46px;  height: 46px; }
.equipo { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.equipo img { width: 108px; height: 108px; transition: transform .2s ease; }
.equipo img:hover { transform: translateY(-8px) scale(1.05); }
.saludo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.saludo > div { flex: 1; min-width: 230px; }
.titulo-pj { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.titulo-pj h1 { margin: 0; }

/* ---------- MAPA DE NIVELES ---------- */
.mapa-wrap { position: relative; }
.mapa {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px 14px;
  padding: 8px 4px;
}
@media (max-width: 620px) { .mapa { grid-template-columns: repeat(3, 1fr); } }
.nodo {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-decoration: none; color: var(--text);
}
.nodo-circulo {
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: "Fredoka", sans-serif; font-size: 1.4rem; font-weight: 700;
  background: #fff; color: var(--primary); border: 4px solid var(--primary);
  box-shadow: 0 5px 0 var(--primary-d);
  transition: transform .14s ease, box-shadow .14s ease;
}
.nodo:hover .nodo-circulo { transform: translateY(-4px); box-shadow: 0 9px 0 var(--primary-d); }
.nodo.completado .nodo-circulo { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 5px 0 var(--green-d); }
.nodo.bloqueado .nodo-circulo {
  background: #eef2f5; color: #b2bec7; border-color: #dbe3e9;
  box-shadow: 0 4px 0 #cdd7de; cursor: not-allowed;
}
.nodo.bloqueado:hover .nodo-circulo { transform: none; box-shadow: 0 4px 0 #cdd7de; }
.estrellitas { font-size: 0.82rem; letter-spacing: 1px; min-height: 18px; color: var(--gold); }
.contador-estrellas {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff7e2; color: #a97a10; border: 2px solid #f4dfa5;
  padding: 7px 16px; border-radius: 999px; font-weight: 800;
  font-family: "Fredoka", sans-serif;
}

/* ---------- ACTIVIDAD DE EMOCIONES ---------- */
.cara-emocion { text-align: center; margin: 8px 0 20px; min-height: 150px; }
.cara-img { width: 150px; height: 150px; }
.emoji { font-size: 5.6rem; }
.opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opciones.una-col { grid-template-columns: 1fr; }
.opciones button {
  padding: 18px; font-size: 1.1rem; font-weight: 700; font-family: "Fredoka", sans-serif;
  border: 3px solid var(--border); border-radius: 16px;
  background: #fff; color: var(--text); cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.opciones button:hover:not(:disabled) { border-color: var(--primary); background: var(--info-bg); transform: translateY(-3px); }
.opciones button.correcta   { border-color: var(--green); background: var(--ok-bg); }
.opciones button.incorrecta { border-color: var(--error-tx); background: var(--error-bg); }
.barra { height: 13px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.barra > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--green)); transition: width .3s; }

/* Globo de diálogo del personaje (retroalimentación / explicación) */
.dialogo { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.globo {
  position: relative; flex: 1; background: #fff; border: 3px solid var(--border);
  border-radius: 18px; padding: 15px 18px; font-weight: 700;
}
.globo::before {
  content: ""; position: absolute; left: -13px; top: 50%; transform: translateY(-50%);
  border-top: 10px solid transparent; border-bottom: 10px solid transparent;
  border-right: 13px solid var(--border);
}
.globo.exito { border-color: var(--green); background: var(--ok-bg); }
.globo.exito::before { border-right-color: var(--green); }
.globo.animo { border-color: var(--accent); background: #fff5e9; }
.globo.animo::before { border-right-color: var(--accent); }
.globo .resalta { background: #fff2c2; padding: 1px 7px; border-radius: 6px; font-weight: 800; }

/* Actividad extra (pantalla 7) */
.extra-ops { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.extra-ops button {
  padding: 16px 12px; border-radius: 16px; border: 3px solid var(--border);
  background: #fff; cursor: pointer; font-weight: 700; font-family: "Fredoka", sans-serif;
  color: var(--text); transition: transform .12s ease, border-color .12s;
}
.extra-ops button:hover { transform: translateY(-3px); border-color: var(--purple); }
.extra-ops button.elegida { border-color: var(--green); background: var(--ok-bg); }

/* Recompensa (pantalla 8) */
.pegatina {
  width: 130px; height: 130px; margin: 8px auto; border-radius: 22px;
  background: linear-gradient(150deg, #6aa9d6, #3d6fa5);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.6rem; box-shadow: var(--shadow); border: 4px solid #fff;
}
.estrellas-grandes { font-size: 2.3rem; letter-spacing: 5px; color: var(--gold); }

/* ---------- DIARIO EMOCIONAL ---------- */
.diario-ops { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 12px; margin-bottom: 16px; }
.diario-ops label {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 8px; border: 3px solid var(--border); border-radius: 16px;
  background: #fff; cursor: pointer; font-size: 0.92rem;
  transition: transform .12s ease, border-color .12s ease;
}
.diario-ops label:hover { transform: translateY(-3px); border-color: var(--primary); }
.diario-ops input { display: none; }
.diario-ops input:checked + .op-cara { transform: scale(1.12); }
.diario-ops label:has(input:checked) { border-color: var(--purple); background: #f5f0fc; }
.op-cara { font-size: 2.2rem; transition: transform .15s ease; }
.entrada-diario {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-bottom: 2px solid var(--border);
}
.entrada-diario .emo { font-size: 1.8rem; }

/* ---------- Premium ---------- */
.candado { font-size: 3.2rem; margin: 4px 0; }
.premium-bloqueado { text-align: center; background: linear-gradient(180deg, #fff6e9, #fffdf8); border: 3px dashed var(--accent); }
.premium-bloqueado h2 { color: var(--accent-d); }

/* ---------- Memorama ---------- */
.memorama { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 430px; margin: 0 auto; }
.mem-carta { position: relative; aspect-ratio: 1/1; border-radius: 16px; cursor: pointer; }
.mem-frente, .mem-dorso {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 16px; transition: opacity .18s ease;
}
.mem-dorso {
  background: linear-gradient(160deg, var(--primary), var(--primary-d)); color: #fff;
  font-family: "Fredoka", sans-serif; font-size: 2rem; font-weight: 700;
  box-shadow: 0 4px 0 var(--primary-d);
}
.mem-frente { background: #fff; border: 3px solid var(--border); opacity: 0; }
.mem-frente img { width: 76%; height: 76%; }
.mem-emoji { font-size: 2.6rem; }
.mem-carta.abierta .mem-frente { opacity: 1; }
.mem-carta.abierta .mem-dorso { opacity: 0; }
.mem-carta.hecha { opacity: 0.45; }
.mem-carta.hecha .mem-frente { border-color: var(--green); }

/* ---------- Reportes ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-top: 6px; }
.stat { background: var(--info-bg); border-radius: 16px; padding: 17px; text-align: center; }
.stat-num { font-family: "Fredoka", sans-serif; font-size: 2.1rem; font-weight: 700; color: var(--primary-d); line-height: 1; }
.stat-num small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.stat-lbl { color: var(--muted); font-size: 0.84rem; font-weight: 700; margin-top: 5px; }
.barchart { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 12px; }
.bar-label { font-size: 0.9rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--border); border-radius: 999px; height: 26px; overflow: hidden; }
.bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 999px; color: #fff; font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px; min-width: 26px; transition: width .4s;
}
.bar-fill.azul    { background: linear-gradient(90deg, #3d8fc7, #6fb3dd); }
.bar-fill.naranja { background: linear-gradient(90deg, #f2994a, #f6b877); }
@media (max-width: 520px) { .bar-row { grid-template-columns: 100px 1fr; } }

/* ---------- Utilidades ---------- */
.mt { margin-top: 16px; }
.center { text-align: center; }
.row-actions { display: flex; gap: 8px; }
.plan-precio { font-size: 2.1rem; font-weight: 700; font-family: "Fredoka", sans-serif; color: var(--primary); }
.plan-precio small { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
