/* Copia de app/electron/companion.css (la mascota de Arky) para la web.
 * Si cambia la de la app, vuelve a copiarla y quita la línea de arkytex:// (textura del juego, solo existe en la app). */

/* =====================================================================
   Compañero de Arky: el cuerpo azul de la app con ojitos y dos cuernitos (las estrellas ✦).
   Lo usan el botón flotante (electron/bubble.html) y el chat nuevo de la app (src/Companion.tsx).

   Estructura (cada animación en su capa, para que ninguna reinicie a otra):
     .pal            entrada (una vez) y estados: .blink .sleep .unread .dragging .happy
                     y, como avatar del chat: .thinking .searching .writing .remember .sad .still
                     (con sus accesorios: .pal-think .pal-lens .pal-pencil .pal-sparks .pal-sweat)
       .pal-bob      respiración (o saltitos de emoción con aviso)
         .pal-hop    saltito al pasar el ratón
           .pal-horn ×2, .pal-body, .pal-face (ojos y mejillas), .pal-zz, .pal-dot
   Hacia dónde mira: variables --lx y --ly (−1…1) en .pal.
   ===================================================================== */

.pal {
  --pal-accent: #7ea6ff;
  --pal-accent-strong: #5b86f0;
  --pal-spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --lx: 0;
  --ly: 0;
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  animation: pal-pop 0.5s var(--pal-spring) both;
}

.pal-bob,
.pal-hop {
  position: absolute;
  inset: 0;
}

.pal-bob {
  animation: pal-breathe 3.6s ease-in-out 0.5s infinite;
}

.pal-hop {
  transition: transform 0.3s var(--pal-spring);
}

/* ---------- Cuerpo ---------- */
.pal-body {
  position: absolute;
  inset: 0;
  border-radius: 15px;
  background: radial-gradient(circle at 30% 22%, #4a62a3, #1d2539 72%);
  border: 1px solid rgba(126, 166, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(5, 6, 9, 0.55),
    0 0 10px rgba(91, 134, 240, 0.3),
    0 4px 10px -4px rgba(0, 0, 0, 0.7);
  transition:
    transform 0.3s var(--pal-spring),
    border-color 0.2s,
    box-shadow 0.3s;
}

/* Reflejo arriba */
.pal-body::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 3px;
  height: 12px;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent);
}

/* ---------- Cuernitos: las estrellas de Arky a los lados ---------- */
.pal-horn {
  position: absolute;
  top: -6px;
  width: 11px;
  height: 11px;
  fill: var(--pal-accent);
  filter: drop-shadow(0 0 3px rgba(126, 166, 255, 0.8));
  transform-origin: 50% 90%;
  z-index: 2;
  transition:
    transform 0.4s var(--pal-spring),
    opacity 0.3s;
}

.pal-horn.l {
  left: 3px;
  transform: rotate(-24deg);
  animation: pal-horn-l 4.2s ease-in-out infinite;
}

.pal-horn.r {
  right: 3px;
  transform: rotate(24deg);
  animation: pal-horn-r 4.2s ease-in-out 0.15s infinite;
}

/* ---------- Cara ---------- */
.pal-face {
  position: absolute;
  inset: 0;
  /* La cara se inclina un poco hacia donde mira */
  transform: translate(calc(var(--lx) * 1.5px), calc(var(--ly) * 1px));
  transition: transform 0.25s ease-out;
}

.pal-eye {
  position: absolute;
  top: 14px;
  width: 11px;
  height: 14px;
  box-sizing: border-box;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #dfe6ff);
  box-shadow: inset 0 -1px 2px rgba(29, 37, 57, 0.35);
  transform-origin: 50% 60%;
  overflow: hidden;
  transition:
    transform 0.09s ease-in,
    height 0.2s var(--pal-spring),
    top 0.2s var(--pal-spring),
    border-radius 0.2s,
    background 0.2s;
}

.pal-eye.l {
  left: 9px;
}

.pal-eye.r {
  right: 9px;
}

.pal-pupil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 8px;
  margin: -4px 0 0 -3.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #1b2440, #0b0f1c);
  transform: translate(calc(var(--lx) * 2.4px), calc(var(--ly) * 3px));
  transition:
    transform 0.18s ease-out,
    opacity 0.15s,
    width 0.2s,
    height 0.2s,
    margin 0.2s;
}

/* Brillitos en las pupilas */
.pal-pupil::before,
.pal-pupil::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: #fff;
}

.pal-pupil::before {
  width: 2.6px;
  height: 2.6px;
  left: 1px;
  top: 1px;
}

.pal-pupil::after {
  width: 1.3px;
  height: 1.3px;
  right: 1.2px;
  bottom: 1.6px;
  opacity: 0.85;
}

/* Mejillas sonrojadas */
.pal-blush {
  position: absolute;
  top: 28px;
  width: 7px;
  height: 3.5px;
  border-radius: 50%;
  background: #ff8fb0;
  opacity: 0;
  filter: blur(0.6px);
  transition: opacity 0.25s;
}

.pal-blush.l {
  left: 6px;
}

.pal-blush.r {
  right: 6px;
}

.pal-zz {
  position: absolute;
  right: -7px;
  top: -6px;
  font: 700 10px/1 'Segoe UI', sans-serif;
  color: #a9c0ff;
  opacity: 0;
  pointer-events: none;
}

/* Abajo a la derecha, para no tapar el cuernito */
.pal-dot {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6f97ff, var(--pal-accent-strong));
  box-shadow: 0 0 0 2px #14171d;
  transform: scale(0);
  transition: transform 0.35s var(--pal-spring);
  z-index: 3;
}

/* ---------- Estados ---------- */

/* Parpadeo */
.pal.blink .pal-eye {
  transform: scaleY(0.08);
}

/* Feliz (ratón encima): saltito, ojitos ^ ^ y sonrojo. Con .pal:hover o la clase .happy. */
.pal:hover .pal-hop,
.pal.happy .pal-hop {
  animation: pal-hop 0.5s var(--pal-spring);
}

.pal:hover .pal-body,
.pal.happy .pal-body {
  border-color: rgba(126, 166, 255, 0.75);
  box-shadow:
    0 0 0 1px rgba(5, 6, 9, 0.55),
    0 0 12px rgba(91, 134, 240, 0.45),
    0 6px 12px -5px rgba(0, 0, 0, 0.75);
}

.pal:hover .pal-eye,
.pal.happy .pal-eye {
  top: 16px;
  height: 7px;
  border-radius: 7px 7px 2px 2px;
  background: transparent;
  box-shadow: none;
  border-top: 2.4px solid #f4f6ff;
  transform: none;
}

.pal:hover .pal-pupil,
.pal.happy .pal-pupil {
  opacity: 0;
}

.pal:hover .pal-blush,
.pal.happy .pal-blush,
.pal.unread .pal-blush {
  opacity: 0.55;
}

.pal:hover .pal-horn.l,
.pal.happy .pal-horn.l {
  transform: rotate(-34deg) scale(1.12);
}

.pal:hover .pal-horn.r,
.pal.happy .pal-horn.r {
  transform: rotate(34deg) scale(1.12);
}

/* Sorprendido: mientras lo arrastras */
.pal.dragging .pal-bob,
.pal.dragging .pal-hop {
  animation: none;
}

.pal.dragging .pal-body {
  transform: scale(1.08) rotate(-4deg);
}

.pal.dragging .pal-eye {
  top: 12px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #dfe6ff);
  border-top: 0;
  transform: scale(1.08);
}

.pal.dragging .pal-pupil {
  opacity: 1;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
}

.pal.dragging .pal-blush {
  opacity: 0;
}

.pal.dragging .pal-horn.l {
  transform: rotate(-12deg) scale(1.15);
}

.pal.dragging .pal-horn.r {
  transform: rotate(12deg) scale(1.15);
}

/* Dormido (sin mover el ratón un rato; se despierta al pasarle el ratón) */
.pal.sleep:not(.unread):not(:hover) .pal-eye {
  top: 19px;
  height: 3px;
  border-radius: 0 0 5px 5px;
  background: transparent;
  box-shadow: none;
  border-bottom: 2px solid #c9d3f5;
}

.pal.sleep:not(.unread):not(:hover) .pal-pupil {
  opacity: 0;
}

.pal.sleep:not(.unread):not(:hover) .pal-horn {
  animation: none;
  opacity: 0.65;
}

.pal.sleep:not(.unread):not(:hover) .pal-horn.l {
  transform: rotate(-50deg);
}

.pal.sleep:not(.unread):not(:hover) .pal-horn.r {
  transform: rotate(50deg);
}

.pal.sleep:not(.unread):not(:hover) .pal-zz {
  animation: pal-zz 2.6s ease-in-out infinite;
}

/* Aviso: respondió mientras estaba oculto. Saltitos de emoción y el punto. */
.pal.unread:not(.dragging) .pal-bob {
  animation: pal-excited 1.6s ease-in-out infinite;
}

.pal.unread .pal-dot {
  transform: scale(1);
}

/* ---------- Mientras Arky responde (avatar del chat) ---------- */

/* Pensando: mira hacia arriba a la derecha, hacia la nubecita, cavilando */
.pal.thinking .pal-pupil {
  animation: pal-think 2.8s ease-in-out infinite;
}

.pal.thinking .pal-horn.l {
  animation: pal-horn-l 1.6s ease-in-out infinite;
}

.pal.thinking .pal-horn.r {
  animation: pal-horn-r 1.6s ease-in-out 0.2s infinite;
}

/* Buscando en internet: ojos algo entrecerrados que escanean de lado a lado */
.pal.searching .pal-eye {
  top: 16px;
  height: 11px;
}

.pal.searching .pal-pupil {
  animation: pal-scan 1.1s ease-in-out infinite;
}

.pal.searching .pal-horn {
  transition: none;
}

.pal.searching .pal-horn.l {
  transform: rotate(-14deg) scale(1.1);
  animation: none;
}

.pal.searching .pal-horn.r {
  transform: rotate(14deg) scale(1.1);
  animation: none;
}

/* Escribiendo: mira abajo y va "leyendo" lo que escribe */
.pal.writing .pal-pupil {
  animation: pal-read 1.5s linear infinite;
}

/* ---------- Accesorios de cada estado (solo el avatar del chat los pinta) ---------- */

/* Pensando: «nube viva», una nubecita de cinco bolitas que se inflan cada una a su ritmo, arriba a la
   derecha. Sin cadena de burbujas hasta la cabeza (se veía como una línea). Diseño: dev/mocks/mascota.html.
   Cada bolita: --x y --y (su centro, en px del dibujo de 44), --s (su tamaño), --t y --d (su ritmo) e --i (cuándo sale).
   Cabe en la ventana del botón flotante (84 × 84, la mascota en el centro). */
.pal-think {
  position: absolute;
  inset: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 2.5px rgba(126, 166, 255, 0.55));
  animation: pal-cloud-bob 3.2s ease-in-out infinite;
}

.pal-think i {
  position: absolute;
  left: calc(var(--x) * 1px - var(--s) * 0.5px);
  top: calc(var(--y) * 1px - var(--s) * 0.5px);
  width: calc(var(--s) * 1px);
  height: calc(var(--s) * 1px);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff, #e3e9ff 72%);
  animation:
    pal-cloud-in 0.45s var(--pal-spring) var(--i) both,
    pal-cloud-puff var(--t) ease-in-out var(--d) infinite;
}

.pal-think i:nth-child(1) {
  --x: 43;
  --y: -8;
  --s: 8;
  --t: 1.7s;
  --d: 0.5s;
  --i: 0s;
}

.pal-think i:nth-child(2) {
  --x: 48.5;
  --y: -11.5;
  --s: 10;
  --t: 2.2s;
  --d: 0.8s;
  --i: 0.08s;
}

.pal-think i:nth-child(3) {
  --x: 54;
  --y: -8.5;
  --s: 8;
  --t: 1.9s;
  --d: 0.6s;
  --i: 0.16s;
}

.pal-think i:nth-child(4) {
  --x: 47;
  --y: -5.5;
  --s: 7;
  --t: 2.5s;
  --d: 1s;
  --i: 0.04s;
}

.pal-think i:nth-child(5) {
  --x: 52;
  --y: -5;
  --s: 7;
  --t: 2.05s;
  --d: 0.7s;
  --i: 0.12s;
}

/* Buscando: una lupa que recorre de lado a lado */
.pal-lens {
  position: absolute;
  right: -9px;
  bottom: -7px;
  width: 17px;
  height: 17px;
  fill: rgba(126, 166, 255, 0.28);
  stroke: #dfe6ff;
  stroke-width: 2.6;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  animation: pal-lens 1.1s ease-in-out infinite;
  pointer-events: none;
}

/* Escribiendo: un lapicito que garabatea */
.pal-pencil {
  position: absolute;
  right: -8px;
  bottom: -6px;
  width: 15px;
  height: 15px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  transform-origin: 20% 80%;
  animation: pal-scribble 0.55s ease-in-out infinite;
  pointer-events: none;
}

/* Guardando en memoria: estrellitas que salen hacia arriba */
.pal-sparks {
  position: absolute;
  inset: -10px -10px auto -10px;
  height: 20px;
  pointer-events: none;
}

.pal-sparks svg {
  position: absolute;
  width: 8px;
  height: 8px;
  fill: #ffe38a;
  filter: drop-shadow(0 0 3px rgba(255, 220, 120, 0.9));
  opacity: 0;
  animation: pal-spark 1.4s ease-out infinite;
}

.pal-sparks svg:nth-child(1) {
  left: 2px;
  top: 8px;
}

.pal-sparks svg:nth-child(2) {
  left: 50%;
  margin-left: -4px;
  top: 0;
  animation-delay: 0.3s;
}

.pal-sparks svg:nth-child(3) {
  right: 2px;
  top: 8px;
  animation-delay: 0.6s;
}

/* Error: gotita de sudor */
.pal-sweat {
  position: absolute;
  right: 3px;
  top: 8px;
  width: 5px;
  height: 7px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, #bfe3ff, #6fb6ff);
  transform: rotate(-12deg);
  opacity: 0.9;
  pointer-events: none;
}

/* ---------- Caras de los estados nuevos ---------- */

/* Guardando en memoria y "listo": felices (mismos ojitos ^ ^ que al pasar el ratón) */
.pal.remember .pal-blush {
  opacity: 0.6;
}

/* Error: ojos tristes (párpado inclinado), mirada abajo y cuernitos caídos */
.pal.sad .pal-eye {
  top: 16px;
  height: 12px;
}

.pal.sad .pal-eye::after {
  content: '';
  position: absolute;
  left: -3px;
  right: -3px;
  top: -3px;
  height: 6px;
  background: #2c3a5f;
}

/* Párpados que bajan hacia fuera (más altos en el centro): pena, no enfado */
.pal.sad .pal-eye.l::after {
  transform: rotate(-16deg);
}

.pal.sad .pal-eye.r::after {
  transform: rotate(16deg);
}

.pal.sad .pal-pupil {
  transform: translate(0, 2.4px);
}

.pal.sad .pal-horn.l {
  transform: rotate(-48deg);
  opacity: 0.75;
}

.pal.sad .pal-horn.r {
  transform: rotate(48deg);
  opacity: 0.75;
}

/* Quieto (respuestas terminadas): sin animaciones, mirando al frente */
.pal.still,
.pal.still * {
  animation: none !important;
}

/* =====================================================================
   Mascota (Ajustes → Apariencia), aparte del tema. Diseño: dev/mocks/mascota.html.
     .pal.v-tema    vestida con un estilo: Moderno, metal oscuro; Clásico, piedra gris; Juego, redonda
                    dentro del aro del minimapa. En el Predeterminado es la de siempre.
     .pal.v-boton   sin cara: la estrella de Arky en un botón de ese estilo (también es el botón flotante
                    cuando la mascota está oculta en el chat).
   El estilo va en la propia mascota (data-style) y no en el tema de la interfaz, porque se elige aparte.
   Con su aro (.pal-ring) y su estrella (.pal-emblem). Todo va aquí (y no en src/skins/) porque el botón
   flotante es otra ventana que solo carga este archivo.
   Los aros redondos son círculos con border-radius, que salen suavizados (con degradados de corte
   seco el borde se veía pixelado).
   ===================================================================== */

.pal-ring,
.pal-emblem {
  display: none;
}

.pal[data-style='moderno'] {
  --pal-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .075 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --pal-frame: linear-gradient(180deg, #5a4d3a 0%, #2a241d 30%, #14110e 62%, #30291f 100%);
  --pal-face: radial-gradient(circle at 30% 22%, #3d3427, #14110d 70%);
  --pal-lid: #2c261d;
  --pal-white: radial-gradient(circle at 40% 35%, #fffcf3, #ece0c3);
  --pal-ring-face: linear-gradient(160deg, #f6dc8c 0%, #b48b3a 30%, #5e4416 58%, #d2a446 82%, #7a5a20 100%);
  --pal-inner: 0 0 #0000;
}

.pal:is([data-style='clasico'], [data-style='juego']) {
  --pal-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .075 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --pal-frame: linear-gradient(150deg, #c9c9c9 0%, #7a7a7a 18%, #3e3e3e 46%, #626262 72%, #262626 100%);
  --pal-face: radial-gradient(circle at 30% 22%, #424248, #141416 72%);
  --pal-lid: #2e2e33;
  --pal-white: radial-gradient(circle at 40% 35%, #ffffff, #dedede);
  --pal-ring-face: linear-gradient(150deg, #c9c9c9 0%, #7a7a7a 18%, #3e3e3e 46%, #626262 72%, #262626 100%);
  --pal-inner: inset 0 0 0 4px #000, inset 0 0 0 5px rgba(255, 255, 255, 0.07);
}

/* La cara y los accesorios, encima del aro */
.pal:is(.v-tema, .v-boton) .pal-face {
  z-index: 1;
}

.pal:is(.v-tema, .v-boton) :is(.pal-think, .pal-lens, .pal-pencil, .pal-sparks, .pal-sweat) {
  z-index: 3;
}

.pal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* ---------- Solo botón: sin cara, la estrella de Arky grande y centrada ---------- */
.pal.v-boton .pal-face,
.pal.v-boton .pal-horn {
  display: none;
}

.pal.v-boton .pal-emblem {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 44px;
  height: 44px;
  overflow: visible;
  fill: var(--pal-accent);
  filter: drop-shadow(0 0 4px rgba(126, 166, 255, 0.75));
  transition:
    filter 0.3s,
    opacity 0.3s;
}

.pal-emblem path {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition:
    transform 0.45s var(--pal-spring),
    fill 0.3s;
}

.pal.v-boton:hover .pal-emblem path,
.pal.v-boton.happy .pal-emblem path {
  transform: rotate(90deg) scale(1.08);
}

.pal.v-boton:hover .pal-emblem,
.pal.v-boton.happy .pal-emblem {
  filter: drop-shadow(0 0 7px rgba(126, 166, 255, 0.95));
}

.pal.v-boton.thinking .pal-emblem path {
  animation: pal-emb-spin 1.3s cubic-bezier(0.6, 0, 0.3, 1) infinite;
}

.pal.v-boton.writing .pal-emblem path {
  animation: pal-emb-pulse 0.8s ease-in-out infinite;
}

.pal.v-boton.searching .pal-emblem {
  opacity: 0.7;
}

.pal.v-boton.sad .pal-emblem {
  fill: #8b93a7;
  filter: none;
}

.pal.v-boton.sad .pal-emblem path {
  transform: rotate(16deg) scale(0.84);
}

.pal.v-boton.sad .pal-sweat {
  right: 8px;
  top: 7px;
}

.pal.v-boton.sleep:not(.unread):not(:hover) .pal-emblem {
  opacity: 0.4;
  filter: none;
}

/* ---------- Moderno y Clásico: estrellas, nube y aviso dorados ---------- */
.pal:is([data-style='moderno'], [data-style='clasico']):is(.v-tema, .v-boton) {
  --pal-accent: #f0cd6a;
  --pal-accent-strong: #c08f2a;
}

.pal:is([data-style='moderno'], [data-style='clasico']):is(.v-tema, .v-boton) .pal-horn {
  filter: drop-shadow(0 0 3px rgba(233, 189, 80, 0.85));
}

.pal:is([data-style='moderno'], [data-style='clasico']):is(.v-tema, .v-boton) .pal-think {
  filter: drop-shadow(0 0 2.5px rgba(233, 189, 80, 0.55));
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton .pal-emblem {
  filter: drop-shadow(0 0 3px rgba(233, 189, 80, 0.7));
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton:is(:hover, .happy) .pal-emblem {
  filter: drop-shadow(0 0 7px rgba(255, 214, 110, 0.95));
}

.pal:is([data-style='moderno'], [data-style='clasico'], [data-style='juego']):is(.v-tema, .v-boton) .pal-dot {
  background: linear-gradient(180deg, #ffe590, #c08f2a);
  box-shadow: 0 0 0 2px #000;
}

.pal:is([data-style='moderno'], [data-style='clasico'], [data-style='juego']):is(.v-tema, .v-boton) .pal-zz {
  color: #f0cd6a;
}

/* ---------- Moderno y Clásico, con el tema: aro del tema y cara oscura ---------- */
.pal:is([data-style='moderno'], [data-style='clasico']).v-tema .pal-body,
.pal:is([data-style='moderno'], [data-style='clasico']).v-tema:is(:hover, .happy) .pal-body {
  border: 1px solid #000;
  background: var(--pal-noise), var(--pal-face);
  box-shadow:
    var(--pal-inner),
    inset 0 0 12px rgba(0, 0, 0, 0.65),
    0 4px 10px -4px rgba(0, 0, 0, 0.85);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-tema:is(:hover, .happy) .pal-body {
  box-shadow:
    var(--pal-inner),
    inset 0 0 12px rgba(0, 0, 0, 0.65),
    0 0 14px rgba(233, 189, 80, 0.4),
    0 4px 10px -4px rgba(0, 0, 0, 0.85);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-tema .pal-body::before {
  left: 7px;
  right: 7px;
  top: 6px;
  height: 10px;
  background: linear-gradient(180deg, rgba(255, 240, 210, 0.1), transparent);
}

/* El aro: el degradado del marco solo se ve en el borde (máscara que excluye el interior) */
.pal:is([data-style='moderno'], [data-style='clasico']).v-tema .pal-body::after {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 4px;
  border-radius: inherit;
  pointer-events: none;
  background: var(--pal-noise), var(--pal-frame);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-tema .pal-eye,
.pal:is([data-style='moderno'], [data-style='clasico']).v-tema.dragging .pal-eye {
  background: var(--pal-white);
}

.pal[data-style='moderno'].v-tema .pal-pupil {
  background: radial-gradient(circle at 50% 45%, #2a1f10, #0c0803);
}

.pal[data-style='clasico'].v-tema .pal-pupil {
  background: radial-gradient(circle at 50% 45%, #26262b, #09090b);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-tema.sad .pal-eye::after {
  background: var(--pal-lid);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-tema.sleep:not(.unread):not(:hover) .pal-eye {
  border-bottom-color: #e6dcc3;
}

/* ---------- Moderno y Clásico, solo botón: redondo, con aro dorado (Moderno) o de piedra (Clásico) ----------
   El aro es un disco entero debajo y la cara, otro disco más pequeño encima: dos círculos con border-radius. */
.pal:is([data-style='moderno'], [data-style='clasico']).v-boton .pal-ring {
  display: block;
  inset: 1px;
  background: var(--pal-noise), var(--pal-ring-face);
  box-shadow:
    0 0 0 1px #000,
    0 4px 10px -3px rgba(0, 0, 0, 0.85);
  transition: box-shadow 0.3s;
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton:is(:hover, .happy) .pal-ring {
  box-shadow:
    0 0 0 1px #000,
    0 0 14px rgba(233, 189, 80, 0.45),
    0 4px 10px -3px rgba(0, 0, 0, 0.85);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton .pal-body,
.pal:is([data-style='moderno'], [data-style='clasico']).v-boton:is(:hover, .happy) .pal-body {
  inset: 5px;
  border: 0;
  border-radius: 50%;
  background: var(--pal-noise), var(--pal-face);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 9px rgba(0, 0, 0, 0.75);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton .pal-body::before {
  left: 7px;
  right: 7px;
  top: 3px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 240, 210, 0.12), transparent);
}

.pal:is([data-style='moderno'], [data-style='clasico']).v-boton.dragging :is(.pal-ring, .pal-body) {
  transform: scale(1.06);
}

/* ---------- Juego: dentro del aro de los botones del minimapa ----------
   El aro es la textura del juego (MiniMap-TrackingBorder, arkytex://t/minimap-border.png, en ::after).
   Debajo hay uno dibujado por si falta esa textura en la carpeta. */
.pal[data-style='juego']:is(.v-tema, .v-boton) .pal-ring {
  display: block;
  inset: -2px;
  z-index: 1;
  border: 5px solid;
  border-color: #f6dc8c #a87a26 #6e4b12 #d0a244;
  background: none;
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 1px #000;
  -webkit-mask: none;
  mask: none;
}

/* La textura: 64 px con el aro arriba a la izquierda; a 93 px su hueco queda centrado en la mascota */
.pal[data-style='juego']:is(.v-tema, .v-boton) .pal-ring::after {
  content: '';
  position: absolute;
  left: -10.7px;
  top: -9.3px;
  width: 93px;
  height: 93px;
}

.pal[data-style='juego']:is(.v-tema, .v-boton) .pal-body,
.pal[data-style='juego']:is(.v-tema, .v-boton):is(:hover, .happy) .pal-body {
  inset: 3px;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 -3px 7px rgba(0, 0, 0, 0.5);
}

.pal[data-style='juego']:is(.v-tema, .v-boton):is(:hover, .happy) .pal-body {
  box-shadow:
    inset 0 -3px 7px rgba(0, 0, 0, 0.5),
    0 0 14px 2px rgba(255, 209, 0, 0.5);
}

.pal[data-style='juego'].v-tema .pal-body::before {
  left: 8px;
  right: 8px;
  top: 4px;
  height: 11px;
  border-radius: 50% 50% 45% 45%;
}

/* Los cuernitos asoman por encima del aro */
.pal[data-style='juego'].v-tema .pal-horn {
  top: -9px;
}

.pal[data-style='juego'].v-tema .pal-horn.l {
  left: 0;
}

.pal[data-style='juego'].v-tema .pal-horn.r {
  right: 0;
}

/* Y la nube, un poco a la derecha para no pisar el cuernito */
.pal[data-style='juego'].v-tema .pal-think {
  translate: 2px 0;
}

.pal[data-style='juego'].v-boton .pal-body {
  background: radial-gradient(circle at 42% 36%, #242831, #050506 72%);
}

.pal[data-style='juego'].v-boton .pal-body::before {
  display: none;
}

.pal[data-style='juego']:is(.v-tema, .v-boton) .pal-dot {
  right: -5px;
  bottom: -5px;
}

/* ---------- Animaciones ---------- */

@keyframes pal-emb-spin {
  to {
    transform: rotate(90deg);
  }
}

@keyframes pal-emb-pulse {
  50% {
    transform: scale(0.84);
  }
}

@keyframes pal-cloud-in {
  from {
    transform: scale(0);
  }
}

@keyframes pal-cloud-puff {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: scale(1.13) translateY(-0.3px);
  }
}

@keyframes pal-cloud-bob {
  50% {
    transform: translate(0.6px, -1px);
  }
}

@keyframes pal-lens {
  0%,
  100% {
    transform: translateX(-26px) rotate(-8deg);
  }
  50% {
    transform: translateX(0) rotate(8deg);
  }
}

@keyframes pal-scribble {
  0%,
  100% {
    transform: translate(0, 0) rotate(0);
  }
  25% {
    transform: translate(-2px, 1px) rotate(-8deg);
  }
  50% {
    transform: translate(1px, 0) rotate(4deg);
  }
  75% {
    transform: translate(-1px, 1px) rotate(-4deg);
  }
}

@keyframes pal-spark {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.3) rotate(0);
  }
  35% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(30deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(0.6) rotate(80deg);
  }
}

@keyframes pal-think {
  0%,
  100% {
    transform: translate(2.2px, -3.2px);
  }
  45% {
    transform: translate(0.4px, -3.6px);
  }
  70% {
    transform: translate(2.6px, -2.6px);
  }
}

@keyframes pal-scan {
  0%,
  100% {
    transform: translate(-2.6px, 0.4px);
  }
  50% {
    transform: translate(2.6px, 0.4px);
  }
}

@keyframes pal-read {
  0% {
    transform: translate(-2.2px, 2.6px);
  }
  80% {
    transform: translate(2.2px, 2.8px);
  }
  100% {
    transform: translate(-2.2px, 2.6px);
  }
}

@keyframes pal-pop {
  from {
    transform: scale(0.5) translateY(6px);
    opacity: 0;
  }
}

@keyframes pal-breathe {
  50% {
    transform: translateY(-1.5px) scaleX(1.02) scaleY(0.985);
  }
}

@keyframes pal-hop {
  35% {
    transform: translateY(-4px) scaleY(1.04);
  }
  70% {
    transform: translateY(0) scaleY(0.96) scaleX(1.03);
  }
}

@keyframes pal-horn-l {
  0%,
  70%,
  100% {
    transform: rotate(-24deg);
  }
  78% {
    transform: rotate(-38deg);
  }
  86% {
    transform: rotate(-16deg);
  }
  93% {
    transform: rotate(-28deg);
  }
}

@keyframes pal-horn-r {
  0%,
  70%,
  100% {
    transform: rotate(24deg);
  }
  78% {
    transform: rotate(38deg);
  }
  86% {
    transform: rotate(16deg);
  }
  93% {
    transform: rotate(28deg);
  }
}

@keyframes pal-excited {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  15% {
    transform: translateY(-5px) rotate(-3deg);
  }
  30% {
    transform: translateY(0) scaleY(0.95);
  }
  42% {
    transform: translateY(-3px) rotate(3deg);
  }
}

@keyframes pal-zz {
  0% {
    opacity: 0;
    transform: translate(0, 4px) scale(0.7);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(5px, -8px) scale(1.1);
  }
}

/* Reducir movimiento (Ajustes o sistema): quieto */
html.rm .pal,
html.rm .pal *,
html.rm .pal *::before,
html.rm .pal *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

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