/* Empiria Voice Studio: botón de silenciar, aviso y subtítulos de la web. */
.evs-root {
  --evs-accent: #111827;
  --evs-fg: #ffffff;
  position: fixed;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  font: 500 13px/1.3 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
.evs-root > * {
  pointer-events: auto;
}
/* Las reglas display de abajo no deben ganar al atributo hidden */
.evs-root[hidden],
.evs-root [hidden],
.evs-cc[hidden] {
  display: none !important;
}
.evs-pos-bottom-left {
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
}
.evs-pos-bottom-right {
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  flex-direction: row-reverse;
}
.evs-pos-top-left {
  left: max(16px, env(safe-area-inset-left, 0px));
  top: max(16px, env(safe-area-inset-top, 0px));
}
.evs-pos-top-right {
  right: max(16px, env(safe-area-inset-right, 0px));
  top: max(16px, env(safe-area-inset-top, 0px));
  flex-direction: row-reverse;
}

.evs-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--evs-fg);
  background: var(--evs-accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.evs-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26), 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}
.evs-toggle:focus-visible,
.evs-hint:focus-visible,
.evs-cc__stop:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--evs-accent) 45%, #ffffff);
  outline-offset: 2px;
}
.evs-toggle svg {
  width: 22px;
  height: 22px;
  grid-area: 1 / 1;
}
.evs-ic-off,
.evs-toggle.is-muted .evs-ic-on {
  display: none;
}
.evs-toggle.is-muted .evs-ic-off {
  display: block;
}
.evs-toggle.is-muted {
  opacity: 0.78;
}

/* Ecualizador mientras habla la voz */
.evs-eq {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 50%;
  background: var(--evs-accent);
}
.evs-eq i {
  display: block;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: currentColor;
  transform-origin: 50% 50%;
  animation: evs-eq 0.9s ease-in-out infinite;
}
.evs-eq i:nth-child(2) {
  animation-delay: -0.25s;
}
.evs-eq i:nth-child(3) {
  animation-delay: -0.5s;
}
.evs-eq i:nth-child(4) {
  animation-delay: -0.12s;
}
.evs-root.is-speaking .evs-toggle:not(.is-muted) .evs-eq {
  display: flex;
}
.evs-root.is-speaking .evs-toggle:not(.is-muted)::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--evs-accent);
  opacity: 0.5;
  animation: evs-ring 1.6s ease-out infinite;
}
@keyframes evs-eq {
  0%,
  100% {
    transform: scaleY(0.35);
  }
  50% {
    transform: scaleY(1);
  }
}
@keyframes evs-ring {
  from {
    transform: scale(1);
    opacity: 0.5;
  }
  to {
    transform: scale(1.35);
    opacity: 0;
  }
}

.evs-hint {
  border: 0;
  cursor: pointer;
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--evs-fg);
  background: var(--evs-accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  font: inherit;
  white-space: nowrap;
  animation: evs-in 0.3s ease both;
}
@keyframes evs-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Subtítulos */
.evs-cc {
  position: fixed;
  z-index: 2147481999;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: max-content;
  max-width: min(640px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  color: #ffffff;
  background: rgba(17, 24, 39, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font: 500 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  animation: evs-cc-in 0.25s ease both;
}
.evs-cc__text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.evs-cc__stop {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}
.evs-cc__stop:hover {
  background: rgba(255, 255, 255, 0.24);
}
.evs-cc__stop svg {
  width: 16px;
  height: 16px;
}
@keyframes evs-cc-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
/* Si el botón está abajo, los subtítulos suben para no taparlo en móvil */
@media (max-width: 600px) {
  .evs-cc {
    bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 56px);
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .evs-toggle,
  .evs-hint,
  .evs-cc {
    transition: none;
    animation: none;
  }
  .evs-eq i,
  .evs-root.is-speaking .evs-toggle:not(.is-muted)::after {
    animation: none;
  }
}
@media (forced-colors: active) {
  .evs-toggle,
  .evs-hint,
  .evs-cc {
    border: 1px solid CanvasText;
  }
}
@media print {
  .evs-root,
  .evs-cc {
    display: none !important;
  }
}
