.ai-assistant-trigger {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79,195,247,0.9), rgba(41,182,246,0.9));
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 0 30px rgba(79,195,247,0.35), 0 8px 30px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 9998;
  animation: aiFloat 4s ease-in-out infinite;
  transition: transform 0.3s, box-shadow 0.3s;
}
.ai-assistant-trigger:hover {
  transform: scale(1.12);
  box-shadow: 0 0 50px rgba(79,195,247,0.6), 0 12px 40px rgba(0,0,0,0.4);
}
.ai-assistant-trigger svg {
  width: 30px; height: 30px; fill: #fff;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
}
.ai-assistant-trigger::after {
  content: ''; position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(79,195,247,0.25);
  animation: aiPulse 2s linear infinite;
}
@keyframes aiFloat {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes aiPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.ai-assistant-panel {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: rgba(5,10,24,0.92);

  /* Safari / iOS 支援 */
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  backdrop-filter: blur(24px) saturate(1.4);

  border: 1px solid rgba(79,195,247,0.18);
  border-radius: 24px;
  box-shadow: 0 0 60px rgba(79,195,247,0.12), 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.19,1,0.22,1);
  overflow: hidden;
}
.ai-assistant-panel.show {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 其他區塊保持原樣 */
.ai-assistant-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(79,195,247,0.12), rgba(129,212,250,0.04));
  border-bottom: 1px solid rgba(79,195,247,0.1);
}
.ai-assistant-title {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-weight: 700; letter-spacing: 1px;
}
.ai-assistant-title .ai-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #00ff88; box-shadow: 0 0 10px #00ff88;
  animation: aiDotPulse 1.5s infinite;
}
@keyframes aiDotPulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.ai-assistant-close {
  background: transparent; border: none; color: rgba(255,255,255,0.6);
  font-size: 22px; cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
.ai-assistant-close:hover { color: #fff; }

.ai-assistant-body {
  flex: 1; overflow-y: auto; padding: 16px;
  scroll-behavior: smooth;
}
.ai-assistant-body::-webkit-scrollbar { width: 5px; }
.ai-assistant-body::-webkit-scrollbar-thumb { background: rgba(79,195,247,0.3); border-radius: 4px; }

.ai-assistant-welcome {
  text-align: center; padding: 24px 10px; color: rgba(255,255,255,0.5);
}
.ai-assistant-welcome svg { width: 48px; height: 48px; fill: rgba(79,195,247,0.8); margin-bottom: 12px; }
.ai-assistant-welcome h4 { color: #fff; margin-bottom: 6px; font-size: 16px; }
.ai-assistant-welcome p { font-size: 12px; line-height: 1.7; }

.ai-assistant-msg { display: flex; gap: 10px; margin-bottom: 14px; animation: msgIn 0.3s ease; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-assistant-msg.user { flex-direction: row-reverse; }
.ai-assistant-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
}
.ai-assistant-msg.ai .ai-assistant-avatar {
  background: linear-gradient(135deg, rgba(79,195,247,0.25), rgba(41,182,246,0.15));
  border-color: rgba(79,195,247,0.35); color: #4fc3f7;
}
.ai-assistant-bubble {
  max-width: calc(100% - 52px);
  padding: 12px 14px; border-radius: 16px;
  font-size: 13px; line-height: 1.65;
  word-wrap: break-word;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.06);
}
.ai-assistant-msg.user .ai-assistant-bubble {
  background: linear-gradient(135deg, rgba(79,195,247,0.22), rgba(41,182,246,0.12));
  border-color: rgba(79,195,247,0.25); color: #fff;
}
.ai-assistant-bubble pre {
  background: rgba(0,0,0,0.35); border-radius: 10px;
  padding: 10px; margin: 8px 0; overflow-x: auto;
  font-family: 'Share Tech Mono', monospace; font-size: 11px;
  border: 1px solid rgba(79,195,247,0.1);
}
.ai-assistant-bubble code {
  background: rgba(79,195,247,0.12); padding: 2px 5px; border-radius: 4px;
  font-family: 'Share Tech Mono', monospace; font-size: 12px; color: #81d4fa;
}
.ai-assistant-bubble strong { color: #4fc3f7; }

.ai-assistant-typing {
  display: none; align-items: center; gap: 10px; margin-bottom: 14px;
}
.ai-assistant-typing.show { 
  display: flex; 
}
.ai-assistant-typing .typing-dots {
  display: flex; 
  gap: 5px; 
  padding: 12px 14px; 
  border-radius: 16px;
  background: rgba(255,255,255,0.05); 
  border: 1px solid rgba(255,255,255,0.06);
}
.ai-assistant-typing .typing-dots span {
  width: 7px; 
  height: 7px; 
  border-radius: 50%;
  background: rgba(79,195,247,0.8);

  /* Safari / iOS 動畫相容性 */
  -webkit-animation: aiTypingDot 1.4s infinite ease-in-out both;
  animation: aiTypingDot 1.4s infinite ease-in-out both;
}
.ai-assistant-typing .typing-dots span:nth-child(1) { 
  -webkit-animation-delay: -0.32s; 
  animation-delay: -0.32s; 
}
.ai-assistant-typing .typing-dots span:nth-child(2) { 
  -webkit-animation-delay: -0.16s; 
  animation-delay: -0.16s; 
}
@-webkit-keyframes aiTypingDot {
  0%,80%,100% { -webkit-transform: scale(0.6); opacity: 0.4; }
  40% { -webkit-transform: scale(1); opacity: 1; }
}
@keyframes aiTypingDot {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
