.sofia-ai {
  --sofia-primary: #6f4bf2;
  --sofia-shadow: 0 20px 55px rgba(20, 18, 45, .22);
  position: fixed;
  z-index: 999999;
  bottom: max(20px, env(safe-area-inset-bottom));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.sofia-ai--right { right: max(20px, env(safe-area-inset-right)); }
.sofia-ai--left { left: max(20px, env(safe-area-inset-left)); }
.sofia-ai *, .sofia-ai *::before, .sofia-ai *::after { box-sizing: border-box; }
.sofia-ai__launcher {
  display: flex; align-items: center; gap: 10px; min-height: 52px;
  border: 0; border-radius: 999px; padding: 10px 18px 10px 10px;
  background: var(--sofia-primary); color: #fff; box-shadow: var(--sofia-shadow);
  font: inherit; font-weight: 750; cursor: pointer; transition: transform .2s ease, filter .2s ease;
}
.sofia-ai__launcher:hover { transform: translateY(-2px); filter: brightness(1.05); }
.sofia-ai__launcher:focus-visible, .sofia-ai button:focus-visible { outline: 3px solid rgba(111,75,242,.28); outline-offset: 3px; }
.sofia-ai__launcher-icon, .sofia-ai__avatar {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff; font-weight: 800;
}
.sofia-ai__panel {
  position: absolute; bottom: 68px; width: min(370px, calc(100vw - 32px));
  overflow: hidden; border: 1px solid rgba(20,20,40,.08); border-radius: 22px;
  background: #fff; color: #1f2230; box-shadow: var(--sofia-shadow);
  animation: sofia-open .22s ease both;
}
.sofia-ai--right .sofia-ai__panel { right: 0; }
.sofia-ai--left .sofia-ai__panel { left: 0; }
.sofia-ai__header {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--sofia-primary), color-mix(in srgb, var(--sofia-primary) 72%, #17152e));
  color: #fff;
}
.sofia-ai__avatar { background: rgba(255,255,255,.2); }
.sofia-ai__header strong { display: block; font-size: 16px; }
.sofia-ai__status { display: block; margin-top: 2px; font-size: 12px; opacity: .86; }
.sofia-ai__close {
  margin-left: auto; border: 0; background: transparent; color: #fff; font-size: 28px;
  line-height: 1; cursor: pointer; opacity: .86;
}
.sofia-ai__body { padding: 22px 20px 16px; text-align: center; }
.sofia-ai__welcome { margin: 0 auto 18px; max-width: 290px; font-size: 15px; line-height: 1.55; color: #4b4f61; }
.sofia-ai__visual { height: 52px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.sofia-ai__visual span {
  width: 5px; height: 14px; border-radius: 999px; background: var(--sofia-primary); opacity: .45;
  animation: sofia-wave 1.1s ease-in-out infinite;
}
.sofia-ai__visual span:nth-child(2) { animation-delay: .12s; }
.sofia-ai__visual span:nth-child(3) { animation-delay: .24s; }
.sofia-ai__visual span:nth-child(4) { animation-delay: .36s; }
.sofia-ai__visual span:nth-child(5) { animation-delay: .48s; }
.sofia-ai:not([data-state="speaking"]):not([data-state="listening"]):not([data-state="loading"]) .sofia-ai__visual span { animation-play-state: paused; }
.sofia-ai__state { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: #33374a; }
.sofia-ai__transcript {
  margin-top: 14px; max-height: 100px; overflow: auto; border-radius: 12px; padding: 10px 12px;
  background: #f5f4fa; font-size: 12px; line-height: 1.45; text-align: left; color: #505366; white-space: pre-wrap;
}
.sofia-ai__transcript:empty { display: none; }
.sofia-ai__privacy { margin: 16px 0 0; font-size: 10px; line-height: 1.4; color: #85889a; }
.sofia-ai__footer { padding: 0 20px 20px; }
.sofia-ai__call {
  width: 100%; min-height: 54px; border: 0; border-radius: 14px; padding: 13px 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--sofia-primary); color: #fff; font: inherit; font-size: 15px;
  font-weight: 800; cursor: pointer; box-shadow: 0 9px 22px rgba(40, 28, 95, .20);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.sofia-ai__call:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(40, 28, 95, .27);
}
.sofia-ai__call.is-active { background: #d23f4b; }
.sofia-ai__call:disabled { opacity: .6; cursor: wait; }
.sofia-ai__call-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: 0 0 24px;
}
.sofia-ai__call-icon svg { display: block; width: 22px; height: 22px; }
@keyframes sofia-wave { 0%,100% { height: 12px; opacity: .35; } 50% { height: 38px; opacity: 1; } }
@keyframes sofia-open { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 480px) {
  .sofia-ai { left: 16px !important; right: 16px !important; }
  .sofia-ai__launcher { margin-left: auto; }
  .sofia-ai__panel { left: 0 !important; right: 0 !important; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .sofia-ai *, .sofia-ai *::before, .sofia-ai *::after { animation: none !important; transition: none !important; }
}
