.ester {
  font: 400 14px/1.55 var(--font-body);
  color: var(--ink);
}
.ester *,
.ester *::before,
.ester *::after {
  box-sizing: border-box;
}
.ester [hidden] {
  display: none !important;
}
.ester button,
.ester textarea {
  font: inherit;
}
.ester button {
  cursor: pointer;
}
.ester button:focus-visible,
.ester a:focus-visible,
.ester textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.ester button:disabled {
  opacity: 0.55;
  cursor: wait;
}
.ester-launch {
  position: fixed;
  right: 24px;
  bottom: max(calc(24px + env(safe-area-inset-bottom, 0px)), var(--ester-consent-space, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 6px 24px rgb(var(--shadow-rgb) / 15%);
}
.ester-launch:hover {
  background: var(--primary-hover);
}
.ester-panel {
  position: fixed;
  inset: auto 24px 24px auto;
  margin: 0;
  width: min(420px, calc(100vw - 32px));
  height: min(660px, calc(100dvh - 48px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 64px rgb(var(--shadow-rgb) / 18%);
  overflow: hidden;
}
.ester-panel[open] {
  display: flex;
  flex-direction: column;
}
.ester-panel::backdrop {
  background: rgb(var(--shadow-rgb) / 12%);
}
.ester-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ester-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--surface-tint);
  color: var(--primary);
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.ester-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}
.ester-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.ester-head button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: auto;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--muted);
  background: var(--surface);
}
.ester-head button:hover {
  background: var(--surface-subtle);
}
.ester-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
}
.ester-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ester-message {
  align-self: flex-start;
  max-width: 92%;
  padding: 14px 16px;
  background: var(--bubble-in);
  border: 1px solid var(--line);
  border-radius: var(--radius-bubble);
  border-bottom-left-radius: 4px;
  overflow-wrap: anywhere;
}
.ester-message[data-author='visitor'] {
  align-self: flex-end;
  background: var(--bubble-out);
  border-color: transparent;
  border-bottom-left-radius: var(--radius-bubble);
  border-bottom-right-radius: 4px;
}
.ester-message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}
.ester-message nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.ester-message a {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 32px;
  display: flex;
  align-items: center;
}
.ester-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.ester-suggestions button {
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--primary);
  font-size: 12px;
}
.ester-suggestions button:hover {
  background: var(--surface-subtle);
}
.ester-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 64px;
  min-height: 44px;
  padding: 14px 18px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-bubble);
  border-bottom-left-radius: 4px;
  background: var(--bubble-in);
}
.ester-typing span {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--muted);
  animation: ester-typing-bounce 1.2s ease-in-out infinite;
}
.ester-typing span:nth-child(2) {
  animation-delay: 0.16s;
}
.ester-typing span:nth-child(3) {
  animation-delay: 0.32s;
}
@keyframes ester-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
.ester-status {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}
.ester-status:empty {
  display: none;
}
.ester-compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px 8px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.ester-compose textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
.ester-compose button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  margin-bottom: 4px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
}
.ester-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 20px;
  background: var(--surface);
}
.ester-actions button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ester-privacy {
  flex-shrink: 0;
  margin: 0;
  padding: 0 20px 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.ester-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  .ester-launch {
    right: 16px;
    bottom: max(calc(84px + env(safe-area-inset-bottom, 0px)), var(--ester-consent-space, 0px));
    min-height: 48px;
    font-size: 13px;
  }
  .ester-panel {
    inset: auto 12px max(12px, env(safe-area-inset-bottom, 0px)) 12px;
    width: calc(100vw - 24px);
    height: min(700px, calc(100dvh - 24px));
    border-radius: var(--radius-panel);
  }
  .ester-head {
    padding: 16px;
  }
  .ester-scroll {
    padding: 16px;
  }
  .ester-compose {
    padding-inline: 16px;
  }
  .ester-compose textarea {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ester-typing span {
    animation: none;
    opacity: 1;
  }
}
