/* The room stays quiet: one control, one orbit, history only on request. */
[data-theme] #intercom-panel {
  color: var(--text-primary);
}
.voice-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.voice-heading h2 {
  margin: 0;
  font: 400 28px/1.5 var(--font-heading);
}
.voice-heading p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0;
}
.voice-history-open {
  position: relative;
}
.voice-heading button,
.voice-stage button:not([data-voice-record]),
.voice-drawer header button {
  border: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 10px;
  cursor: pointer;
}
.voice-badge {
  position: absolute;
  right: -5px;
  top: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: var(--surface-card);
  font-size: 11px;
}
.voice-badge[hidden] {
  display: none;
}
.voice-stage {
  min-height: var(--voice-stage-height, 440px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 0 max(32px, env(safe-area-inset-bottom));
  text-align: center;
}
.voice-orbit {
  position: relative;
  width: 336px;
  height: 336px;
  display: grid;
  place-items: center;
  max-width: 100%;
}
.voice-orbit canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
[data-theme] .voice-orbit [data-voice-record] {
  position: relative;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--voice-accent);
  color: var(--voice-on-accent);
  border: 0;
  font: 400 22px/1.65 var(--font-heading);
  letter-spacing: 0.12em;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  transition:
    transform 120ms ease-out,
    background 180ms ease;
  box-shadow: 0 4px 8px color-mix(in srgb, var(--voice-accent) 18%, transparent);
}
.voice-orbit [data-voice-record]:active {
  transform: scale(0.94);
}
.voice-orbit [data-voice-record]:disabled {
  opacity: 0.55;
  cursor: default;
}
[data-theme] [data-voice-state='cancel-armed'] [data-voice-record] {
  background: var(--danger);
  color: var(--surface-card);
}
[data-theme] [data-voice-state='listening'] [data-voice-record] {
  background: var(--accent-secondary);
  color: var(--surface-card);
  font-size: 18px;
}
[data-voice-timer] {
  font: 16px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  margin: 0 0 14px;
}
[data-voice-hint],
[data-voice-message] {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin: 4px 0;
  max-width: 65ch;
}
[data-voice-hint],
[data-voice-message] {
  min-height: 24px;
}
/* Failure actions and the live transcript take turns in one fixed slot, so the orbit never jumps. */
.voice-slot {
  display: grid;
  justify-items: center;
  align-content: start;
  height: 84px;
}
.voice-slot > * {
  grid-area: 1 / 1;
}
[data-voice-failure]:not([hidden]) {
  display: flex;
  gap: 8px;
}
[data-voice-transcript] {
  font-size: 15px;
  line-height: 1.8;
  max-width: 48ch;
  margin: 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}
.voice-sent .voice-orbit::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  pointer-events: none;
  animation: voice-letter 400ms ease-out both;
}
.voice-cancelled canvas {
  animation: voice-cancel 240ms ease-out;
}
.voice-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(420px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100%;
  padding: 24px;
  border: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  overflow: hidden;
}
.voice-drawer[open] {
  display: flex;
  flex-direction: column;
  animation: voice-drawer 220ms ease-out;
}
.voice-drawer::backdrop {
  background: var(--dialog-backdrop);
}
.voice-drawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.voice-drawer h2 {
  font: 400 22px var(--font-heading);
  margin: 0;
}
.voice-drawer header button {
  font-size: 28px;
}
.voice-space-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 12px 0;
  color: var(--text-secondary);
}
.voice-space-label[hidden] {
  display: none;
}
.voice-space-label select {
  min-width: 0;
  max-width: 100%;
  background: var(--surface-input);
  color: var(--text-primary);
  padding: 8px;
  border: 1px solid var(--border-subtle);
  font: inherit;
}
[data-voice-drawer-status] {
  font-size: 12px;
  line-height: 1.8;
}
.voice-timeline {
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0 8px 32px 0;
}
.voice-date {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 28px 0 18px;
}
.voice-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 22px 0;
  scroll-margin-block: 20px;
}
.voice-entry.is-own {
  align-items: flex-end;
}
.voice-bubble {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 132px;
  width: var(--voice-width);
  max-width: 70%;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-card);
  color: var(--text-primary);
  font: 16px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.is-own .voice-bubble {
  background: var(--accent-primary);
  color: var(--text-on-accent);
}
.voice-bubble-icon {
  flex: none;
  font-size: 11px;
}
.voice-bars {
  flex: 1;
  min-width: 0;
  height: 18px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.voice-bars i {
  flex: none;
  width: 2px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.5;
}
.voice-drawer-note {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.voice-drawer-note[hidden] {
  display: none;
}
.voice-bubble.is-unheard::after {
  content: '';
  position: absolute;
  right: -12px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}
.voice-entry.is-playing .voice-bubble {
  background-image: linear-gradient(
    to right,
    color-mix(in srgb, var(--accent-secondary) 25%, transparent)
      var(--voice-progress, 0%),
    transparent 0%
  );
}
.voice-entry.is-highlighted {
  outline: 2px solid var(--focus-ring);
  outline-offset: 6px;
  border-radius: 8px;
}
.voice-transcript {
  margin: 0;
  max-width: 90%;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.voice-entry small,
.voice-empty {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.8;
}
.voice-empty {
  font-size: 13px;
  margin: 50px 0;
  text-align: center;
}
.voice-transcript mark {
  background: var(--selection-bg);
  color: var(--text-primary);
}
.voice-notice {
  position: fixed;
  z-index: 50;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-card);
  color: var(--text-primary);
  font: 13px var(--font-body);
  cursor: pointer;
}
.voice-capsule {
  position: fixed;
  z-index: 45;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  max-width: calc(100% - 32px);
  background: var(--accent-primary);
  color: var(--text-on-accent);
  border-radius: 28px;
  padding: 5px 12px;
}
.voice-capsule[hidden],
.voice-notice[hidden] {
  display: none;
}
.voice-capsule button {
  border: 0;
  background: none;
  color: inherit;
  min-height: 44px;
  min-width: 32px;
  font: 13px var(--font-body);
  cursor: pointer;
}
.voice-capsule [data-voice-capsule-open] {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
}
[data-voice-capsule-text] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.voice-mini-wave {
  font-size: 24px;
  letter-spacing: 2px;
  animation: voice-mini 700ms ease-in-out infinite alternate;
}
.voice-drawer :focus-visible,
.voice-stage :focus-visible,
.voice-heading :focus-visible,
.voice-notice:focus-visible,
.voice-capsule :focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 4px;
}
@keyframes voice-letter {
  from {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 1;
  }
  to {
    transform: translate(100px, -250px) scale(0.4);
    opacity: 0;
  }
}
@keyframes voice-cancel {
  to {
    transform: scale(0.4);
    opacity: 0;
  }
}
@keyframes voice-drawer {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes voice-mini {
  to {
    transform: scaleY(0.6);
  }
}
@media (max-width: 640px) {
  .voice-heading h2 {
    font-size: 24px;
  }
  .voice-orbit {
    width: 296px;
    height: 296px;
  }
  [data-theme] .voice-orbit [data-voice-record] {
    width: 148px;
    height: 148px;
  }
  .voice-stage {
    min-height: var(--voice-stage-height, 400px);
    padding-top: 0;
  }
  .voice-drawer {
    inset: 0;
    width: 100%;
    padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  }
  .voice-drawer[open] {
    animation-name: voice-sheet;
  }
}
@keyframes voice-sheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .voice-stage *,
  .voice-drawer,
  .voice-mini-wave {
    animation: none !important;
    transition: none !important;
  }
  .voice-sent .voice-orbit::after {
    display: none;
  }
}
