/* ══════════════════════════════════════════════════════════════════
   Zumbidapp · aspecto por defecto «Aero clásico»
   Todo color, degradado e imagen sale de un token de :root. Una skin
   solo tiene que redefinir los tokens que quiera (ver skins/COMO-CREAR-SKINS.md).
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* General */
  --fuente: "Segoe UI", "Nunito", Roboto, "Helvetica Neue", Arial, sans-serif;
  --exterior: radial-gradient(ellipse at 50% 0%, #2f6fa8, #0b2a4a 70%);
  --texto: #1b2836;
  --texto-suave: #64748a;
  --texto-tenue: #8e9bab;
  --enlace: #1d76d2;
  --error: #c0261a;
  --exito: #1a6b10;
  --separador: #d5e5f2;
  --sombra: 0 8px 26px rgba(10, 60, 110, .22);
  --radio: 5px;
  --color-barra-movil: #2a8de0;
  /* App de Android: color de los iconos de las barras del sistema («claros» u «oscuros») */
  --iconos-arriba-login: oscuros;   /* hora, batería... sobre el cielo claro del inicio */
  --iconos-abajo-login: claros;     /* barra de navegación sobre el azul oscuro del inicio */
  --iconos-arriba: claros;          /* sobre la cabecera azul */
  --iconos-abajo: oscuros;          /* sobre la lista/chat claros */

  /* Imágenes de fondo opcionales (las rellenan las skins) */
  --img-login: none;
  --img-escena: none;
  --img-chat: none;

  /* Estados */
  --verde-1: #a8ee7c;  --verde-2: #36a51b;
  --rojo-1: #ffa292;   --rojo-2: #cc2515;
  --naranja-1: #ffd88a; --naranja-2: #e58600;
  --gris-1: #e2e7ec;   --gris-2: #8995a1;

  /* Inicio de sesión */
  --login-fondo:
    radial-gradient(ellipse 120% 60% at 50% -8%, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #c6e9fc 0%, #86c9f0 38%, #3d99dc 78%, #2a7fc6 100%);
  --login-texto: #24435f;
  --login-rayos: rgba(255, 255, 255, .16);
  --burbuja-color: 255, 255, 255;
  --marca-color: #fff;
  --marca-sombra: 0 1px 0 #7fb6e3, 0 3px 10px rgba(0, 60, 130, .45);
  --marca-app-color: #d4ff9e;
  --lema-color: #0f4a85;
  --login-pie-texto: #fff;
  --orbita-fondo: radial-gradient(circle at 50% 45%, #ffffff 0%, #eaf6ff 60%, #cfe9fb 100%);

  /* Cristal */
  --cristal-fondo: rgba(255, 255, 255, .62);
  --cristal-borde: rgba(255, 255, 255, .9);

  /* Botones */
  --boton-fondo: linear-gradient(#fdfeff 0%, #e8f3fb 48%, #d0e6f7 50%, #c2def5 100%);
  --boton-fondo-pulsado: linear-gradient(#cfe5f6 0%, #bad9f1 48%, #a6cdee 50%, #b9dbf5 100%);
  --boton-borde: #6f9fc8;
  --boton-texto: #13283d;
  --boton-icono: #1d5c96;
  --primario-fondo: linear-gradient(#7ccbff 0%, #3a9be8 48%, #1a7bd3 50%, #2f92e4 100%);
  --primario-fondo-pulsado: linear-gradient(#3a9be8 0%, #1a7bd3 48%, #0f66b8 50%, #1d7bd0 100%);
  --primario-borde: #13599e;
  --primario-texto: #fff;

  /* Campos de texto */
  --campo-fondo: #fff;
  --campo-borde: #93b6d3;
  --campo-texto: #1b2836;
  --foco: #3c9be0;

  /* Selección y pulsación (filas, menús, herramientas) */
  --seleccion: linear-gradient(#f2f9ff, #d6ecfc);
  --seleccion-borde: #b7dcf6;
  --pulsado: linear-gradient(#e2f2fe, #c4e3fb);
  --pulsado-borde: #84c3ef;

  /* Cabeceras («escena») de la lista y del chat */
  --escena-fondo:
    radial-gradient(ellipse 70% 120% at 100% 0%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 60% 80% at 0% 100%, rgba(170, 240, 255, .55), rgba(255, 255, 255, 0) 70%),
    linear-gradient(160deg, #1d6fc4 0%, #2f95e4 45%, #74cdf6 100%);
  --escena-texto: #fff;
  --escena-brillo: rgba(255, 255, 255, .22);

  /* Lista de contactos */
  --lista-fondo: #fff;
  --buscador-fondo: linear-gradient(#f4faff, #e3f1fb);
  --buscador-borde: #c4dcef;
  --grupo-texto: #1e5788;
  --nick-texto: #10202f;
  --parpadeo-1: linear-gradient(#fff6e6, #ffe2b0);
  --parpadeo-2: linear-gradient(#ffd690, #ffb347);
  --parpadeo-borde: #f2a640;

  /* Conversación */
  --chat-fondo: linear-gradient(180deg, #d3ecfb 0%, #eaf6fd 30%, #e2f1fb 100%);
  --conversacion-fondo: #fff;
  --conversacion-borde: #b4d3ea;
  --conversacion-texto: #111;
  --mio-texto: #0d3a6e;
  --quien-texto: #6d7b88;
  --sistema-texto: #59687a;
  --zumbido-texto: #b05a00;
  --barra-estado-fondo: linear-gradient(#f6fbff, #e6f2fb);
  --barra-estado-texto: #4b5d70;

  /* Ventanas: avisos, menús y diálogos */
  --ventana-fondo: linear-gradient(#ffffff, #eef7fd);
  --ventana-borde: #6fa5d2;
  --ventana-texto: #24384c;
  --titulo-fondo: linear-gradient(#5db3f0 0%, #2f8fdf 50%, #1f7bd0 51%, #3a99e6 100%);
  --titulo-texto: #fff;
  --menu-fondo: #fff;
  --velo: rgba(10, 40, 70, .4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  font-family: var(--fuente);
  color: var(--texto);
  background: var(--exterior);
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

#app {
  position: relative;
  max-width: 460px;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: var(--lista-fondo);
  box-shadow: 0 0 40px rgba(0, 0, 0, .45);
}

.pantalla {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity .45s ease, visibility 0s .45s;
}
.pantalla.activa { opacity: 1; visibility: visible; transition: opacity .45s ease; }

/* ── Cristal y botones ─────────────────────────────────────────────── */
.cristal {
  background: var(--cristal-fondo);
  border: 1px solid var(--cristal-borde);
  border-radius: 12px;
  box-shadow: var(--sombra), inset 0 1px 0 var(--cristal-borde);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.boton-aero {
  position: relative;
  padding: 8px 18px;
  border: 1px solid var(--boton-borde);
  border-radius: var(--radio);
  background: var(--boton-fondo);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 2px rgba(0, 40, 80, .18);
  color: var(--boton-texto);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.boton-aero:active { background: var(--boton-fondo-pulsado); }
.boton-aero:disabled { opacity: .6; cursor: default; }
.boton-aero:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.boton-aero.primario {
  border-color: var(--primario-borde);
  background: var(--primario-fondo);
  color: var(--primario-texto);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 2px 6px rgba(0, 30, 70, .3);
}
.boton-aero.primario:active { background: var(--primario-fondo-pulsado); }
.boton-aero.ancho { width: 100%; padding: 11px; font-size: 15px; }
.boton-aero.cuadrado { padding: 0; width: 38px; height: 36px; display: grid; place-items: center; }
.boton-aero svg { width: 18px; height: 18px; stroke: var(--boton-icono); stroke-width: 2.6; stroke-linecap: round; fill: none; }

.enlace { background: none; border: 0; padding: 4px; color: var(--enlace); text-decoration: underline; font-size: 13px; }

.campo {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--campo-borde);
  border-radius: 4px;
  background: var(--campo-fondo);
  color: var(--campo-texto);
  box-shadow: inset 0 1px 2px rgba(0, 30, 60, .12);
  font-size: 15px;
  outline: none;
}
.campo::placeholder, #in-msg::placeholder { color: var(--texto-tenue); }
.campo:focus { border-color: var(--foco); box-shadow: inset 0 1px 2px rgba(0, 30, 60, .12), 0 0 0 3px color-mix(in srgb, var(--foco) 25%, transparent); }

/* ── Marco de la imagen para mostrar (su color = tu estado) ────────── */
.marco {
  --c1: var(--verde-1); --c2: var(--verde-2);
  --t: 44px; --r: 9px; --p: 3px;
  position: relative;
  display: inline-block;
  flex: none;
  padding: var(--p);
  border: 0;
  border-radius: calc(var(--r) + var(--p));
  background: linear-gradient(155deg, #ffffff 0%, var(--c1) 22%, var(--c2) 78%, var(--c1) 100%);
  box-shadow: 0 1px 4px rgba(0, 40, 80, .35), inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(0, 0, 0, .12);
  transition: background .4s;
}
.marco-img {
  display: block;
  position: relative;
  width: var(--t); height: var(--t);
  border-radius: var(--r);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .22);
}
.marco-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.marco[data-estado="ocupado"] { --c1: var(--rojo-1); --c2: var(--rojo-2); }
.marco[data-estado="ausente"] { --c1: var(--naranja-1); --c2: var(--naranja-2); }
.marco[data-estado="invisible"],
.marco[data-estado="desconectado"] { --c1: var(--gris-1); --c2: var(--gris-2); }

.marco.grande { --t: 128px; --r: 14px; --p: 7px; }
.marco.medio { --t: 62px; --r: 10px; --p: 4px; }
.marco.pequeno { --t: 40px; --r: 8px; --p: 3px; }
.marco.mini { --t: 40px; --r: 7px; --p: 3px; }

.punto {
  --c1: var(--verde-1); --c2: var(--verde-2);
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--c1) 30%, var(--c2) 100%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2);
  vertical-align: -1px; margin-right: 6px;
}
.punto[data-estado="ocupado"] { --c1: var(--rojo-1); --c2: var(--rojo-2); }
.punto[data-estado="ausente"] { --c1: var(--naranja-1); --c2: var(--naranja-2); }
.punto[data-estado="invisible"], .punto[data-estado="desconectado"] { --c1: var(--gris-1); --c2: var(--gris-2); }

/* ══════════════════ INICIO DE SESIÓN ══════════════════ */
#p-login {
  align-items: center;
  overflow-y: auto;
  background: var(--img-login) center / cover no-repeat, var(--login-fondo);
  padding: max(env(safe-area-inset-top), 18px) 18px 12px;
}

.cielo { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.rayos {
  position: absolute; left: 50%; top: -60%;
  width: 220%; aspect-ratio: 1; transform: translateX(-50%);
  background: repeating-conic-gradient(from 0deg, var(--login-rayos) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  animation: girar 90s linear infinite;
}
.burbuja {
  position: absolute; left: var(--x); bottom: -80px;
  width: var(--t); height: var(--t); border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(var(--burbuja-color), .95) 0 8%, rgba(var(--burbuja-color), .15) 30%, rgba(var(--burbuja-color), .05) 60%, rgba(var(--burbuja-color), .5) 100%);
  box-shadow: inset 0 0 0 1px rgba(var(--burbuja-color), .55);
  animation: subir-burbuja var(--d) linear infinite;
  animation-delay: var(--r);
}
@keyframes subir-burbuja {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(18px, -55vh); }
  90% { opacity: 1; }
  100% { transform: translate(-10px, -115vh); opacity: 0; }
}
@keyframes girar { to { transform: translateX(-50%) rotate(360deg); } }

.login-logo { position: relative; text-align: center; margin-top: 4px; }
.logo-skin { display: block; max-width: 240px; max-height: 120px; margin: 0 auto; }
.logo-mascotas { position: relative; width: 104px; height: 64px; margin: 0 auto; }
.logo-mascotas > * { position: absolute; width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0, 50, 100, .3)); }
.logo-mascotas > :first-child { left: 2px; top: 2px; animation: temblor-logo 5s ease-in-out infinite 1.2s; }
.logo-mascotas > :last-child { right: 2px; top: 0; transform: scaleX(-1); }
@keyframes temblor-logo {
  0%, 12%, 100% { transform: translate(0, 0) rotate(0); }
  2% { transform: translate(-3px, 1px) rotate(-6deg); }
  4% { transform: translate(3px, -1px) rotate(5deg); }
  6% { transform: translate(-3px, 0) rotate(-4deg); }
  8% { transform: translate(2px, 1px) rotate(3deg); }
  10% { transform: translate(-1px, 0) rotate(-1deg); }
}

.marca {
  margin: 2px 0 0;
  font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -1px;
  color: var(--marca-color);
  text-shadow: var(--marca-sombra);
}
.marca-app { color: var(--marca-app-color); }
.lema { margin: 4px 0 0; color: var(--lema-color); font-size: 14px; font-style: italic; }

.login-centro {
  position: relative;
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center;
  margin: auto 0;
  padding: 14px 0;
}
.login-centro .marco { margin-bottom: -26px; z-index: 2; }
.login-caja { width: 100%; padding: 40px 18px 16px; }
.login-paso { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.login-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; font-size: 13.5px; color: var(--login-texto); }
.selector-estado {
  display: inline-flex; align-items: center;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 4px;
  background: transparent; font-size: 13.5px; font-weight: 600; color: var(--login-texto);
}
.selector-estado:hover, .selector-estado:focus-visible { border-color: var(--seleccion-borde); background: var(--seleccion); outline: none; }
.selector-estado::after { content: ''; margin-left: 6px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.check { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--login-texto); }
.check input { width: 16px; height: 16px; accent-color: var(--foco); margin: 0; }
.dialogo .check { color: var(--ventana-texto); }
.login-nota { margin: 0; font-size: 12px; color: var(--login-texto); opacity: .85; text-align: center; }
.login-texto { margin: 0; text-align: center; font-size: 14px; color: var(--login-texto); line-height: 1.45; word-break: break-all; }
.campo-codigo { text-align: center; font-size: 26px; letter-spacing: 10px; font-weight: 700; padding: 8px; }
.aviso-demo {
  margin: 0; padding: 5px 10px; border-radius: 20px;
  background: #fff6c8; border: 1px solid #f0d36a; color: #6b5200; font-size: 12px;
}
.iniciando { margin: 4px 0; font-size: 16px; color: var(--login-texto); font-weight: 600; }
.puntos i { font-style: normal; animation: punto 1.2s infinite; opacity: 0; }
.puntos i:nth-child(2) { animation-delay: .2s; }
.puntos i:nth-child(3) { animation-delay: .4s; }
@keyframes punto { 0%, 20% { opacity: 0; } 40%, 100% { opacity: 1; } }
.login-error { margin: 10px 0 0; color: var(--error); font-size: 13px; text-align: center; font-weight: 600; }
.login-error:empty { display: none; }
.login-pie { position: relative; padding: 6px 0 max(env(safe-area-inset-bottom), 6px); }
.login-pie .enlace { color: var(--login-pie-texto); text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }

/* Animación de inicio de sesión: dos mascotas girando dentro del marco */
.orbita {
  position: absolute; inset: var(--p);
  border-radius: var(--r);
  display: none; place-items: center;
  background: var(--orbita-fondo);
  overflow: hidden;
}
.orbita i {
  position: absolute; left: 50%; top: 50%;
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  background-size: contain; background-repeat: no-repeat; background-position: center;
  animation: orbitar 1.5s linear infinite;
}
.orbita .m2 { animation-delay: -.75s; }
.marco.cargando .orbita { display: grid; }
.marco.cargando { animation: latido 1.5s ease-in-out infinite; }
@keyframes orbitar {
  0%    { transform: translate(32px, 0) scale(.76); z-index: 2; }
  12.5% { transform: translate(22.6px, 8.5px) scale(.93); z-index: 3; }
  25%   { transform: translate(0, 12px) scale(1); z-index: 3; }
  37.5% { transform: translate(-22.6px, 8.5px) scale(.93); z-index: 3; }
  50%   { transform: translate(-32px, 0) scale(.76); z-index: 2; }
  62.5% { transform: translate(-22.6px, -8.5px) scale(.6); z-index: 1; }
  75%   { transform: translate(0, -12px) scale(.52); z-index: 1; }
  87.5% { transform: translate(22.6px, -8.5px) scale(.6); z-index: 1; }
  100%  { transform: translate(32px, 0) scale(.76); z-index: 2; }
}
@keyframes latido {
  0%, 100% { box-shadow: 0 1px 4px rgba(0, 40, 80, .35), 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 1px 4px rgba(0, 40, 80, .35), 0 0 22px 4px rgba(255, 255, 255, .9); }
}

/* ══════════════════ LISTA DE CONTACTOS ══════════════════ */
#p-lista { background: var(--lista-fondo); }

.escena, .chat-cabecera {
  position: relative;
  background: var(--img-escena) center / cover no-repeat, var(--escena-fondo);
  color: var(--escena-texto);
}
.escena { padding: max(env(safe-area-inset-top), 14px) 12px 16px; overflow: hidden; }
.escena::before {
  content: ''; position: absolute; left: -10%; right: -10%; bottom: -30px; height: 70px;
  border-radius: 50%;
  background: var(--escena-brillo);
  opacity: .8;
}
.escena::after, .chat-cabecera::after {
  content: ''; position: absolute; inset: 0 0 auto; height: 48%;
  background: linear-gradient(var(--escena-brillo), transparent);
  pointer-events: none;
}
.yo { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.yo-datos { flex: 1; min-width: 0; }
.yo-linea { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.yo-nick, .yo-estado, .yo-mensaje {
  border: 1px solid transparent; border-radius: 4px; background: none; color: var(--escena-texto); text-align: left;
  padding: 1px 4px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.yo-nick { font-size: 18px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .35); min-width: 0; }
.yo-estado { flex: none; font-size: 13px; opacity: .95; }
.yo-estado::after { content: ''; display: inline-block; margin-left: 5px; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.yo-mensaje { display: block; font-size: 13.5px; font-style: italic; opacity: .95; margin-top: 2px; }
.yo-mensaje.vacio { opacity: .7; }
.yo-nick:hover, .yo-estado:hover, .yo-mensaje:hover,
.yo-nick:focus-visible, .yo-estado:focus-visible, .yo-mensaje:focus-visible { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .14); outline: none; }
.yo-nick .emo, .yo-mensaje .emo { width: 19px; height: 19px; }

.icono-btn { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); display: grid; place-items: center; }
.icono-btn svg { width: 20px; height: 20px; fill: var(--escena-texto); }
.icono-btn:active { background: rgba(255, 255, 255, .3); }

.buscador {
  display: flex; gap: 8px; padding: 9px 10px;
  background: var(--buscador-fondo);
  border-bottom: 1px solid var(--buscador-borde);
}
.buscador .campo { padding: 8px 10px; font-size: 14px; }

.lista { flex: 1; overflow-y: auto; padding: 4px 4px max(env(safe-area-inset-bottom), 16px); }

.grupo-cab {
  display: flex; align-items: center; gap: 6px; width: 100%;
  margin-top: 6px; padding: 6px 8px;
  border: 0; background: none; text-align: left;
  font-size: 13px; font-weight: 700; color: var(--grupo-texto);
}
.grupo-cab .cuenta { font-weight: 400; color: var(--texto-tenue); }
.grupo-cab .tri { width: 0; height: 0; border: 5px solid transparent; border-top-color: currentColor; border-bottom-width: 0; transition: transform .2s; opacity: .8; }
.grupo-cab.plegado .tri { transform: rotate(-90deg); }
.grupo-vacio { padding: 2px 14px 8px 28px; font-size: 12.5px; color: var(--texto-tenue); font-style: italic; }

.contacto {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 6px 10px; margin: 1px 0;
  border: 1px solid transparent; border-radius: 4px;
  background: none; text-align: left;
  user-select: none; -webkit-user-select: none;
}
.contacto:hover, .contacto:focus-visible { border-color: var(--seleccion-borde); background: var(--seleccion); outline: none; }
.contacto:active { border-color: var(--pulsado-borde); background: var(--pulsado); }
.c-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.c-nick, .c-pm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-nick { font-size: 15px; color: var(--nick-texto); }
.c-est { color: var(--texto-suave); font-size: 13px; }
.c-pm { font-size: 12.5px; color: var(--texto-suave); margin-top: 1px; }
.c-nick .emo { width: 18px; height: 18px; vertical-align: -4px; }
.c-pm .emo { width: 16px; height: 16px; vertical-align: -3px; }
.contacto.fuera .c-nick { color: var(--texto-suave); }
.contacto.fuera .marco-img { filter: grayscale(.85) opacity(.75); }

/* Contacto con mensajes sin leer: parpadea como la barra de tareas de antes */
.contacto.parpadea { animation: parpadeo 1s ease-in-out infinite; border-color: var(--parpadeo-borde); }
.contacto.parpadea .c-nick { font-weight: 700; }
@keyframes parpadeo {
  0%, 100% { background: var(--parpadeo-1); }
  50% { background: var(--parpadeo-2); }
}

/* ══════════════════ CONVERSACIÓN ══════════════════ */
.pantalla-chat {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column;
  background: var(--img-chat) center / cover no-repeat, var(--chat-fondo);
  transform: translateX(104%);
  transition: transform .32s cubic-bezier(.2, .8, .25, 1);
  box-shadow: -6px 0 18px rgba(0, 30, 60, .25);
}
.pantalla-chat.abierta { transform: none; }

.chat-cabecera {
  display: flex; align-items: center; gap: 8px;
  padding: max(env(safe-area-inset-top), 10px) 10px 10px 4px;
}
.volver { position: relative; z-index: 1; width: 38px; height: 40px; border: 0; background: none; display: grid; place-items: center; border-radius: 50%; }
.volver svg { width: 24px; height: 24px; stroke: var(--escena-texto); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.volver:active { background: rgba(255, 255, 255, .25); }
.chat-cabecera .marco { z-index: 1; }
.chat-titulo { flex: 1; min-width: 0; position: relative; z-index: 1; }
.chat-nick { font-size: 16.5px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, .35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-nick .est { font-weight: 400; font-size: 13px; opacity: .9; }
.chat-pm { font-size: 12.5px; font-style: italic; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-nick .emo { width: 18px; height: 18px; vertical-align: -4px; }
.chat-pm .emo { width: 15px; height: 15px; vertical-align: -3px; }

.chat-cuerpo {
  flex: 1; overflow-y: auto;
  margin: 8px 8px 0;
  padding: 10px 12px;
  background: var(--conversacion-fondo);
  border: 1px solid var(--conversacion-borde);
  border-radius: 6px;
  box-shadow: inset 0 1px 3px rgba(0, 40, 80, .08);
  overflow-wrap: anywhere;
}
.bloque { margin-bottom: 8px; }
.quien { font-size: 13px; color: var(--quien-texto); margin-bottom: 1px; }
.quien .emo { width: 16px; height: 16px; vertical-align: -3px; }
.linea { padding-left: 14px; font-size: 15px; line-height: 1.4; color: var(--conversacion-texto); }
.bloque.mio .linea { color: var(--mio-texto); }
.emo { width: 22px; height: 22px; vertical-align: -5px; }

.sistema {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 6px 0 10px;
  font-size: 13px; color: var(--sistema-texto); line-height: 1.35;
}
.sistema img.ico { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.sistema .emo { width: 16px; height: 16px; vertical-align: -3px; }
.sistema.zumbido-linea { font-weight: 700; color: var(--zumbido-texto); }
.sistema.zumbido-linea img.ico { width: 22px; height: 22px; margin-top: -3px; object-fit: contain; }
.chat-vacio { margin: 18% 10px 0; text-align: center; color: var(--texto-tenue); font-size: 13.5px; line-height: 1.5; }
.chat-vacio > img { width: 56px; height: 56px; display: block; margin: 0 auto 8px; opacity: .9; object-fit: contain; }
.chat-vacio .emo { width: 18px; height: 18px; vertical-align: -4px; }

.chat-estado {
  min-height: 22px;
  margin: 0 8px;
  padding: 3px 6px;
  font-size: 12px; color: var(--barra-estado-texto);
  background: var(--barra-estado-fondo);
  border: 1px solid var(--conversacion-borde); border-top: 0;
  border-radius: 0 0 6px 6px;
  display: flex; align-items: center; gap: 5px;
  overflow: hidden; white-space: nowrap;
}
.chat-estado span { overflow: hidden; text-overflow: ellipsis; }
.chat-estado img.ico { width: 14px; height: 14px; flex: none; }
.chat-estado .emo { width: 14px; height: 14px; vertical-align: -3px; }

.chat-pie { padding: 6px 8px max(env(safe-area-inset-bottom), 8px); }
.chat-barra { display: flex; gap: 4px; margin-bottom: 6px; }
.herramienta {
  height: 34px; min-width: 40px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid transparent; border-radius: 4px; background: none;
  color: var(--texto-suave);
}
.herramienta:hover, .herramienta:focus-visible { border-color: var(--seleccion-borde); background: var(--seleccion); outline: none; }
.herramienta:active, .herramienta.activa { border-color: var(--pulsado-borde); background: var(--pulsado); }
.herramienta img { width: 24px; height: 24px; object-fit: contain; }
.herramienta::after { content: ''; border: 3.5px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
#btn-zumbido::after { display: none; }
#btn-zumbido img { width: 28px; height: 28px; }

.chat-escribir { display: flex; gap: 6px; align-items: flex-end; }
#in-msg {
  flex: 1; resize: none;
  min-height: 42px; max-height: 120px;
  padding: 10px 10px;
  border: 1px solid var(--campo-borde); border-radius: var(--radio);
  background: var(--campo-fondo); color: var(--campo-texto); outline: none;
  font-size: 15px; line-height: 1.35;
  box-shadow: inset 0 1px 2px rgba(0, 30, 60, .1);
}
#in-msg:focus { border-color: var(--foco); }
#btn-enviar { height: 42px; }

.panel-emo {
  position: absolute; left: 8px; right: 8px; bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 3;
  max-height: 45%; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 2px;
  padding: 8px;
  animation: aparecer .16s ease-out;
}
.panel-emo button { height: 44px; border: 1px solid transparent; border-radius: 5px; background: none; display: grid; place-items: center; }
.panel-emo button:hover, .panel-emo button:focus-visible { border-color: var(--seleccion-borde); background: var(--seleccion); outline: none; }
.panel-emo img { width: 28px; height: 28px; object-fit: contain; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }

/* ── ¡Zumbido! ─────────────────────────────────────────────────────── */
#app.zumbando { animation: zumbido .75s linear; }
@keyframes zumbido {
  0%, 100% { transform: translate(0, 0); }
  8% { transform: translate(-9px, 5px); }
  16% { transform: translate(8px, -6px); }
  24% { transform: translate(-10px, -3px); }
  32% { transform: translate(9px, 6px); }
  40% { transform: translate(-7px, 7px); }
  48% { transform: translate(10px, -4px); }
  56% { transform: translate(-8px, -7px); }
  64% { transform: translate(7px, 5px); }
  72% { transform: translate(-6px, 3px); }
  80% { transform: translate(5px, -4px); }
  90% { transform: translate(-3px, 2px); }
}

/* ══════════════════ AVISOS (ventanitas que suben) ══════════════════ */
.avisos {
  position: absolute; z-index: 50;
  right: 10px; left: 10px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
body.en-chat .avisos { bottom: calc(110px + env(safe-area-inset-bottom)); }
.aviso {
  pointer-events: auto; cursor: pointer;
  width: min(290px, 100%);
  border: 1px solid var(--ventana-borde); border-radius: 7px;
  background: var(--ventana-fondo);
  box-shadow: 0 8px 22px rgba(0, 30, 60, .35);
  overflow: hidden;
  animation: subir-aviso .4s cubic-bezier(.2, .9, .3, 1.15);
}
.aviso.saliendo { animation: bajar-aviso .3s ease-in forwards; }
.aviso-barra {
  display: flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 4px 0 7px;
  background: var(--titulo-fondo);
  color: var(--titulo-texto); font-size: 12px; font-weight: 600; text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
}
.aviso-barra img { width: 16px; height: 16px; object-fit: contain; }
.aviso-barra span { flex: 1; }
.aviso-x { width: 22px; height: 18px; border: 0; border-radius: 3px; background: rgba(255, 255, 255, .15); color: var(--titulo-texto); font-size: 15px; line-height: 1; padding: 0; }
.aviso-cuerpo { display: flex; align-items: center; gap: 10px; padding: 10px; }
.aviso-txt { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; color: var(--ventana-texto); overflow-wrap: anywhere; }
.aviso-txt .emo { width: 16px; height: 16px; vertical-align: -3px; }
@keyframes subir-aviso { from { transform: translateY(120%); opacity: 0; } }
@keyframes bajar-aviso { to { transform: translateY(120%); opacity: 0; } }

/* ══════════════════ MENÚS Y DIÁLOGOS ══════════════════ */
.capa { position: absolute; inset: 0; z-index: 60; }
.menu {
  position: absolute; min-width: 210px; max-width: calc(100% - 16px);
  padding: 4px;
  background: var(--menu-fondo);
  color: var(--ventana-texto);
  border: 1px solid var(--ventana-borde); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 30, 60, .3);
  animation: aparecer .14s ease-out;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 1px solid transparent; border-radius: 4px;
  background: none; text-align: left; font-size: 14.5px;
}
.menu button:hover, .menu button:focus-visible { border-color: var(--seleccion-borde); background: var(--seleccion); outline: none; }
.menu button.marcado { font-weight: 700; }
.menu hr { border: 0; border-top: 1px solid var(--separador); margin: 4px 6px; }

.velo {
  position: absolute; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--velo);
  animation: fundido .2s ease-out;
}
@keyframes fundido { from { opacity: 0; } }
.dialogo {
  width: min(360px, 100%);
  max-height: 100%; overflow: auto;
  border: 1px solid var(--ventana-borde); border-radius: 9px;
  background: var(--ventana-fondo);
  color: var(--ventana-texto);
  box-shadow: 0 14px 40px rgba(0, 20, 50, .45);
  animation: aparecer .2s ease-out;
}
.dialogo h2 {
  margin: 0; padding: 9px 14px;
  font-size: 15px; font-weight: 600; color: var(--titulo-texto);
  background: var(--titulo-fondo);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, .3);
}
.dialogo-cuerpo { padding: 14px; font-size: 14px; line-height: 1.5; }
.dialogo-cuerpo p { margin: 0 0 10px; }
.dialogo-cuerpo .ayuda { font-size: 12.5px; color: var(--texto-suave); margin: 8px 0 0; }
.dialogo-cuerpo .ayuda .emo { width: 16px; height: 16px; vertical-align: -3px; }
.dialogo-botones { display: flex; justify-content: flex-end; gap: 8px; padding: 0 14px 14px; }

.rejilla-av { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center; }
.rejilla-av button { border: 0; background: none; padding: 0; }
.rejilla-av .marco { --t: 56px; }
.rejilla-av .elegido .marco { outline: 3px solid var(--foco); outline-offset: 2px; }
.boton-foto { margin-top: 14px; width: 100%; }

/* Ajustes de sonido */
.lista-sonidos, .lista-skins { margin-top: 10px; border-top: 1px solid var(--separador); }
.fila-sonido {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 10px 0; border-bottom: 1px solid var(--separador);
}
.fs-texto { flex: 1 1 100%; min-width: 0; display: flex; flex-direction: column; }
.fs-texto b { font-size: 14px; }
.fs-origen { font-size: 12.5px; color: var(--texto-suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-origen.propio { color: var(--exito); font-weight: 600; }
.fs-botones { display: flex; gap: 6px; }
.boton-aero.chico { padding: 5px 10px; font-size: 13px; min-height: 32px; }
.boton-aero.chico svg { width: 14px; height: 14px; fill: var(--boton-icono); stroke: none; display: block; }
.fs-error, .sk-error { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--error); font-weight: 600; }
.fs-error:empty, .sk-error:empty { display: none; }

/* Denunciar y bloqueados */
.motivos { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 10px; }
.motivos label { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 4px; font-size: 14px; }
.motivos label:has(input:checked) { background: var(--seleccion); }
.motivos input { width: 17px; height: 17px; margin: 0; accent-color: var(--foco); flex: none; }
.campo-largo { min-height: 72px; resize: vertical; font-size: 14px; margin-bottom: 8px; }
.lista-bloqueados { border-top: 1px solid var(--separador); }
.fila-bloqueado { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--separador); }
.fila-bloqueado .fs-texto { flex: 1 1 auto; }
.check a { color: var(--enlace); }
.chat-cabecera .icono-btn { position: relative; z-index: 1; }

/* Selector de skins */
.fila-skin {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--separador);
}
.sk-muestra {
  flex: none; width: 54px; height: 72px; border-radius: 7px; overflow: hidden;
  display: grid; grid-template-rows: 26px 1fr 12px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 2px 5px rgba(0, 0, 0, .2);
}
.sk-muestra i { display: block; background-size: cover; background-position: center; }
.sk-muestra i:last-child { margin: 0 8px 3px; border-radius: 3px; }
.sk-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sk-texto b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-texto span { font-size: 12.5px; color: var(--texto-suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-botones { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.sk-en-uso { font-size: 12.5px; font-weight: 700; color: var(--exito); text-align: center; padding: 6px 4px; }
.boton-instalar { margin-top: 12px; width: 100%; }

/* ══════════════════ INSTALAR EN LA PANTALLA DE INICIO ══════════════════ */
.instalar {
  position: relative;
  width: 100%; max-width: 340px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 34px 10px 10px; margin-bottom: 4px;
  animation: aparecer .3s ease-out;
}
.instalar-icono { width: 44px; height: 44px; border-radius: 11px; flex: none; box-shadow: 0 2px 6px rgba(0, 40, 80, .3); }
.instalar-texto { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; line-height: 1.35; color: var(--login-texto); }
.instalar-x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; background: none; color: var(--login-texto); font-size: 18px; line-height: 1; opacity: .7;
}
.pasos-instalar { margin: 0; padding: 0; list-style: none; counter-reset: paso; display: flex; flex-direction: column; gap: 12px; }
.pasos-instalar li { counter-increment: paso; display: flex; gap: 10px; align-items: flex-start; }
.pasos-instalar li::before {
  content: counter(paso); flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--primario-fondo); color: var(--primario-texto);
}
.icono-ios { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; margin: 0 2px; }
.icono-ios path, .icono-ios rect { fill: none; stroke: #1a7bd3; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Aviso «Activa las notificaciones» encima de la lista */
.banner-notif {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 34px 9px 12px;
  background: var(--seleccion);
  border-bottom: 1px solid var(--buscador-borde);
  animation: aparecer .3s ease-out;
}
.banner-notif-icono { width: 30px; height: 30px; flex: none; }
.banner-notif-texto { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; line-height: 1.35; color: var(--texto); }
.banner-notif .instalar-x { color: var(--texto-suave); }

/* ══════════════════ TABLET Y PANTALLAS ANCHAS ══════════════════
   Lista de contactos a la izquierda y conversación a la derecha, a la vez
   (como el programa de ordenador de antes). En el móvil no cambia nada. */
.chat-ninguno { display: none; }
.contacto.activo { border-color: var(--pulsado-borde); background: var(--pulsado); }

@media (min-width: 760px) {
  #app { max-width: 1180px; --ancho-lista: clamp(320px, 38%, 400px); }
  #p-lista { right: auto; width: var(--ancho-lista); border-right: 1px solid var(--separador); }

  .pantalla-chat {
    left: var(--ancho-lista);
    transform: none; transition: none; box-shadow: none;
    z-index: 5;
  }
  #app:not(.dentro) .pantalla-chat { display: none; }
  .volver { display: none; }
  .chat-cabecera { padding-left: 14px; }
  .chat-cuerpo, .chat-estado { margin-left: 14px; margin-right: 14px; }
  .chat-pie { padding-left: 14px; padding-right: 14px; }
  .panel-emo { left: 14px; right: auto; width: min(420px, calc(100% - 28px)); }

  /* Sin conversación abierta: un panel de bienvenida en lugar del chat */
  .pantalla-chat:not(.abierta) > * { display: none; }
  .pantalla-chat:not(.abierta) > .chat-ninguno {
    display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    padding: 24px; text-align: center; color: var(--texto-suave);
  }
  .chat-ninguno-mascotas { position: relative; width: 150px; height: 92px; }
  .chat-ninguno-mascotas img { position: absolute; top: 0; width: 90px; height: 90px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 40, 80, .25)); }
  .chat-ninguno-mascotas img:first-child { left: 0; }
  .chat-ninguno-mascotas img:last-child { right: 0; transform: scaleX(-1); }
  .chat-ninguno b { font-size: 18px; color: var(--texto); }
  .chat-ninguno p { margin: 0; max-width: 340px; line-height: 1.5; font-size: 14px; }

  .avisos { left: auto; width: 300px; bottom: calc(110px + env(safe-area-inset-bottom)); }
  body.en-chat .avisos { bottom: calc(110px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .rayos, .burbuja, .logo-mascotas > * { animation: none; }
}
