/* ============================================================
   Wagents — Audio guía del configurador
   Estilos del botón por elemento, barra global y aviso.
   Usa los design tokens de styles.css (incluido .theme-dark).
   ============================================================ */

/* ---------------- Botón de escucha por elemento ---------------- */
.au-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; margin-left: 6px; vertical-align: -6px;
  border: none; border-radius: 50%; background: transparent;
  color: var(--ink-mute); cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.au-btn svg { width: 15px; height: 15px; }
.au-btn:hover { color: var(--blue); transform: scale(1.12); }
.au-btn:active { transform: scale(0.9); }
.au-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.au-btn[aria-pressed="true"] { color: var(--blue); }
.au-btn[aria-pressed="true"] svg { animation: au-pulse 1.1s ease-in-out infinite; }
@keyframes au-pulse { 50% { transform: scale(1.18); opacity: 0.7; } }

/* Audio guía silenciado: los botones quedan atenuados (no solo color) */
body.au-muted .au-btn { opacity: 0.35; }

/* Táctil: fila propia "Escuchar explicación" dentro de la card */
.au-btn--bloque {
  width: auto; height: auto; margin: 8px 0 0;
  display: inline-flex; align-items: center; gap: 7px;
  align-self: flex-start; padding: 8px 14px; min-height: 36px;
  border: 1px solid var(--line); border-radius: 100px;
  background: var(--bg-soft); color: var(--blue);
  font-family: "Space Grotesk", sans-serif; font-size: 12.5px; font-weight: 700;
}
.au-btn--bloque svg { width: 15px; height: 15px; }
.au-btn--bloque[aria-pressed="true"] {
  color: #fff; background: var(--blue); border-color: var(--blue);
}

/* ---------------- Elemento sonando ---------------- */
[data-au].is-au-on .cfg-mod__in,
[data-au].is-au-on .cfg-plan__in { box-shadow: 0 0 0 2px var(--blue-soft); }
.au-prog {
  position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px;
  border-radius: 2px; background: var(--blue); opacity: 0.55;
  transform: scaleX(var(--au-p, 0)); transform-origin: left;
  pointer-events: none;
}

/* ---------------- Barra de control global ---------------- */
.au-bar {
  position: fixed; left: 16px; bottom: var(--boot-bottom, 88px); z-index: 150;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 100px;
  background: var(--bg-card); box-shadow: var(--shadow-sm);
}
.au-bar__toggle {
  display: flex; align-items: center; gap: 7px;
  border: none; background: none; cursor: pointer;
  padding: 5px 8px; border-radius: 100px;
  font-family: "Space Grotesk", sans-serif; font-size: 12.5px; font-weight: 700;
  color: var(--blue);
}
.au-bar.is-off .au-bar__toggle { color: var(--ink-mute); }
.au-bar__toggle svg, .au-bar__stop svg { width: 16px; height: 16px; }
.au-bar__ico-on, .au-bar__ico-off { display: grid; place-items: center; }
.au-bar__ico-off, .au-bar.is-off .au-bar__ico-on { display: none; }
.au-bar.is-off .au-bar__ico-off { display: grid; }
.au-bar__toggle:focus-visible, .au-bar__stop:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.au-bar__status {
  font-size: 11.5px; color: var(--ink-mute); max-width: 190px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.au-bar__stop {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg-card); color: var(--ink); cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.au-bar__stop[hidden] { display: none; }
.au-bar__stop:hover { color: var(--blue); transform: scale(1.07); }
.au-bar.is-nudge { animation: au-nudge 0.4s ease; }
@keyframes au-nudge { 25% { transform: translateY(-4px); } 60% { transform: translateY(2px); } }

/* ---------------- Aviso de reproducción bloqueada ---------------- */
.au-notice {
  position: fixed; left: 16px; bottom: calc(var(--boot-bottom, 88px) + 52px); z-index: 165;
  display: flex; align-items: center; gap: 9px; text-align: left;
  max-width: min(330px, calc(100vw - 24px));
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-card); color: var(--ink); font-size: 13px; cursor: pointer;
  box-shadow: 0 14px 40px oklch(0.2 0.05 265 / 0.25);
  animation: au-in 0.25s ease;
}
.au-notice svg { width: 17px; height: 17px; color: var(--blue); flex: none; }
@keyframes au-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- Móvil y táctil ---------------- */
@media (hover: none) {
  .au-btn:not(.au-btn--bloque) { width: 30px; height: 30px; margin-left: 4px; }
  .au-btn:not(.au-btn--bloque) svg { width: 17px; height: 17px; }
  .au-btn:hover { transform: none; }
  .au-btn:not(.au-btn--bloque):hover { color: var(--ink-mute); }
  .au-btn:not(.au-btn--bloque)[aria-pressed="true"] { color: var(--blue); }
  .au-bar__stop:hover { transform: none; color: var(--ink); }
}
@media (max-width: 640px) {
  .au-bar { left: 12px; padding: 5px 6px; }
  .au-bar__txt, .au-bar__status { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .au-btn, .au-bar__stop { transition: none; }
  .au-btn[aria-pressed="true"] svg { animation: none; }
  .au-bar.is-nudge, .au-notice { animation: none; }
}
