/* 全局朗读控制条：暂停 / 重播 / 停止。只在有声音在放的时候出现。 */

.speech-transport {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(11, 17, 41, 0.16);
  border-radius: 999px;
  background: rgba(11, 17, 41, 0.94);
  color: #f4f5f8;
  font-size: 13px;
  line-height: 1.2;
  box-shadow: 0 14px 34px rgba(9, 12, 26, 0.28);
  backdrop-filter: blur(10px);
  animation: speech-transport-in 180ms ease-out;
}

.speech-transport[hidden] {
  display: none;
}

.speech-transport-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #63d29a;
  box-shadow: 0 0 0 0 rgba(99, 210, 154, 0.6);
  animation: speech-transport-pulse 1.6s ease-out infinite;
}

.speech-transport.is-paused .speech-transport-dot {
  background: #d5aa4f;
  animation: none;
}

.speech-transport-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.speech-transport-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.speech-transport-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  cursor: pointer;
  transition:
    background 140ms ease,
    transform 140ms ease;
}

.speech-transport-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.speech-transport-button:hover {
  background: rgba(255, 255, 255, 0.24);
}

.speech-transport-button:focus-visible {
  outline: 2px solid #9fe0bd;
  outline-offset: 2px;
}

.speech-transport-button:active {
  transform: scale(0.94);
}

.speech-transport-button.is-paused {
  background: #63d29a;
  color: #0b1129;
}

.speech-transport-button.is-ghost {
  background: transparent;
}

.speech-transport-button.is-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

@keyframes speech-transport-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes speech-transport-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 210, 154, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(99, 210, 154, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 210, 154, 0);
  }
}

@media (max-width: 640px) {
  .speech-transport {
    right: 10px;
    left: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    justify-content: space-between;
  }

  .speech-transport-label {
    max-width: none;
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .speech-transport,
  .speech-transport-dot {
    animation: none;
  }
}
