.boton-whatsapp,
.boton-compartir-superior {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #59595e;
  border-radius: 50%;
  background: #151515;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.boton-whatsapp { text-decoration: none; }
.boton-whatsapp svg,
.boton-compartir-superior svg { width: 22px; height: 22px; display: block; }
.boton-whatsapp svg { display: none; }
.boton-whatsapp::before {
  content: "";
  width: 22px;
  height: 22px;
  background: url("whatsapp.svg") center / contain no-repeat;
}
.boton-whatsapp:hover,
.boton-compartir-superior:hover { background: #3b3b3f; }
.boton-whatsapp:focus-visible,
.boton-compartir-superior:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
[data-tema="dia"] .boton-whatsapp,
[data-tema="dia"] .boton-compartir-superior {
  background: #252527;
  border-color: #252527;
  color: #f5f5f7;
}
[data-tema="dia"] .boton-whatsapp:hover,
[data-tema="dia"] .boton-compartir-superior:hover { background: #3b3b3f; }
[data-tema="dia"] .boton-whatsapp::before { filter: brightness(0) invert(1); }
[data-tema="noche"] .boton-whatsapp,
[data-tema="noche"] .boton-compartir-superior {
  background: #eeeef0;
  border-color: #59595e;
  color: #151515;
}
[data-tema="noche"] .boton-whatsapp:hover,
[data-tema="noche"] .boton-compartir-superior:hover { background: #fff; }
.compartir-superior-wrap,
.whatsapp-superior-wrap {
  display: none;
  position: relative;
  flex: none;
}
.estado-compartir:not(:empty) {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 8px;
  background: #151515;
  color: #fff;
  white-space: nowrap;
  font: 600 .875rem/1.4 system-ui, sans-serif;
}
.barra-tema-inferior {
  justify-content: flex-end;
  gap: 0;
}

/* En dispositivos táctiles, WhatsApp y compartir quedan arriba. */
@media (hover: none) and (pointer: coarse) {
  .compartir-superior-wrap,
  .whatsapp-superior-wrap { display: inline-flex; }
  .barra-tema-inferior {
    justify-content: flex-end;
    padding-inline-start: 0;
    padding-inline-end: max(6%, calc(env(safe-area-inset-right) + 44px));
  }

  /* El WhatsApp inferior se convierte en control superior en móviles. */
  .barra-tema-inferior .boton-whatsapp { display: none; }
  .whatsapp-superior-wrap .boton-whatsapp {
    width: 40px;
    height: 40px;
    border: var(--borde-divisor, 1px solid rgb(255 255 255 / 55%));
    background: transparent;
  }
  .whatsapp-superior-wrap .boton-whatsapp::before {
    width: 17px;
    height: 17px;
  }
  .whatsapp-superior-wrap .boton-whatsapp:hover { background: transparent; }
  [data-tema="dia"] .whatsapp-superior-wrap .boton-whatsapp {
    border-color: #616161;
    color: #151515;
  }
  [data-tema="dia"] .whatsapp-superior-wrap .boton-whatsapp::before { filter: none; }
  [data-tema="noche"] .whatsapp-superior-wrap .boton-whatsapp {
    border-color: rgb(255 255 255 / 55%);
    color: #f5f5f7;
  }
  [data-tema="noche"] .whatsapp-superior-wrap .boton-whatsapp::before { filter: brightness(0) invert(1); }

  .compartir-superior-wrap .boton-compartir-superior {
    width: 40px;
    height: 40px;
    border: var(--borde-divisor, 1px solid rgb(255 255 255 / 55%));
    background: transparent;
  }
  .compartir-superior-wrap .boton-compartir-superior svg {
    width: 17px;
    height: 17px;
  }
  .compartir-superior-wrap .boton-compartir-superior:hover { background: transparent; }
  [data-tema="dia"] .compartir-superior-wrap .boton-compartir-superior {
    border-color: #616161;
    background: transparent;
    color: #151515;
  }
  [data-tema="noche"] .compartir-superior-wrap .boton-compartir-superior {
    border-color: rgb(255 255 255 / 55%);
    background: transparent;
    color: #f5f5f7;
  }
}
