/* ── XHub site-wide voice reader ───────────────────────────── */

.legal-reader-bar,
.voice-reader-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px auto 14px;
  max-width: 520px;
}

.voice-reader-float .voice-reader-bar {
  margin: 0;
  max-width: none;
  gap: 6px;
}

.legal-ctrl,
.voice-ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 46px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  background: color-mix(in srgb, currentColor 6%, transparent);
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.legal-ctrl:hover:not(:disabled),
.voice-ctrl:hover:not(:disabled) {
  background: color-mix(in srgb, currentColor 14%, transparent);
  transform: translateY(-1px);
}
.legal-ctrl:disabled,
.voice-ctrl:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.legal-ctrl.is-active,
.voice-ctrl.is-active {
  border-color: #ff2d2d;
  box-shadow: 0 0 0 2px color-mix(in srgb, #ff2d2d 35%, transparent);
}
.legal-ctrl--icon,
.voice-ctrl--icon { padding: 10px 14px; min-width: 46px; }
.legal-ctrl-ico,
.voice-ctrl-ico { font-size: 17px; line-height: 1; }

.legal-progress,
.voice-progress {
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  overflow: hidden;
  max-width: 420px;
  margin: 0 auto 8px;
}
.voice-reader-float .voice-progress {
  max-width: none;
  margin: 8px 0 0;
}
.legal-progress > i,
.voice-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ff2d2d, color-mix(in srgb, currentColor 80%, #ff2d2d));
  border-radius: 99px;
  transition: width 0.2s linear;
}

.legal-autoplay-prompt,
.voice-autoplay-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px auto 10px;
  padding: 18px 22px;
  max-width: 480px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, #ff2d2d 45%, transparent);
  background: color-mix(in srgb, #ff2d2d 8%, transparent);
  text-align: center;
  animation: voicePromptIn 0.45s ease-out;
}
.legal-autoplay-prompt.hidden,
.voice-autoplay-prompt.hidden { display: none; }
.legal-autoplay-prompt p,
.voice-autoplay-prompt p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.9;
}
.legal-autoplay-start,
.voice-autoplay-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-radius: 99px;
  border: 1px solid #ff2d2d;
  background: color-mix(in srgb, #ff2d2d 18%, transparent);
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}
.legal-autoplay-start:hover,
.voice-autoplay-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -10px #ff2d2d;
}

/* Floating widget (injected on most pages) */
.voice-reader-float {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99990;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  background: color-mix(in srgb, var(--vr-bg, #0d0d12) 88%, transparent);
  color: var(--vr-fg, #f2f2f7);
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  font-family: Inter, system-ui, sans-serif;
  animation: voiceFloatIn 0.35s ease-out;
}
[data-site-theme="light"] .voice-reader-float {
  --vr-bg: #f8f8fc;
  --vr-fg: #121218;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.18);
}

.voice-reader-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.voice-reader-float-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
}
.voice-reader-status {
  font-size: 11px;
  font-weight: 700;
  color: #ff2d2d;
  white-space: nowrap;
}
.voice-reader-status.is-live {
  animation: voicePulse 1.2s ease-in-out infinite;
}

/* Top banner when autoplay blocked */
.voice-reader-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99991;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, color-mix(in srgb, #ff2d2d 85%, #000), color-mix(in srgb, #ff2d2d 70%, #330000));
  color: #fff;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  animation: voiceBannerIn 0.4s ease-out;
}
.voice-reader-banner.hidden { display: none; }
.voice-reader-banner strong { font-weight: 900; }

/* Highlight sync */
.up-items li.up-chunk-reading,
.vr-chunk-reading {
  color: inherit;
  background: color-mix(in srgb, #ff2d2d 14%, transparent);
  border-radius: 10px;
  padding: 8px 10px 8px 6px;
  margin-left: -6px;
  box-shadow: inset 3px 0 0 #ff2d2d;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.up-card.up-reading,
.vr-section-reading {
  outline: 2px solid color-mix(in srgb, #ff2d2d 40%, transparent);
  outline-offset: 4px;
  border-radius: 12px;
}

@keyframes voicePromptIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes voiceFloatIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes voiceBannerIn {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes voicePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (max-width: 520px) {
  .voice-reader-float {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
  }
  .legal-ctrl span:not(.legal-ctrl-ico):not(.voice-ctrl-ico),
  .voice-ctrl span:not(.legal-ctrl-ico):not(.voice-ctrl-ico) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-autoplay-prompt,
  .voice-autoplay-prompt,
  .voice-reader-float,
  .voice-reader-banner { animation: none; }
  .up-items li.up-chunk-reading,
  .vr-chunk-reading { transition: none; }
  .voice-reader-status.is-live { animation: none; }
}
