:root {
  --ll-navy: #0a5185;
  --ll-navy-dark: #053d66;
  --ll-green: #177d51;
  --ll-green-accent: #36bf84;
  --ll-ink: #333333;
  --ll-body: #334155;
  --ll-muted: #69727d;
  --ll-line: #cccccc;
  --ll-white: #ffffff;
  --ll-chat-bg: #f0f0f0;
  --ll-gold: #d4c48a;
  --ll-error: #8a1f1f;
  --ll-shadow: 0 0 10px rgba(0, 0, 0, 0.28);
  --ll-font-display: "Montserrat", sans-serif;
  --ll-font-body: "Poppins", "Montserrat", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--ll-font-body);
  background: var(--ll-white);
}

.ll-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.ll-launcher {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ll-navy);
  color: var(--ll-white);
  box-shadow: var(--ll-shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ll-launcher svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.ll-launcher:hover,
.ll-launcher:focus-visible {
  background: var(--ll-navy-dark);
}

.ll-launcher:focus-visible {
  outline: 2px solid var(--ll-green-accent);
  outline-offset: 3px;
}

.ll-panel {
  display: none;
  width: 400px;
  height: min(600px, calc(100dvh - 120px));
  flex-direction: column;
  overflow: hidden;
  background: var(--ll-white);
  border-radius: 3px;
  box-shadow: var(--ll-shadow);
}

.ll-panel.is-open {
  display: flex;
}

.ll-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  background: var(--ll-navy);
  border-bottom: 4px solid var(--ll-green);
  color: var(--ll-white);
}

.ll-header-copy h2 {
  margin: 0;
  font-family: var(--ll-font-display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ll-white);
}

.ll-header-copy p {
  margin: 4px 0 0;
  font-family: var(--ll-font-display);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ll-gold);
}

.ll-close {
  width: 32px;
  height: 32px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ll-white);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ll-close:hover,
.ll-close:focus-visible {
  color: var(--ll-gold);
}

.ll-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--ll-chat-bg);
}

.ll-panel.is-voice .ll-messages {
  flex: 0 1 34%;
  min-height: 96px;
}

.ll-avatar {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 188px;
  background: linear-gradient(180deg, #e8eef3 0%, var(--ll-chat-bg) 100%);
}

.ll-avatar:not([hidden]) {
  display: flex;
}

.ll-avatar-stage {
  position: relative;
  width: 176px;
  height: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ll-avatar-image {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ll-white);
  box-shadow: 0 8px 24px rgba(10, 81, 133, 0.28);
  position: relative;
  z-index: 2;
  background: var(--ll-navy);
}

.ll-avatar-rings {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.ll-avatar-rings span {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(23, 125, 81, 0.28);
  animation: ll-avatar-pulse 2.4s ease-out infinite;
}

.ll-avatar-rings span:nth-child(2) {
  animation-delay: 0.8s;
}

.ll-avatar-rings span:nth-child(3) {
  animation-delay: 1.6s;
}

.ll-avatar.is-speaking .ll-avatar-rings span {
  border-color: rgba(212, 196, 138, 0.55);
  animation-duration: 1.2s;
}

.ll-avatar.is-speaking .ll-avatar-image {
  box-shadow: 0 0 0 4px rgba(212, 196, 138, 0.35), 0 8px 24px rgba(10, 81, 133, 0.28);
}

.ll-avatar.is-idle .ll-avatar-stage {
  animation: ll-avatar-breathe 3.6s ease-in-out infinite;
}

.ll-avatar.is-thinking .ll-avatar-image {
  box-shadow: 0 0 0 4px rgba(10, 81, 133, 0.18), 0 8px 24px rgba(10, 81, 133, 0.28);
}

.ll-avatar-mouth {
  position: absolute;
  left: 50%;
  top: 64%;
  width: 34px;
  height: 16px;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}

.ll-avatar-mouth-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ll-mouth {
  display: none;
  position: absolute;
  left: 50%;
  background: #7a3d42;
  border-radius: 50%;
  transform: translateX(-50%);
}

.ll-mouth-0 {
  width: 16px;
  height: 2px;
  top: 7px;
  border-radius: 2px;
}

.ll-mouth-1 {
  width: 18px;
  height: 4px;
  top: 6px;
}

.ll-mouth-2 {
  width: 20px;
  height: 6px;
  top: 5px;
}

.ll-mouth-3 {
  width: 22px;
  height: 8px;
  top: 4px;
}

.ll-mouth-4 {
  width: 24px;
  height: 10px;
  top: 3px;
}

.ll-avatar.is-speaking .ll-avatar-mouth[data-shape='0'] .ll-mouth-0,
.ll-avatar.is-speaking .ll-avatar-mouth[data-shape='1'] .ll-mouth-1,
.ll-avatar.is-speaking .ll-avatar-mouth[data-shape='2'] .ll-mouth-2,
.ll-avatar.is-speaking .ll-avatar-mouth[data-shape='3'] .ll-mouth-3,
.ll-avatar.is-speaking .ll-avatar-mouth[data-shape='4'] .ll-mouth-4 {
  display: block;
}

@keyframes ll-avatar-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes ll-avatar-pulse {
  0% {
    transform: scale(0.86);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

.ll-empty {
  margin: 8px 0 0;
  color: var(--ll-muted);
  font-family: var(--ll-font-display);
  font-size: 13px;
  line-height: 1.5;
}

.message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 3px;
  font-family: var(--ll-font-body);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message-user {
  align-self: flex-end;
  background: var(--ll-navy);
  color: var(--ll-white);
}

.message-assistant {
  align-self: flex-start;
  background: var(--ll-white);
  color: var(--ll-ink);
  border: 1px solid var(--ll-line);
}

.message-loading {
  color: var(--ll-muted);
  font-style: italic;
}

.message-error {
  color: var(--ll-error);
  border-color: #e4c4c4;
}

.ll-voice-status {
  margin: 0;
  padding: 8px 12px 0;
  color: var(--ll-green);
  font-family: var(--ll-font-display);
  font-size: 12px;
  font-weight: 500;
}

.ll-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--ll-white);
  border-top: 1px solid var(--ll-line);
}

.ll-composer input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ll-line);
  border-radius: 3px;
  background: var(--ll-white);
  color: var(--ll-ink);
  font-family: var(--ll-font-body);
  font-size: 14px;
}

.ll-composer input::placeholder {
  color: var(--ll-muted);
}

.ll-composer input:focus {
  outline: 0;
  border-color: var(--ll-navy);
}

.ll-mic {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--ll-line);
  border-radius: 3px;
  background: var(--ll-white);
  color: var(--ll-navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ll-mic svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.ll-mic:hover,
.ll-mic:focus-visible {
  border-color: var(--ll-navy);
}

.ll-mic.is-listening {
  background: var(--ll-green);
  border-color: var(--ll-green);
  color: var(--ll-white);
}

.ll-mic.is-speaking {
  background: var(--ll-error);
  border-color: var(--ll-error);
  color: var(--ll-white);
}

.ll-composer button[type='submit'] {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 3px;
  background: var(--ll-green);
  color: var(--ll-white);
  font-family: var(--ll-font-display);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.ll-composer button[type='submit']:hover {
  background: #146844;
}

.ll-composer button:disabled,
.ll-composer input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 480px) {
  .ll-widget {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
  }

  .ll-launcher {
    align-self: flex-end;
  }

  .ll-panel {
    width: 100%;
    height: min(600px, calc(100dvh - 96px));
  }
}
