.clippy3d {
  position: fixed;
  right: 18px;
  bottom: 58px;
  z-index: 29;
  width: 104px;
  height: 150px;
  user-select: none;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.clippy3d[hidden] {
  display: none;
}

.clippy3d-bubble {
  position: absolute;
  right: 62px;
  bottom: 104px;
  width: min(268px, calc(100vw - 144px));
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #111;
  border-radius: 2px;
  background: #ffffd7;
  color: #121212;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.24);
  font: 12px/1.35 Tahoma, Verdana, Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.clippy3d-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.clippy3d-bubble::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: 18px;
  width: 18px;
  height: 18px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
  background: #ffffd7;
  transform: rotate(-45deg);
}

.clippy3d.is-left-side .clippy3d-bubble {
  right: auto;
  left: 62px;
}

.clippy3d.is-left-side .clippy3d-bubble::after {
  right: auto;
  left: -10px;
  transform: rotate(135deg);
}

.clippy3d-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #8b846c;
  border-radius: 2px;
  background: #fff7bd;
  color: #222;
  font: 700 12px/1 Tahoma, Verdana, sans-serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease;
}

.clippy3d:hover .clippy3d-close,
.clippy3d:focus-within .clippy3d-close {
  opacity: 1;
}

.clippy3d-model {
  display: none;
  width: 100%;
  height: 100%;
  background: transparent;
  --poster-color: transparent;
  filter: drop-shadow(0 13px 10px rgba(0, 0, 0, 0.34));
}

.clippy3d.has-model .clippy3d-model {
  display: block;
}

.clippy3d.has-model .clippy-fallback {
  display: none;
}

.clippy-fallback {
  position: absolute;
  right: 6px;
  bottom: 0;
  width: 72px;
  height: 122px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  filter: drop-shadow(0 16px 9px rgba(0, 0, 0, 0.36));
}

.clippy-fallback img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.clippy3d.is-nudge {
  animation: clippyNudge 520ms ease;
}

.clippy3d.is-dragging {
  cursor: grabbing;
  animation: none;
}

.clippy3d.is-dragging .clippy-fallback {
  cursor: grabbing;
}

body[data-shell="classic"] .clippy3d-bubble {
  border-radius: 0;
  box-shadow: 2px 2px 0 #808080;
}

body[data-shell="xp"] .clippy3d-bubble {
  border-color: #7f742c;
  border-radius: 8px;
  background: #fff8c9;
}

body[data-shell="win10"] .clippy3d-bubble {
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 3px;
  background: #f7f2cf;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.32);
}

@keyframes clippyNudge {
  0%, 100% {
    transform: translateX(0) rotate(0);
  }
  25% {
    transform: translateX(-9px) rotate(-4deg);
  }
  50% {
    transform: translateX(8px) rotate(3deg);
  }
  75% {
    transform: translateX(-5px) rotate(-2deg);
  }
}

@media (max-width: 720px) {
  .clippy3d {
    right: 4px;
    bottom: 52px;
    width: 86px;
    height: 126px;
  }

  .clippy-fallback {
    right: 5px;
    width: 58px;
    height: 98px;
  }

  .clippy3d-bubble {
    right: 52px;
    bottom: 86px;
    width: min(210px, calc(100vw - 112px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .clippy3d.is-nudge {
    animation: none;
  }
}
