:root { --c: #7a6bff; --verde: #25d366; --fondo: #fff8ef; --texto: #2b2540; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: "Nunito", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 18px; min-height: 100vh;
}
button { font: inherit; cursor: pointer; border: 0; }
main { max-width: 720px; margin: 0 auto; padding: 12px 14px 60px; }
[hidden], .oculto { display: none !important; }

/* ---------- Login ---------- */
.login { text-align: center; padding: 30px 16px; }
.login h1 { font-size: 2.2rem; }
.avatares { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.avatar {
  background: var(--c); color: #fff; border-radius: 32px; width: 160px; padding: 22px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 1.5rem; font-weight: 800;
  box-shadow: 0 8px 0 rgba(0,0,0,.15); transition: transform .1s;
}
.avatar:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.avatar .emoji { font-size: 4.5rem; line-height: 1; }
.error { background: #ffe1e1; color: #b00020; padding: 10px; border-radius: 14px; display: inline-block; }
.pin { max-width: 320px; margin: 0 auto; }
.puntos { display: flex; justify-content: center; gap: 16px; margin: 10px 0 20px; }
.puntos i { width: 26px; height: 26px; border-radius: 50%; border: 4px solid var(--texto); }
.puntos i.lleno { background: var(--texto); }
.teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.teclado button { font-size: 2rem; font-weight: 800; padding: 18px 0; border-radius: 22px; background: #fff; box-shadow: 0 5px 0 #ddd; }
.teclado button:active { transform: translateY(3px); box-shadow: 0 2px 0 #ddd; }
.papa-login { margin-top: 50px; color: #888; font-size: .95rem; }
.papa-login form { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
.papa-login input { padding: 10px; border-radius: 10px; border: 1px solid #ccc; font: inherit; }
.papa-login button { padding: 10px 16px; border-radius: 10px; background: #075e54; color: #fff; }

/* ---------- Cabecera niñas ---------- */
.hola { background: var(--c); color: #fff; text-align: center; padding: 18px 10px 26px; border-radius: 0 0 36px 36px; }
.hola .emoji { font-size: 3.5rem; display: block; }
.hola h1 { margin: 4px 0 0; font-size: 2rem; }

/* ---------- Botones grandes ---------- */
.botones { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.botones.tres { grid-template-columns: repeat(3, 1fr); }
.b {
  border-radius: 28px; color: #fff; font-size: 1.3rem; font-weight: 800; padding: 18px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 7px 0 rgba(0,0,0,.18); transition: transform .08s;
}
.b span { font-size: 3rem; line-height: 1; }
.b:active { transform: translateY(5px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.wa { background: var(--verde); } .az { background: #3d8bff; } .na { background: #ff8a3d; } .mo { background: #a24dff; }

/* ---------- Lista de mensajes ---------- */
.titulo { margin: 26px 0 4px; }
.leyenda { margin: 0 0 12px; color: #666; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.punto { width: 14px; height: 14px; border-radius: 50%; background: var(--verde); animation: latido 1s infinite; }
.vacio { text-align: center; color: #888; padding: 30px; }
#feed { display: flex; flex-direction: column; gap: 14px; }
.msg {
  background: #fff; border-radius: 22px; padding: 12px 14px; max-width: 92%;
  box-shadow: 0 3px 10px rgba(0,0,0,.07); border: 4px solid transparent;
}
.msg.mio { align-self: flex-end; background: #e7f0ff; }
.msg.suyo { align-self: flex-start; }
.msg .cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg .badge { display: none; background: var(--verde); color: #fff; font-size: .75rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.msg .etq { font-weight: 700; margin-bottom: 6px; }
.msg .txt { margin: 0; font-size: 1.2rem; white-space: pre-wrap; word-break: break-word; }
.msg audio { width: 100%; min-width: 240px; }
.msg video { width: 100%; max-height: 60vh; border-radius: 14px; background: #000; }
.msg .pie { display: flex; gap: 10px; align-items: center; font-size: .8rem; color: #888; margin-top: 6px; }
.msg .estado.azul { color: #1d8bf0; font-weight: 700; }
.msg .borrar { margin-left: auto; background: none; opacity: .5; font-size: 1rem; }

/* NO VISTO: parpadea en verde */
.msg.nuevo { animation: parpadeo 1s ease-in-out infinite; cursor: pointer; }
.msg.nuevo .badge { display: inline-block; animation: latido 1s infinite; }
@keyframes parpadeo {
  0%, 100% { border-color: var(--verde); background: #d9ffe7; box-shadow: 0 0 22px rgba(37,211,102,.75); }
  50%      { border-color: transparent; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.07); }
}
@keyframes latido { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
/* VISTO: queda fijo, sin parpadear */
.msg.leido { animation: none; border-color: #e3e3e3; }

.salir { display: block; text-align: center; margin-top: 40px; color: #aaa; font-size: .9rem; }

/* ---------- Ventanas ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,10,40,.55); display: none; align-items: flex-end; justify-content: center; z-index: 10; }
.modal.abierto { display: flex; }
.caja {
  background: #fff; width: 100%; max-width: 560px; border-radius: 30px 30px 0 0; padding: 20px 18px 30px;
  max-height: 95vh; overflow: auto; animation: sube .2s ease-out;
}
@media (min-width: 600px) { .modal { align-items: center; } .caja { border-radius: 30px; } }
@keyframes sube { from { transform: translateY(40px); opacity: 0; } }
.caja.centro { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.caja h2 { margin: 0 0 10px; }
.caja textarea { width: 100%; font: inherit; font-size: 1.3rem; padding: 14px; border-radius: 18px; border: 3px solid #ddd; resize: vertical; }
.caja textarea:focus { outline: none; border-color: var(--c); }
.caja audio, .caja video { width: 100%; }
.caja video { max-height: 50vh; border-radius: 16px; background: #000; }
.emojis { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.emojis button { font-size: 1.7rem; background: #f4f1ff; border-radius: 12px; padding: 4px 8px; }
.acciones { display: flex; gap: 10px; width: 100%; margin-top: 8px; }
.acciones button { flex: 1; }
.pri, .sec { padding: 16px; border-radius: 20px; font-weight: 800; font-size: 1.15rem; }
.pri { background: var(--verde); color: #fff; box-shadow: 0 5px 0 #1a9e4b; }
.pri:disabled { opacity: .5; }
.sec { background: #eee; color: #555; }
.gigante { font-size: 1.6rem; padding: 26px 30px; border-radius: 26px; background: #a24dff; color: #fff; font-weight: 800; box-shadow: 0 6px 0 rgba(0,0,0,.2); }
.gigante.wa { background: var(--verde); width: 100%; }
.grande { font-size: 1.3rem; margin: 4px 0; }
.tel { background: var(--verde); border-radius: 50%; padding: 4px 6px; }

/* Botón de grabar */
.rec { width: 130px; height: 130px; border-radius: 50%; background: #fff; border: 8px solid #ff3b3b; display: grid; place-items: center; }
.rec span { width: 70px; height: 70px; border-radius: 50%; background: #ff3b3b; transition: all .2s; }
.rec.grabando { animation: latido 1s infinite; }
.rec.grabando span { width: 50px; height: 50px; border-radius: 10px; }

.progreso { width: 100%; height: 8px; background: #eee; border-radius: 99px; overflow: hidden; }
.progreso i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 150%); background: #333; color: #fff;
  padding: 14px 22px; border-radius: 99px; font-weight: 700; transition: transform .25s; z-index: 20; text-align: center; visibility: hidden;
}
.toast.ok { transform: translate(-50%, 0); background: #1a9e4b; visibility: visible; }
.toast.mal { transform: translate(-50%, 0); background: #d93025; visibility: visible; }

/* ---------- Panel de papá ---------- */
body.papa { --fondo: #f0f2f5; font-family: system-ui, sans-serif; font-size: 16px; }
.barra { background: #075e54; color: #fff; display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.barra h1 { font-size: 1.2rem; margin: 0; }
.barra a { color: #fff; }
.pestanas { display: flex; background: #075e54; padding: 0 10px; gap: 4px; overflow-x: auto; }
.pestanas a { color: #cfe; text-decoration: none; padding: 10px 16px; border-bottom: 4px solid transparent; white-space: nowrap; }
.pestanas a.activa { color: #fff; border-color: var(--c); font-weight: 700; }
.cont { background: var(--verde); color: #fff; border-radius: 99px; padding: 0 8px; font-size: .8rem; animation: latido 1s infinite; }
.papa .b { font-size: 1rem; padding: 12px 6px; } .papa .b span { font-size: 2rem; }
