/* Estilo para 3 años: grande, redondo, mucho color y pocas palabras. */
:root {
  --bg: #fff7e8;
  --ink: #3b2f4a;
  --muted: #7d7189;
  --card: #fff;
  --line: #eadfce;
  --ca: #2fa866;
  --de: #f08a24;
  --cr: #8a5cd6;
  --ok: #2fbf71;
  --mal: #ef5b5b;
  --sol: #ffc93c;
  --radius: 28px;
  --shadow: 0 8px 0 rgba(59, 47, 74, .12);
  --shadow-press: 0 3px 0 rgba(59, 47, 74, .12);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    radial-gradient(circle at 10% 10%, #ffe9c2 0, transparent 35%),
    radial-gradient(circle at 90% 80%, #e7f6ff 0, transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: 'Fredoka', 'Baloo 2', system-ui, sans-serif;
  font-size: 20px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* Fotos reales: recorte = objeto sin fondo; foto = imagen completa con esquinas redondeadas */
img.recorte {
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 .04em .03em rgba(0, 0, 0, .18));
  pointer-events: none;
}
img.foto {
  width: 1.4em;
  height: 1.05em;
  object-fit: cover;
  border-radius: .16em;
  vertical-align: middle;
  pointer-events: none;
}
.opcion > img.foto:only-child { width: 100%; height: 100%; border-radius: 18px; }
.opcion > img.recorte:only-child:not([style]) { width: 82%; height: 82%; }
.opcion:has(> img.foto:only-child) { padding: 0; }
.escena img.foto { height: 1.9em; width: auto; max-width: 100%; aspect-ratio: 4 / 3; }

.emo, .emo-svg {
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  line-height: 1;
  font-weight: 400;
}

button { font-family: inherit; color: inherit; }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255, 247, 232, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.barra h1 {
  flex: 1;
  margin: 0;
  font-size: clamp(1.1rem, 3.6vw, 1.8rem);
  text-align: center;
  font-weight: 700;
}
.quien {
  font-size: 2.2rem;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.btn-redondo {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  transition: transform .1s, box-shadow .1s;
}
.btn-redondo:active { transform: translateY(5px); box-shadow: var(--shadow-press); }
.btn-redondo.activo { background: var(--sol); }

/* ---------- Zona de juego ---------- */
.zona-juego {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.estrellas { display: flex; gap: 6px; justify-content: center; font-size: clamp(1.4rem, 4vw, 2rem); }
.estrella { filter: grayscale(1); opacity: .3; transition: .3s; }
.estrella.on { filter: none; opacity: 1; animation: pop .5s; }

.rondas, .ronda { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.ronda.entra { animation: entra .4s ease-out; }

.escena {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: clamp(3rem, 10vw, 5rem);
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 28px;
  box-shadow: var(--shadow);
}
.escena .escuchar { position: absolute; right: -18px; top: -18px; }

.opciones {
  --n: 3;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: clamp(12px, 3vw, 28px);
  width: 100%;
  max-width: calc(var(--n) * 290px);
}

.opcion {
  aspect-ratio: 1;
  border: 6px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: clamp(3rem, 11vw, 7rem);
  cursor: pointer;
  padding: 10px;
  overflow: hidden;
  transition: transform .12s, box-shadow .12s, opacity .3s;
}
.opcion:active { transform: translateY(5px); box-shadow: var(--shadow-press); }
.opcion small { font-size: clamp(.8rem, 2.4vw, 1.1rem); color: var(--muted); font-weight: 600; }
.opcion.bien { border-color: var(--ok); background: #e9fbf0; animation: bote .6s; }
.opcion.mal { animation: temblor .45s; opacity: .4; }
.opcion .dibujo { width: 100%; height: 100%; }

.dibujo { display: block; }
.grupo { display: flex; flex-wrap: wrap; justify-content: center; gap: .1em; font-size: .55em; max-width: 2.4em; }
.escena .grupo { font-size: 1em; max-width: none; }
.num { font-weight: 700; font-size: 1.1em; color: var(--cr); line-height: 1; }
.serie { display: flex; align-items: center; gap: 10px; }
.serie .bola, .opcion .bola { width: clamp(44px, 9vw, 80px); height: clamp(44px, 9vw, 80px); }
.opcion .bola { width: 70%; height: 70%; }
.hueco {
  width: clamp(44px, 9vw, 80px);
  height: clamp(44px, 9vw, 80px);
  border: 4px dashed var(--muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .5em;
  color: var(--muted);
  font-weight: 700;
  animation: latido 1.2s infinite;
}

/* ---------- Inicio y final ---------- */
.inicio { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6vh; text-align: center; }
.inicio h2 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.6rem); }
.icono-grande { font-size: clamp(6rem, 22vw, 10rem); animation: flota 3s ease-in-out infinite; }

.btn-jugar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 0;
  background: var(--ok);
  color: #fff;
  font-size: 4.5rem;
  box-shadow: 0 10px 0 #1f8a50;
  cursor: pointer;
  padding-left: 14px;
  animation: latido 1.6s infinite;
}
.btn-jugar:active { transform: translateY(7px); box-shadow: 0 3px 0 #1f8a50; }

.btn-grande {
  min-width: 110px;
  height: 110px;
  border-radius: 32px;
  border: 0;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 3.4rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.btn-grande:active { transform: translateY(5px); box-shadow: var(--shadow-press); }

.final {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(59, 47, 74, .35);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  animation: aparece .3s;
}
.final-tarjeta {
  background: var(--bg);
  border-radius: 36px;
  padding: 24px 28px;
  text-align: center;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.final-tarjeta h2 { margin: 6px 0 18px; font-size: clamp(1.6rem, 5vw, 2.4rem); }
.trofeo { font-size: 7rem; animation: bote 1s infinite; }
.final-botones { display: flex; gap: 20px; justify-content: center; }
.final .otra { background: var(--sol); }
.detalle-profe { margin: 18px 0 0; font-size: .8rem; color: var(--muted); }

/* ---------- Caja del profe (para adultos: letra normal) ---------- */
.profe {
  margin-top: 18px;
  width: 100%;
  max-width: 640px;
  text-align: left;
  font-size: 15px;
  background: #fff;
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  -webkit-user-select: text;
  user-select: text;
}
.profe summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.profe label { display: flex; gap: 8px; align-items: center; margin: 12px 0 4px; font-weight: 600; }
.profe select { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); flex: 1; }
.profe-fila p { margin: 12px 0 6px; }
.profe-ok { color: var(--ca); font-weight: 600; min-height: 1.2em; margin: 8px 0 0; }

.segmentos { display: flex; gap: 6px; flex-wrap: wrap; }
.segmentos button {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
}
.segmentos button.activo.nivel-C { background: var(--ok); border-color: var(--ok); color: #fff; }
.segmentos button.activo.nivel-EP { background: var(--sol); border-color: var(--sol); }
.segmentos button.activo.nivel-NC { background: var(--mal); border-color: var(--mal); color: #fff; }

/* ---------- Confeti ---------- */
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confeti i { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; animation: cae linear forwards; }

/* ---------- Animaciones ---------- */
@keyframes pop { 0% { transform: scale(.3); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes bote { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px) scale(1.04); } }
@keyframes temblor { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes flota { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes entra { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes cae { to { transform: translateY(110vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-width: 520px) {
  body { font-size: 18px; }
  .btn-redondo { width: 54px; height: 54px; font-size: 1.7rem; }
  .quien { width: 50px; height: 50px; font-size: 1.8rem; }
  .opcion { border-radius: 20px; border-width: 4px; }
}
