/* ==========================================
   Miku Pet — 初音未来桌宠样式
   气泡、响应式
   原则：wrapper 只做定位锚，不干扰 L2Dwidget 内部渲染
   动画由 JS 物理引擎驱动，CSS 仅保留气泡/粒子
   ========================================== */

/* ---------- 桌宠容器：纯定位，零干扰 ---------- */
#miku-pet-wrapper {
  position: fixed;
  z-index: 1000;
  pointer-events: auto;
  will-change: transform;
}

/* 桌面端右下角 */
@media (min-width: 769px) {
  #miku-pet-wrapper {
    right: var(--miku-right, 20px);
    bottom: var(--miku-bottom, 0px);
  }
}

/* 手机端默认隐藏 */
@media (max-width: 768px) {
  #miku-pet-wrapper.miku-mobile-hidden {
    display: none !important;
  }
  #miku-pet-wrapper.miku-mobile-visible {
    right: var(--miku-right, 0px);
    bottom: var(--miku-bottom, 0px);
  }
}

/* ---------- 粒子特效 ---------- */
.miku-particle {
  position: fixed;
  pointer-events: none;
  z-index: 1001;
  animation: miku-particle-fly 1s ease-out forwards;
  font-size: 20px;
  will-change: transform, opacity;
}

@keyframes miku-particle-fly {
  0%   { opacity: 1;   transform: translate(0, 0)     scale(1); }
  100% { opacity: 0;   transform: translate(var(--px, 0), var(--py, -70px)) scale(0.25); }
}

/* ---------- 对话气泡 ---------- */
#miku-bubble {
  position: fixed;
  z-index: 1002;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#miku-bubble.miku-bubble-show {
  opacity: 1;
  transform: translateY(0);
}

.miku-bubble-inner {
  background: rgba(255, 255, 255, 0.92);
  color: #333;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  max-width: var(--miku-bubble-width, 220px);
  word-break: break-word;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.miku-bubble-inner::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .miku-bubble-inner {
  background: rgba(40, 40, 50, 0.92);
  color: #e5e7eb;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .miku-bubble-inner::after {
  border-top-color: rgba(40, 40, 50, 0.92);
}

/* ---------- 声音开关 ---------- */
#miku-sound-toggle {
  position: fixed;
  z-index: 1003;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  color: #666;
}

#miku-sound-toggle:hover {
  transform: scale(1.1);
}

#miku-sound-toggle.miku-sound-on {
  color: #3b82f6;
}

@media (prefers-reduced-motion: reduce) {
  #miku-pet-wrapper { will-change: auto; }
  .miku-particle { animation: none; display: none; }
  #miku-bubble { transition: none; }
}
