/* 小树小树语音助手 */
#voice-assistant-widget {
  position: fixed;
  z-index: 9999;
  bottom: 24px;
  right: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.va-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(39, 174, 96, 0.35);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.va-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 22px rgba(39, 174, 96, 0.45);
}

.va-fab.pulse {
  animation: va-pulse 1.6s infinite;
}

@keyframes va-pulse {
  0% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(39, 174, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

.va-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: va-pop 0.25s ease-out;
}

@keyframes va-pop {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.va-panel.hidden {
  display: none;
}

.va-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #27ae60 0%, #219150 100%);
  color: #fff;
}

.va-title {
  font-weight: 600;
  font-size: 15px;
}

.va-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.va-body {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.va-status {
  font-size: 13px;
  color: #555;
  min-height: 18px;
  text-align: center;
}

.va-ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e8f5e9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.va-ball::after {
  content: '🌳';
  font-size: 32px;
  transition: transform 0.2s;
}

.va-ball.active {
  background: #c8e6c9;
  animation: va-listen 1.2s infinite ease-in-out;
}

.va-ball.speaking {
  background: #fff3e0;
  animation: va-speak 0.5s infinite alternate;
}

.va-ball.speaking::after {
  content: '💬';
}

@keyframes va-listen {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.3); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 12px rgba(39, 174, 96, 0); }
}

@keyframes va-speak {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

.va-text {
  min-height: 22px;
  font-size: 15px;
  color: #222;
  font-weight: 500;
  text-align: center;
  word-break: break-all;
}

.va-hint {
  min-height: 18px;
  font-size: 12px;
  color: #888;
  text-align: center;
}

.va-progress-wrap {
  width: 100%;
  height: 4px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
}

.va-progress {
  height: 100%;
  width: 0%;
  background: #27ae60;
  transition: width 0.2s;
}

.va-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

.va-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.va-btn:hover {
  background: #f0f0f0;
}

.va-btn-primary {
  background: #27ae60;
  color: #fff;
  border-color: #27ae60;
}

.va-btn-primary:hover {
  background: #219150;
}

.va-btn.active {
  background: #ff9800;
  color: #fff;
  border-color: #ff9800;
}

.va-shortcuts {
  font-size: 11px;
  color: #888;
  background: #f5f5f5;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  width: 100%;
}

.va-log {
  width: 100%;
  max-height: 120px;
  overflow-y: auto;
  background: #f7f7f7;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #444;
  text-align: left;
}

.va-log-item {
  margin-bottom: 4px;
  line-height: 1.4;
}

.va-log-speaker {
  font-weight: 600;
  color: #27ae60;
  margin-right: 4px;
}

@media (max-width: 480px) {
  #voice-assistant-widget {
    bottom: 16px;
    right: 16px;
  }
  .va-panel {
    width: calc(100vw - 32px);
    right: -8px;
  }
}

/* ---------------- 小树对话大表情（树娃娃图片版，说话时占半屏） ---------------- */
/* 直接用抠图后的树娃娃图片 voice/tree-doll.png；说话时一个小嘴层盖住原微笑做小幅度开合 */
.va-face-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* 不挡演示操作 */
}

.va-doll {
  position: relative;
  height: min(62vh, 96vw);
  opacity: 0;
  transform: scale(0.3) translateY(30px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.va-face-overlay.show .va-doll {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.va-doll img {
  height: 100%;
  display: block;
  filter: drop-shadow(0 16px 28px rgba(46, 125, 50, 0.3));
  user-select: none;
  -webkit-user-drag: none;
}

/* 嘴层：位置/尺寸按抠图中嘴的相对坐标（left 36.97% top 63.06% 宽≈13%），贴合原图小微笑 */
.va-mouth {
  position: absolute;
  left: 36.97%;
  top: 63.06%;
  width: 11.5%;
  height: 3%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at 50% 30%, #8a4540 0%, #6d332e 70%);
  border-radius: 45% 45% 55% 55% / 40% 40% 60% 60%;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s;
  filter: blur(0.4px);
}

.va-mouth::after { /* 舌尖 */
  content: '';
  position: absolute;
  left: 50%;
  bottom: -48%;
  width: 56%;
  height: 80%;
  transform: translateX(-50%);
  background: #e5837b;
  border-radius: 50%;
}

.va-face-overlay.show .va-mouth {
  opacity: 1;
  animation: va-talk 0.34s infinite ease-in-out alternate;
}

/* 小幅度开合：只比原图微笑略大一点 */
@keyframes va-talk {
  0% { height: 3%; width: 11.5%; }
  100% { height: 5%; width: 12.5%; border-radius: 48% 48% 52% 52% / 42% 42% 58% 58%; }
}

@media (max-width: 480px) {
  .va-doll {
    height: min(54vh, 100vw);
  }
}
