/* ShantiBotics voice assistant — bottom-right hold-to-talk widget */
.tvw-root {
  --tvw-ink: #111827;
  --tvw-muted: #6b7280;
  --tvw-panel: #ffffff;
  --tvw-border: #e5e7eb;
  --tvw-accent: #0d6efd;
  position: fixed;
  left: calc(20px + 3.5cm);
  right: auto;
  bottom: calc(20px + 0.5cm);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-family: Montserrat, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--tvw-ink);
}

.tvw-panel {
  display: none;
  width: min(300px, calc(100vw - 32px));
  padding: 14px;
  background: var(--tvw-panel);
  border-radius: 20px;
  border: 1px solid var(--tvw-border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

.tvw-root.is-open .tvw-panel {
  display: block;
  animation: tvw-rise 0.2s ease-out;
}

@keyframes tvw-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tvw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tvw-title {
  font-size: 0.9rem;
  font-weight: 650;
  margin: 0;
}

.tvw-close {
  border: 0;
  background: transparent;
  color: #777;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.tvw-status {
  font-size: 0.82rem;
  color: var(--tvw-muted);
  min-height: 1.2em;
  margin-bottom: 8px;
}

.tvw-transcript {
  font-size: 0.84rem;
  line-height: 1.45;
  background: #f7f7f7;
  border-radius: 12px;
  padding: 10px;
  min-height: 48px;
  max-height: 110px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.tvw-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tvw-actions button {
  flex: 1;
  border: 0;
  border-radius: 32px;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.tvw-btn-main {
  background: #111827;
  color: #fff;
}

.tvw-btn-main.is-listening {
  background: #b91c1c;
}

.tvw-hold-target {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tvw-hold-target:active {
  cursor: grabbing;
}

.tvw-btn-main:disabled {
  opacity: 0.55;
  cursor: wait;
}

.tvw-btn-stop {
  background: #f0f0f0;
  color: #222;
  display: none;
}

.tvw-root.is-busy .tvw-btn-stop {
  display: block;
}

.tvw-launcher {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  max-width: min(360px, calc(100vw - 28px));
}

.tvw-action-text {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #111;
  border: 1px solid var(--tvw-border);
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  text-align: center;
  white-space: nowrap;
  line-height: 1.15;
}

.tvw-action-lead {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.tvw-action-sub {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-top: 2px;
}

.tvw-avatar-wrap {
  flex: 0 0 auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  background: #e8eef6;
  border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.tvw-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.tvw-launcher:hover .tvw-avatar-wrap {
  transform: scale(1.04);
}

.tvw-root.is-listening .tvw-avatar-wrap,
.tvw-root.is-speaking .tvw-avatar-wrap {
  animation: tvw-pulse 1.15s ease-in-out infinite;
}

.tvw-root.is-thinking .tvw-avatar-wrap {
  animation: tvw-breathe 1.2s ease-in-out infinite;
}

@keyframes tvw-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.35); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(13, 110, 253, 0); }
}

@keyframes tvw-breathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.92; }
}

.tvw-root.is-open .tvw-action-text {
  display: none;
}

@media (max-width: 640px) {
  .tvw-root {
    left: calc(12px + 3.5cm);
    right: auto;
    bottom: calc(12px + 0.5cm);
  }
  .tvw-avatar-wrap {
    width: 92px;
    height: 92px;
  }
  .tvw-action-text {
    padding: 7px 10px;
  }
  .tvw-action-lead {
    font-size: 1.2rem;
  }
  .tvw-action-sub {
    font-size: 0.86rem;
  }
}
