/* Voice mode's orb (voice.js): top right of the content column, every page. */

.lm-voice-slot {
  position: absolute;
  top: 30px;
  right: 32px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
.lm-voice-slot > * {
  pointer-events: auto;
}
.content-wrap:has(.content-chat) .lm-voice-slot {
  top: 14px;
  right: 18px;
}

.lm-voice-orb {
  --lm-voice-level: 0;
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lm-voice-orb:focus-visible {
  outline: 2px solid var(--lm-orange-500);
  outline-offset: 3px;
}

.lm-voice-orb-core {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0 8%, rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 70% 75%, var(--lm-orange-400), transparent 60%),
    conic-gradient(
      from 200deg,
      var(--lm-plum),
      var(--lm-orange-500),
      var(--lm-peach),
      var(--lm-indigo),
      var(--lm-plum)
    );
  box-shadow:
    0 2px 8px rgba(122, 29, 110, 0.28),
    inset 0 -3px 6px rgba(21, 0, 121, 0.25);
  transform: scale(calc(1 + var(--lm-voice-level) * 0.35));
  transition:
    transform 90ms linear,
    box-shadow 200ms ease;
  animation: lm-voice-breathe 4.5s ease-in-out infinite;
}
.lm-voice-orb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 132, 80, 0.45), transparent 70%);
  opacity: calc(var(--lm-voice-level) * 1.6);
  transform: scale(calc(1.1 + var(--lm-voice-level) * 0.9));
  pointer-events: none;
}
.lm-voice-orb:hover .lm-voice-orb-core {
  box-shadow:
    0 4px 14px rgba(122, 29, 110, 0.38),
    inset 0 -3px 6px rgba(21, 0, 121, 0.25);
}

.lm-voice-orb[data-state='connecting'] .lm-voice-orb-core {
  animation: lm-voice-spin 1.4s linear infinite;
  opacity: 0.8;
}
.lm-voice-orb[data-state='listening'] .lm-voice-orb-core,
.lm-voice-orb[data-state='speaking'] .lm-voice-orb-core {
  animation: lm-voice-swirl 6s linear infinite;
  box-shadow:
    0 0 0 3px rgba(255, 101, 35, 0.18),
    0 4px 16px rgba(122, 29, 110, 0.4);
}
.lm-voice-orb[data-state='working'] .lm-voice-orb-core {
  animation: lm-voice-swirl 1.6s linear infinite;
  box-shadow:
    0 0 0 3px rgba(21, 0, 121, 0.16),
    0 4px 16px rgba(21, 0, 121, 0.35);
}

@keyframes lm-voice-breathe {
  0%,
  100% {
    filter: saturate(0.9);
  }
  50% {
    filter: saturate(1.15) brightness(1.04);
  }
}
@keyframes lm-voice-swirl {
  to {
    filter: hue-rotate(360deg);
  }
}
@keyframes lm-voice-spin {
  to {
    rotate: 360deg;
  }
}

.lm-voice-panel {
  width: min(300px, calc(100vw - 32px));
  padding: 10px 12px;
  border: 1px solid var(--border, rgba(26, 24, 43, 0.1));
  border-radius: 16px;
  background: var(--surface, #fff);
  box-shadow: 0 10px 30px rgba(26, 24, 43, 0.14);
  font-size: 13px;
  color: var(--text);
}
.lm-voice-panel[hidden] {
  display: none;
}
.lm-voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lm-voice-status {
  flex: 1;
  font-weight: 500;
}
.lm-voice-btn {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border, rgba(26, 24, 43, 0.12));
  border-radius: 999px;
  background: var(--surface-2, #f5f0eb);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.lm-voice-btn[aria-pressed='true'] {
  background: var(--lm-orange-50);
  border-color: var(--lm-orange-300);
}
.lm-voice-end {
  background: var(--lm-ink);
  border-color: var(--lm-ink);
  color: #fff;
}
.lm-voice-caption {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.35;
  max-height: 3.9em;
  overflow: hidden;
}
.lm-voice-caption:empty {
  display: none;
}
.lm-voice-caption[data-speaker='assistant'] {
  color: var(--text);
}

@media (max-width: 900px) {
  .lm-voice-slot {
    top: 16px;
    right: 16px;
  }
  .content-wrap:has(.content-chat) .lm-voice-slot {
    top: 8px;
    right: 12px;
  }
  .content-wrap:has(.content-chat) .lm-voice-orb {
    width: 32px;
    height: 32px;
  }
  .content-wrap:has(.content-chat) .lm-voice-orb-core {
    inset: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lm-voice-orb-core {
    animation: none !important;
    transition: none;
  }
}
