:root {
    --azul: #2E86C1;
    --verde: #58B368;
    --amarillo: #F4C542;
    --naranja: #F28C38;
    --rojo: #E4572E;
    --crema: #FFF4DC;
    --tinta: #24324A;
    --suave: #6B7A90;
    --radio: 18px;
    --sombra: 0 6px 0 rgba(36, 50, 74, .12), 0 10px 24px rgba(36, 50, 74, .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Nunito", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
    font-size: 18px;
    color: var(--tinta);
    background: radial-gradient(circle at 20% 0%, #DFF1FF 0, transparent 40%), radial-gradient(circle at 100% 30%, #FFF0C9 0, transparent 35%), #F7FBFF;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: .3em 0; }
h3 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h4 { margin: 1em 0 .4em; }
p { line-height: 1.45; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
textarea, input[type=text] {
    width: 100%;
    border: 3px solid #D5E3F0;
    border-radius: 14px;
    padding: .6em .8em;
    background: #fff;
    color: var(--tinta);
}
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--azul); }
.oculto { display: none; }
.nota { color: var(--suave); font-size: .9rem; }
.error { color: var(--rojo); font-weight: bold; }

#app { max-width: 760px; margin: 0 auto; }
main { padding: 12px 16px 40px; }

/* Botones */
.btn-grande {
    display: block;
    width: 100%;
    margin: 18px 0 8px;
    padding: 16px 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #47A8E8, var(--azul));
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
    box-shadow: 0 6px 0 #1F5F8B;
    transition: transform .08s, box-shadow .08s;
}
.btn-grande:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 #1F5F8B; }
.btn-grande:disabled { background: #B8C4D0; box-shadow: 0 6px 0 #96A3B0; cursor: default; }
.btn-terminar:not(:disabled) { background: linear-gradient(180deg, #78D18A, var(--verde)); box-shadow: 0 6px 0 #3D8A4C; animation: latido 1.6s infinite; }
.btn-chico {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    background: var(--amarillo);
    font-weight: 800;
    box-shadow: 0 3px 0 #C99A1E;
}
.btn-chico:disabled { opacity: .5; }
.btn-texto { background: none; border: none; color: var(--azul); text-decoration: underline; margin-top: 10px; }
.btn-icono { border: none; background: #fff; border-radius: 50%; width: 44px; height: 44px; font-size: 1.3rem; box-shadow: var(--sombra); }
.btn-voz {
    border: none;
    background: #E8F4FD;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    margin-left: 6px;
    vertical-align: middle;
    font-size: 1.05rem;
    flex: none;
}
.btn-voz:active { background: var(--amarillo); }
.btn-mic { border: none; background: #E8F4FD; border-radius: 50%; width: 48px; height: 48px; font-size: 1.3rem; flex: none; }
.btn-mic.grabando, .btn-grabar.grabando { background: var(--rojo); color: #fff; animation: latido 1s infinite; }
.btn-idea { border: 2px dashed var(--amarillo); background: #FFFBEA; border-radius: 12px; padding: 6px 12px; margin-bottom: 8px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #E8F4FD;
    border: 2px solid transparent;
    font-size: .9rem;
}
button.chip.activo { border-color: var(--azul); background: var(--amarillo); }

/* Barra superior */
.barra-superior {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(247, 251, 255, .92);
    backdrop-filter: blur(8px);
}
.barra-superior .quien { width: 40px; height: 52px; }
.barra-superior .alias { flex: 1; font-weight: 800; }

/* Portada */
.portada { text-align: center; padding-top: 24px; }
.logo { font-weight: 900; font-size: 1.4rem; color: var(--azul); }
.portada-avatar { width: 130px; height: 200px; margin: 0 auto; animation: flotar 3s ease-in-out infinite; }
.gancho { font-size: 1.1rem; }
.input-codigo { text-align: center; font-size: 2rem; letter-spacing: .3em; text-transform: uppercase; max-width: 280px; }
.campo-etiqueta { display: block; text-align: left; font-weight: 800; margin: 18px 0 6px; }
.campo-etiqueta input { margin-top: 6px; }
.edades { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.edades button {
    width: 52px; height: 52px; border-radius: 50%; border: 3px solid #D5E3F0; background: #fff; font-weight: 900; font-size: 1.2rem;
}
.edades button.activo { background: var(--amarillo); border-color: var(--naranja); transform: scale(1.1); }
.autorizacion {
    display: flex; gap: 10px; text-align: left; font-size: .85rem; margin-top: 20px;
    background: #FFFBEA; border: 2px solid var(--amarillo); border-radius: 14px; padding: 12px;
}
.autorizacion input { width: 26px; height: 26px; flex: none; }

.cargando { text-align: center; padding: 30vh 20px; font-weight: 800; }
.gota-carga { width: 40px; height: 40px; margin: 0 auto 14px; background: var(--azul); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); animation: rebote 1s infinite; }

/* Mapa */
.mapa h1 { text-align: center; }
.mapa-resumen { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); }
.mapa-resumen .meta { font-weight: 700; }
.completa { margin: 14px 0; padding: 12px; border-radius: 14px; background: #E5F6E8; font-weight: 800; text-align: center; }
.completa.cerrada { background: #FFF1E6; }
.camino { position: relative; margin-top: 20px; padding: 10px 0; }
.camino::before {
    content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 10px; margin-left: -5px;
    background: repeating-linear-gradient(180deg, #D5E3F0 0 18px, transparent 18px 30px); border-radius: 5px;
}
.camino-grupo {
    position: relative; text-align: center; margin: 18px auto 10px; width: fit-content; padding: 4px 16px;
    background: var(--tinta); color: #fff; border-radius: 999px; font-weight: 800; font-size: .9rem;
}
.estacion {
    position: relative; display: flex; align-items: center; gap: 10px; width: 64%; margin: 10px 0;
    padding: 10px 14px; border: none; border-radius: 999px; background: #fff; box-shadow: var(--sombra); text-align: left;
}
.estacion.der { margin-left: 36%; flex-direction: row-reverse; text-align: right; }
.estacion-icono {
    flex: none; width: 54px; height: 54px; display: grid; place-items: center; font-size: 1.6rem; border-radius: 50%; background: #E8F4FD;
}
.estacion-titulo { font-weight: 800; font-size: .95rem; }
.estacion.disponible .estacion-icono { background: var(--amarillo); animation: latido 1.6s infinite; }
.estacion.hecho .estacion-icono { background: #C9EFD1; }
.estacion.bloqueado { opacity: .55; cursor: default; }

/* Insignia */
.insignia { text-align: center; width: 92px; flex: none; }
.insignia svg { width: 80px; height: 94px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.insignia b { display: block; font-size: .8rem; }
.insignia.grande { width: auto; animation: aparecer .8s ease-out; }
.insignia.grande svg { width: 160px; height: 186px; animation: girar 1.2s ease-out; }
.insignia.grande b { font-size: 1.3rem; }
.insignia-reto { display: flex; align-items: center; gap: 12px; justify-content: center; }

/* Etapas */
.etapa-cabecera { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.etapa-icono { font-size: 2.6rem; }
.etapa-grupo { color: var(--suave); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.instruccion {
    display: flex; align-items: center; gap: 8px; background: var(--azul); color: #fff;
    border-radius: var(--radio); padding: 12px 16px; font-weight: 700; font-size: 1.1rem; margin: 10px 0 16px;
}
.instruccion p { margin: 0; flex: 1; }
.tarjeta-mision {
    display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); margin-bottom: 14px;
}
.tarjeta-mision p { margin: 0; flex: 1; }
.icono-grande { font-size: 2.4rem; }
.pregunta-grande { font-size: 1.25rem; font-weight: 900; text-align: center; margin: 18px 0; }
.campo { display: flex; gap: 8px; align-items: flex-start; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: .95rem; }
.check input { width: 24px; height: 24px; flex: none; }
.burbuja { background: #fff; border-radius: 16px; padding: 10px 14px; box-shadow: var(--sombra); }

/* Predicción */
.carrusel { display: grid; grid-auto-flow: column; grid-auto-columns: 82%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.tarjeta-escena { margin: 0; background: #fff; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); scroll-snap-align: start; }
.tarjeta-escena figcaption { padding: 10px 12px; font-size: .95rem; }
.escena-mini { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.escena-mini > svg { width: 100%; height: 100%; display: block; }
.escena-mini-actores { position: absolute; left: 0; right: 0; bottom: 4%; display: flex; justify-content: center; gap: 4%; height: 62%; }
.escena-mini-actores div { height: 100%; aspect-ratio: 120 / 200; }
.escena-numero { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; display: grid; place-items: center; background: var(--amarillo); border-radius: 50%; font-weight: 900; }
.prediccion-recuerdo { background: #FFFBEA; border-radius: var(--radio); padding: 14px; margin-top: 16px; }
.prediccion-recuerdo img { max-width: 100%; border-radius: 12px; }

/* Termómetro */
.termo-fila { background: #fff; border-radius: var(--radio); padding: 14px; margin-bottom: 14px; box-shadow: var(--sombra); }
.termo-afirmacion { font-weight: 800; font-size: 1.1rem; margin-top: 0; }
.termo-control { position: relative; padding-top: 10px; }
.termo-marca { position: absolute; top: -8px; transform: translateX(-50%); color: var(--suave); font-size: .9rem; }
.termo-rango { width: 100%; -webkit-appearance: none; appearance: none; height: 22px; border-radius: 11px; background: linear-gradient(90deg, #9AD0F5, #F4C542 50%, #F28C38); outline: none; }
.termo-rango::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 5px solid var(--rojo); box-shadow: 0 3px 6px rgba(0,0,0,.2); }
.termo-rango::-moz-range-thumb { width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 5px solid var(--rojo); }
.termo-lectura { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; margin-top: 8px; }
.termo-cara { font-size: 2rem; }
.termo-extremos { display: flex; justify-content: space-between; font-size: .8rem; color: var(--suave); }
.termo-cambio { background: #FFFBEA; border-radius: 10px; padding: 8px 12px; font-weight: 700; }

/* Detective / temporizador */
.temporizador { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.temporizador-tiempo { font-size: 1.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.pistas li { margin: 8px 0; background: #FFFBEA; border-radius: 12px; padding: 8px 12px; animation: aparecer .4s; }

/* Chat */
.chat { background: #EAF5FF; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.chat-cabecera { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--azul); color: #fff; }
.chat-cabecera span { display: block; font-size: .8rem; opacity: .9; }
.chat-mensajes { max-height: 55vh; min-height: 220px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; animation: aparecer .3s; }
.msg.yo { justify-content: flex-end; }
.msg-avatar { width: 40px; height: 56px; flex: none; }
.msg-avatar.grande { width: 46px; height: 64px; background: #fff; border-radius: 12px; }
.msg-burbuja { max-width: 78%; background: #fff; padding: 8px 12px; border-radius: 16px 16px 16px 4px; }
.msg-burbuja p { margin: .2em 0 0; }
.msg.yo .msg-burbuja { background: var(--amarillo); border-radius: 16px 16px 4px 16px; }
.chat-entrada { display: flex; gap: 8px; align-items: flex-end; padding: 10px; background: #fff; }
.chat-entrada .campo { flex: 1; }

/* Cartas */
.indicadores { display: grid; gap: 8px; background: #fff; border-radius: var(--radio); padding: 12px 14px; box-shadow: var(--sombra); margin-bottom: 14px; }
.indicador span { font-weight: 800; font-size: .9rem; }
.indicador .sube { color: #2E9B48; }
.indicador .baja { color: var(--rojo); }
.barra { height: 14px; background: #E3ECF5; border-radius: 7px; overflow: hidden; }
.barra.grande { height: 18px; margin: 6px 0; }
.barra i { display: block; height: 100%; width: 0; background: var(--verde); border-radius: inherit; transition: width .6s cubic-bezier(.3, 1.4, .5, 1), background .4s; }
.cartas-zona { min-height: 360px; position: relative; }
.carta {
    background: #fff; border-radius: 24px; padding: 18px; text-align: center; box-shadow: var(--sombra);
    border: 4px solid var(--crema); touch-action: pan-y; user-select: none; transition: transform .25s, opacity .25s; animation: aparecer .35s;
}
.carta.sale-izq { transform: translateX(-130%) rotate(-25deg); opacity: 0; }
.carta.sale-der { transform: translateX(130%) rotate(25deg); opacity: 0; }
.carta-contador { font-size: .8rem; color: var(--suave); font-weight: 800; }
.carta-avatar { width: 90px; height: 130px; margin: 6px auto 10px; }
.carta > b { display: block; }
.carta-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.opcion { border: none; border-radius: 16px; padding: 12px; font-weight: 800; background: #E8F4FD; box-shadow: 0 4px 0 #C2D9EC; }
.opcion.izq { background: #FFE7D6; box-shadow: 0 4px 0 #EFC3A3; }
.opcion.der { background: #DDF3E2; box-shadow: 0 4px 0 #ACD9B6; }
.carta-reaccion, .carta-final { background: #FFFBEA; border-radius: 24px; padding: 18px; text-align: center; animation: aparecer .35s; font-size: 1.1rem; }

/* Conexión / plan */
.roles { background: #fff; border-radius: var(--radio); padding: 12px; box-shadow: var(--sombra); }
.rol { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.rol b { width: 100px; }
.pregunta-campo { margin-bottom: 12px; }
.pregunta-campo p { margin: .3em 0; font-weight: 700; }
.mapa-mental { background: #fff; border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); }
.mapa-centro { margin: 0 auto 14px; width: fit-content; padding: 14px 22px; background: var(--azul); color: #fff; border-radius: 999px; font-weight: 900; }
.mapa-ramas { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.mapa-rama { border: 3px solid #D5E3F0; border-radius: 14px; padding: 10px; }
.mapa-rama .chip { background: var(--amarillo); margin: 4px 0; animation: aparecer .3s; }
.mapa-agregar { display: flex; gap: 6px; margin-top: 6px; }
.accion-tarjeta { background: #fff; border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); margin-bottom: 14px; }
.accion-tarjeta label { display: block; font-weight: 700; margin: 8px 0; }

/* Remix */
.vinetas { display: grid; gap: 12px; }
.vineta { background: #fff; border-radius: var(--radio); padding: 10px; box-shadow: var(--sombra); }
.vineta input { margin-top: 6px; }

/* Lienzo */
.lienzo-caja { margin: 8px 0; }
.lienzo-herramientas { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.lienzo-herramientas button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #D5E3F0; background: #fff; }
.lienzo-herramientas button.activo { box-shadow: 0 0 0 3px var(--tinta); transform: scale(1.12); }
.lienzo-herramientas select { border-radius: 10px; border: 2px solid #D5E3F0; padding: 4px; }
.lienzo-marco { border: 3px dashed #C8D7E6; border-radius: 14px; overflow: hidden; background: #fff; }
.lienzo { display: block; width: 100%; touch-action: none; }

/* Evidencia */
.evidencia { margin-top: 24px; background: linear-gradient(180deg, #FFF8E5, #FFFDF6); border: 3px solid var(--amarillo); border-radius: 24px; padding: 14px; }
.evidencia h3 { margin-top: 0; }
.que-mostrar { display: flex; align-items: center; }
.evidencia-formatos { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.evidencia-formatos button {
    display: flex; flex-direction: column; align-items: center; gap: 4px; border: 3px solid transparent; border-radius: 16px;
    background: #fff; padding: 10px 6px; font-weight: 800; font-size: .85rem; box-shadow: 0 3px 0 #EBD9A6;
}
.evidencia-formatos button.activo { border-color: var(--naranja); }
.evidencia-formatos .icono { font-size: 1.8rem; }
.evidencia-panel { margin-top: 12px; }
.btn-grabar { border: none; border-radius: 999px; padding: 12px 20px; background: var(--azul); color: #fff; font-weight: 800; }
.grabadora { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grabadora audio { width: 100%; }
.grabadora-tiempo { font-weight: 900; font-variant-numeric: tabular-nums; }
.foto-canvas { width: 100%; border-radius: 12px; margin-top: 10px; touch-action: none; }
.evidencia-ok { margin-top: 8px; font-weight: 800; color: #2E9B48; }
.reaccion { display: flex; gap: 10px; align-items: flex-end; animation: aparecer .4s; }
.reaccion-avatar { width: 70px; height: 100px; flex: none; }
.reaccion .burbuja p { margin: .2em 0 0; }

/* Reto */
.variante { background: #E5F6E8; border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; }
.variante p { margin: .3em 0 0; }
.materiales { margin-bottom: 12px; }
.paso { display: flex; gap: 12px; background: #fff; border-radius: var(--radio); padding: 12px; box-shadow: var(--sombra); margin: 10px 0; }
.paso-check { position: relative; flex: none; }
.paso-check input { width: 44px; height: 44px; accent-color: var(--verde); }
.paso-numero { position: absolute; top: -8px; left: -8px; background: var(--amarillo); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; font-size: .8rem; font-weight: 900; }
.paso-cuerpo { flex: 1; }
.paso-cuerpo p { margin: 0 0 6px; }
.paso-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paso-acciones .temporizador { margin: 0; }
.paso-acciones .temporizador-tiempo { font-size: 1.1rem; }
.pista { background: #FFFBEA; border-radius: 10px; padding: 6px 10px; }
.cadena { background: #fff; border-radius: var(--radio); padding: 4px 14px 10px; box-shadow: var(--sombra); margin-top: 14px; }

/* Situación */
.historia { background: #fff; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.historia-ilustracion { aspect-ratio: 16 / 7; overflow: hidden; }
.historia-ilustracion svg { width: 100%; height: 100%; display: block; }
.historia-texto { padding: 14px; animation: aparecer .35s; }
.historia-texto p { margin-top: 0; }
.historia-opciones { display: grid; gap: 10px; }
.historia-texto.final { border-top: 8px solid var(--amarillo); }
.historia-texto.final.verde { border-color: var(--verde); }
.historia-texto.final.rojo { border-color: var(--rojo); }
.reflexion { font-weight: 800; }
.para-avanzar { background: #FFFBEA; border-radius: 10px; padding: 8px 12px; }
.semaforo-luz { display: inline-block; width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 4px #333 inset, 0 0 12px currentColor; flex: none; }
.semaforo-luz.verde { background: #3CCB5A; color: #3CCB5A; }
.semaforo-luz.amarillo { background: #FFD43B; color: #FFD43B; }
.semaforo-luz.rojo { background: #FF5A4E; color: #FF5A4E; }
.vecinos { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 12px 0; }
.vecino { background: #fff; border-radius: var(--radio); padding: 12px; box-shadow: var(--sombra); text-align: center; }
.vecino-avatar { width: 80px; height: 120px; margin: 0 auto 8px; }
.vecino > b, .vecino > .nota { display: block; }
.semaforo-resultado .nota { flex-basis: 100%; }
.vecino .burbuja { text-align: left; font-size: .95rem; background: #F3F8FC; box-shadow: none; }
.vecino details { text-align: left; font-size: .9rem; }
.condiciones { background: #fff; border-radius: var(--radio); padding: 12px; box-shadow: var(--sombra); margin-top: 12px; }
.semaforo-resultado { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #fff; border-radius: var(--radio); padding: 14px; margin-top: 12px; box-shadow: var(--sombra); animation: aparecer .4s; }
.semaforo-resultado p { flex: 1; margin: 0; font-weight: 800; }
.semaforo-resultado.verde { border: 4px solid var(--verde); }
.semaforo-resultado.amarillo { border: 4px solid var(--amarillo); }
.semaforo-resultado.rojo { border: 4px solid var(--rojo); }

/* Cierre */
.autoevaluacion { display: grid; gap: 10px; }
.auto { display: flex; align-items: center; gap: 12px; text-align: left; border: 3px solid transparent; border-radius: 16px; padding: 12px; background: #fff; box-shadow: var(--sombra); }
.auto.activo { border-color: var(--tinta); transform: scale(1.02); }
.pregunta-cierre { background: #fff; border-radius: var(--radio); padding: 10px 14px; box-shadow: var(--sombra); margin-bottom: 10px; }
.pregunta-cierre p { margin: 0 0 6px; font-weight: 700; }
.caritas { display: flex; flex-wrap: wrap; gap: 8px; }
.caritas button { border: 3px solid transparent; background: #F3F8FC; border-radius: 14px; padding: 6px 12px; font-size: 1.4rem; }
.caritas button.activo { border-color: var(--naranja); background: var(--amarillo); }
.celebracion { text-align: center; padding-top: 30px; }

/* Video / cuento */
.video-caja { margin-top: 10px; }
.youtube { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radio); }
.cuento { background: #000; border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.cuento-escenario { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #8FD3FF; }
.cuento-camara { position: absolute; inset: 0; transform-origin: 50% 70%; }
.cuento-fondo, .cuento-fondo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cuento-actores { position: absolute; inset: 0; }
.cuento-actor { position: absolute; bottom: 4%; aspect-ratio: 120 / 200; transform: translateX(-50%); transition: filter .3s; }
.cuento-actor svg { width: 100%; height: 100%; }
.cuento-actor.hablando { animation: hablar .5s ease-in-out infinite alternate; filter: drop-shadow(0 0 8px #fff); z-index: 2; }
.cuento-titulo-escena { position: absolute; top: 8px; left: 10px; background: rgba(0,0,0,.45); color: #fff; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.cuento-texto-pantalla {
    position: absolute; top: 20%; left: 50%; transform: translateX(-50%); background: var(--amarillo); color: var(--tinta);
    padding: 8px 18px; border-radius: 14px; font-weight: 900; font-size: clamp(1rem, 4vw, 1.6rem); animation: aparecer .5s; text-align: center;
}
.cuento-subtitulo {
    position: absolute; left: 4%; right: 4%; bottom: 3%; text-align: center; color: #fff; font-weight: 700;
    font-size: clamp(.8rem, 3.2vw, 1.15rem); text-shadow: 0 2px 4px #000, 0 0 2px #000; z-index: 3;
}
.cuento-subtitulo:empty { display: none; }
.cuento-portada {
    position: absolute; inset: 0; z-index: 5; border: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; background: rgba(36, 50, 74, .55); color: #fff;
}
.cuento-portada strong { font-size: 1.3rem; padding: 0 16px; }
.cuento-play-grande { width: 80px; height: 80px; border-radius: 50%; background: var(--amarillo); color: var(--tinta); display: grid; place-items: center; font-size: 2.2rem; animation: latido 1.4s infinite; }
.cuento-fin { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(36,50,74,.7); color: #fff; padding: 16px; font-size: 1.4rem; }
.cuento-fin .btn-grande { max-width: 320px; }
.cuento-controles { display: flex; align-items: center; gap: 6px; padding: 8px; background: #1B2638; }
.cuento-btn { border: none; background: #2C3B55; color: #fff; border-radius: 10px; min-width: 40px; height: 36px; font-weight: 800; }
.cuento-btn.activo { background: var(--azul); }
.cuento-progreso { flex: 1; display: flex; gap: 3px; }
.cuento-progreso button { flex: 1; height: 8px; border: none; border-radius: 4px; background: #3E4F6B; padding: 0; }
.cuento-progreso button.hecho { background: var(--amarillo); }

img.ilustracion { width: 100%; height: 100%; object-fit: cover; display: block; }
.cuento-fondo img.ilustracion { position: absolute; inset: 0; }
.insignia-img { width: 84px; height: 84px; display: block; margin: 0 auto 4px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.insignia.grande .insignia-img { width: 170px; height: 170px; animation: girar 1.2s ease-out; }

/* Avisos y confeti */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: var(--tinta); color: #fff;
    padding: 12px 20px; border-radius: 999px; font-weight: 800; max-width: 90vw; text-align: center; animation: aparecer .3s;
}
.confeti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confeti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation-name: caer; animation-timing-function: linear; animation-fill-mode: forwards; }

@keyframes caer { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes flotar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes rebote { 0%, 100% { transform: rotate(-45deg) translateY(0); } 50% { transform: rotate(-45deg) translate(6px, -6px); } }
@keyframes aparecer { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes girar { from { transform: rotateY(360deg) scale(.3); } to { transform: none; } }
@keyframes hablar { from { transform: translateX(-50%) translateY(0); } to { transform: translateX(-50%) translateY(-3%); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 640px) {
    .carrusel { grid-auto-columns: 46%; }
    .vinetas { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- IA en vivo ---------- */
.puntos { display: inline-flex; gap: 5px; align-items: center; min-height: 1.2em; }
.puntos i { width: 8px; height: 8px; border-radius: 50%; background: #8AA; animation: puntito 1s infinite ease-in-out; }
.puntos i:nth-child(2) { animation-delay: .15s; }
.puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes puntito { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-5px); opacity: 1; } }
.vecino.convencido { box-shadow: 0 0 0 3px #58B368; }
.veredicto { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .2em; }
.vecino.convencido .veredicto { color: #2E7D32; }
.pistas { background: #FFFBEA; border-radius: 16px; padding: 10px 14px; margin: 10px 0; }
.pistas summary { cursor: pointer; font-weight: 700; }
.pistas ul { margin: .5em 0 0; padding-left: 1.2em; }

/* ---------- Dibujo en papel + foto ---------- */
.foto-botones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-secundario { background: #fff; border: 2px solid #DCE5EF; color: #24324A; }
.dibujo-evidencia, .remix-papel { display: grid; gap: 12px; }
.dibujo-pasos { display: flex; gap: 12px; align-items: center; background: #FFFBEA; border-radius: 18px; padding: 12px 16px; }
.dibujo-pasos .icono-grande { font-size: 2rem; flex: none; }
.dibujo-pasos ol { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.hoja-guia { display: grid; grid-template-columns: repeat(3, 1fr); border: 3px dashed #B8C4D3; border-radius: 10px; background: #fff; height: 90px; overflow: hidden; }
.hoja-guia div { display: flex; align-items: flex-end; justify-content: center; padding: 6px; font-size: .8rem; font-weight: 700; color: #6B7A90; }
.hoja-guia div + div { border-left: 3px dashed #B8C4D3; }
.remix-papel details summary { cursor: pointer; font-weight: 600; }
.remix-papel details input { display: block; width: 100%; box-sizing: border-box; margin-top: 6px; }
.foto-canvas { max-width: 100%; height: auto; border-radius: 12px; }

/* Cuento como video MP4 */
.video-mp4 { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 16px; display: block; }
.video-alternar { display: block; margin: 10px auto 0; }
