:root {
  --navy: #002c57;
  --navy-deep: #00172e;
  --navy-mid: #335679;
  --white: #ffffff;
  --shadow: 0 12px 34px rgba(0, 23, 46, 0.3);
  --ava-avatar-url: url("https://assets.cdn.filesafe.space/d4CLAsNXDaVOiKtlCWpI/media/699cc6291001a5c924f08b83.png");
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: #f2f4f7;
  font-family: "Lato", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  border: 0;
  border-radius: 999px;
  background: #002c57;
  color: var(--white);
  font-weight: 700;
  font-size: 15px;
  padding: 10px 16px 10px 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
  animation: launcherFloat 2.6s ease-in-out infinite;
}
#launcher.hidden {
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
  animation: none;
  filter: saturate(0.9);
}
#launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255,255,255,0) 20%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0) 80%);
  transform: translateX(-140%);
  animation: launcherShine 4.6s ease-in-out infinite;
  pointer-events: none;
}
#launcher:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 23, 46, 0.36);
  filter: saturate(1.08);
}
#launcher:active {
  transform: translateY(0) scale(0.99);
}
.launcher-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-image: var(--ava-avatar-url);
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255,255,255,0.86);
  box-shadow: 0 0 0 0 rgba(255,255,255,0.42);
  animation: launcherAvatarPulse 2.2s ease-out infinite;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}
.launcher-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.24);
}
.launcher-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.05;
  text-align: left;
  position: relative;
  z-index: 1;
}
.launcher-main {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1px;
  font-family: "Montserrat", "Lato", sans-serif;
}
.launcher-sub {
  font-size: 11px;
  opacity: 0.84;
  margin-top: 2px;
  font-weight: 500;
  font-family: "Lato", sans-serif;
}
@keyframes launcherFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes launcherShine {
  0%, 40%, 100% { transform: translateX(-140%); }
  60% { transform: translateX(140%); }
}
@keyframes launcherAvatarPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.38); }
  70% { box-shadow: 0 0 0 12px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
#widget {
  position: fixed;
  right: 24px;
  bottom: 98px;
  width: 390px;
  background: var(--navy);
  color: var(--white);
  border: 1px solid var(--navy-deep);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: scale(0.95) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: 200ms ease;
  z-index: 9999;
}
#widget.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--navy-deep);
}
.head-left { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  position: relative;
  background-image: var(--ava-avatar-url);
  background-size: cover;
  background-position: center;
}
.avatar::before {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--navy);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22);
  z-index: 2;
}
.avatar::after {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.46);
  animation: avatarRingPulse 2.2s ease-out infinite;
}
@keyframes avatarRingPulse {
  0% { transform: scale(0.96); opacity: 0.8; }
  70% { transform: scale(1.08); opacity: 0; }
  100% { transform: scale(1.08); opacity: 0; }
}
.head-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  font-family: "Montserrat", "Lato", sans-serif;
  letter-spacing: 0.1px;
}
.status {
  font-size: 13px;
  color: rgba(255,255,255,0.74);
  margin-top: 2px;
  font-family: "Lato", sans-serif;
  font-weight: 500;
}
.head-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  background: var(--navy-mid);
  color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
}

.body {
  height: 430px;
  display: flex;
  flex-direction: column;
}
#content {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
#widget.voice-mode #content {
  overflow: hidden;
}
.hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(255,255,255,0.68);
  pointer-events: none;
}
.hint.hidden { display: none; }
.hint-icon {
  width: 66px; height: 66px; border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: grid; place-items: center;
  font-size: 24px;
}
#voiceVisual {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  pointer-events: none;
}
#widget.voice-mode #voiceVisual {
  display: flex;
}
#widget.voice-mode .msg,
#widget.voice-mode .typing,
#widget.voice-mode #hint {
  display: none !important;
}
.wave {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wave span {
  width: 18px;
  border-radius: 999px;
  background: rgba(137, 186, 229, 0.45);
  animation: wave 1.1s ease-in-out infinite;
}
.wave span:nth-child(1){ height: 50px; animation-delay: .0s; }
.wave span:nth-child(2){ height: 68px; animation-delay: .1s; }
.wave span:nth-child(3){ height: 86px; animation-delay: .2s; }
.wave span:nth-child(4){ height: 68px; animation-delay: .3s; }
.wave span:nth-child(5){ height: 50px; animation-delay: .4s; }
@keyframes wave {
  0%,100% { transform: scaleY(.6); opacity: .65; }
  50% { transform: scaleY(1); opacity: 1; }
}
.voice-caption {
  color: rgba(255,255,255,0.68);
  font-size: 16px;
}

.msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  line-height: 1.45;
  z-index: 1;
  font-family: "Lato", sans-serif;
  font-size: 14px;
}
.msg.a { align-self: flex-start; background: var(--navy-mid); color: #ffffff; }
.msg.u { align-self: flex-end; background: #ffffff; color: var(--navy); }
.typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--navy-mid);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  padding: 10px 12px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-family: "Lato", sans-serif;
  box-shadow: 0 8px 22px rgba(0, 23, 46, 0.18), inset 0 1px 0 rgba(255,255,255,0.12);
  z-index: 1;
  position: relative;
  overflow: hidden;
}
.typing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255,255,255,0) 25%, rgba(255,255,255,0.11) 50%, rgba(255,255,255,0) 75%);
  transform: translateX(-140%);
  animation: typingShine 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes typingShine {
  0%, 45%, 100% { transform: translateX(-140%); }
  65% { transform: translateX(140%); }
}
.typing-label {
  position: relative;
  z-index: 1;
}
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: relative;
  z-index: 1;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  opacity: 0.35;
  transform: translateY(0);
  animation: typingDot 1.1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #ffffff;
  background: var(--navy-mid);
}
#input {
  flex: 1;
  border: 1px solid #ffffff;
  border-radius: 9px;
  outline: none;
  resize: none;
  background: var(--navy-mid);
  color: #ffffff;
  font-size: 14px;
  min-height: 38px;
  max-height: 90px;
  padding: 9px 10px;
  font-family: "Lato", sans-serif;
  font-weight: 600;
}
#input::placeholder { color: rgba(255,255,255,0.82); }
.send, .mic {
  border: 1px solid #ffffff;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  background: var(--navy-mid);
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
}
.mic {
  display: grid;
  place-items: center;
  padding: 0;
}
.mic-wave-bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}
.mic-wave-bars span {
  display: block;
  width: 3px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0.9;
  animation: micWave 1s ease-in-out infinite;
  transform-origin: center;
}
.mic-wave-bars span:nth-child(1) { height: 7px; animation-delay: 0s; }
.mic-wave-bars span:nth-child(2) { height: 11px; animation-delay: .1s; }
.mic-wave-bars span:nth-child(3) { height: 14px; animation-delay: .2s; }
.mic-wave-bars span:nth-child(4) { height: 11px; animation-delay: .3s; }
.mic-wave-bars span:nth-child(5) { height: 7px; animation-delay: .4s; }
@keyframes micWave {
  0%, 100% { transform: scaleY(.65); opacity: .7; }
  50% { transform: scaleY(1); opacity: 1; }
}
.mic.active { background: var(--navy); }
.stop {
  border: 0;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  background: #ef4444;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  display: none;
}
.stop.active { display: inline-block; }

.foot {
  text-align: center;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  padding: 6px;
  background: var(--navy-deep);
}
@media (max-width: 520px) {
  #widget { width: calc(100vw - 16px); right: 8px; bottom: 82px; }
  #launcher { right: 8px; bottom: 10px; width: calc(100vw - 16px); }
}
