.home-avatar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 110;
  width: clamp(76px, 8vw, 110px);
  color: var(--color-text);
}

.avatar-stage {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 14px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.avatar-stage.is-dragging {
  cursor: grabbing;
}

.avatar-stage:focus-visible,
.avatar-dismiss:focus-visible,
.avatar-stop:focus-visible,
.avatar-link:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.avatar-figure {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  filter: drop-shadow(0 2px 3px rgb(25 37 44 / 16%));
}

.avatar-figure img {
  display: block;
  width: 100%;
  height: 100%;
}

.avatar-gesture {
  position: absolute;
  inset: 0;
  background: url(../fig/avatar/gestures.webp) no-repeat;
  background-size: 400% 300%;
}

.avatar-gesture:not([hidden]) + img {
  visibility: hidden;
}

.avatar-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.avatar-content {
  position: absolute;
  z-index: 1;
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px #dce3e9, 0 5px 22px rgb(25 37 44 / 12%);
  line-height: 1.52;
}

.avatar-content::before {
  position: absolute;
  width: 10px;
  height: 10px;
  background: inherit;
  border: solid #dce3e9;
  transform: rotate(45deg);
  pointer-events: none;
  content: "";
}

.avatar-content[data-side="left"]::before {
  top: calc(var(--avatar-tail) - 5px);
  right: -5px;
  border-width: 1px 1px 0 0;
}

.avatar-content[data-side="right"]::before {
  top: calc(var(--avatar-tail) - 5px);
  left: -5px;
  border-width: 0 0 1px 1px;
}

.avatar-content[data-side="above"]::before {
  bottom: -5px;
  left: calc(var(--avatar-tail) - 5px);
  border-width: 0 1px 1px 0;
}

.avatar-content[data-side="below"]::before {
  top: -5px;
  left: calc(var(--avatar-tail) - 5px);
  border-width: 1px 0 0 1px;
}

.avatar-message {
  max-height: var(--avatar-message-height);
  padding: 11px 34px 12px 13px;
  overflow: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.avatar-caption {
  font-size: 0.9rem;
  font-weight: 500;
}

.avatar-translation,
.avatar-feedback {
  margin-top: 5px;
  color: var(--color-text-secondary);
}

.avatar-followup:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  margin-top: 7px;
}

.avatar-link {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.avatar-dismiss,
.avatar-stop {
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.avatar-dismiss:hover,
.avatar-stop:hover {
  color: var(--color-accent-hover);
  background: var(--color-tag-bg);
}

.avatar-dismiss {
  position: absolute;
  z-index: 1;
  top: 3px;
  right: 3px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font: 1.15rem/1 var(--font-sans);
}

.avatar-stop {
  min-height: 28px;
  padding: 2px 7px;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  font: inherit;
}
