.limi-shell {
  position: fixed;
  z-index: 45;
  right: clamp(8px, 1vw, 18px);
  bottom: clamp(8px, 1vw, 14px);
  width: clamp(126px, 9vw, 170px);
  height: clamp(158px, 11.25vw, 212px);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transform-origin: right bottom;
  transition: opacity 600ms ease, transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.limi-shell.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.limi-menu-toggle {
  display: inline-flex;
  min-width: 126px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border: 1px solid rgba(224, 170, 83, 0.82);
  border-radius: 999px;
  color: #f8e7c4;
  background: linear-gradient(135deg, rgba(5, 23, 34, 0.96), rgba(18, 34, 43, 0.94));
  box-shadow: 0 12px 30px rgba(3, 12, 18, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, box-shadow 180ms ease;
  pointer-events: none;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.limi-menu-toggle.is-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.limi-menu-toggle:hover,
.limi-menu-toggle:focus-visible {
  box-shadow: 0 15px 34px rgba(3, 12, 18, 0.36), 0 0 0 2px rgba(224, 170, 83, 0.22);
}

.limi-library-toggle {
  position: fixed;
  z-index: 46;
  top: 14px;
  right: 14px;
}

.limi-companion {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.limi-companion:focus-visible {
  border-radius: 24px;
  outline: 2px solid rgba(239, 213, 161, 0.95);
  outline-offset: 4px;
}

.limi-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 13px 18px rgba(16, 8, 4, 0.28));
  transform-origin: center bottom;
  user-select: none;
  -webkit-user-drag: none;
}

.limi-shell[data-state="idle"] .limi-image,
.limi-shell[data-state="phone"] .limi-image,
.limi-shell[data-state="reading"] .limi-image {
  animation: limi-breathe 5.8s ease-in-out infinite;
}

.limi-shell[data-state="jump"] .limi-image {
  animation: limi-jump 780ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.limi-message {
  position: absolute;
  right: calc(100% - 6px);
  bottom: 48%;
  width: max-content;
  max-width: min(270px, calc(100vw - 210px));
  padding: 12px 15px;
  border: 1px solid rgba(239, 213, 161, 0.42);
  border-radius: 18px;
  color: #fff8ec;
  background: rgba(18, 14, 14, 0.78);
  box-shadow: 0 14px 38px rgba(12, 6, 4, 0.2);
  backdrop-filter: blur(16px);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.42;
  opacity: 0;
  transform: translateX(8px) translateY(4px);
  transition: opacity 280ms ease, transform 320ms ease;
  pointer-events: none;
}

.limi-message.is-visible {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

@keyframes limi-breathe {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-3px) rotate(0.35deg);
  }
}

@keyframes limi-jump {
  0% {
    transform: translateY(0) scale(1);
  }

  42% {
    transform: translateY(-22px) scale(1.025);
  }

  72% {
    transform: translateY(2px) scale(0.99);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@media (hover: hover) {
  .limi-companion:hover .limi-image {
    filter: drop-shadow(0 15px 22px rgba(215, 165, 74, 0.34));
  }
}

@media (max-width: 760px) {
  .limi-shell {
    right: 8px;
    bottom: 8px;
    width: clamp(76px, 23vw, 92px);
    height: clamp(95px, 28.75vw, 115px);
  }

  .limi-message {
    right: calc(100% - 3px);
    bottom: 42%;
    max-width: min(190px, calc(100vw - 105px));
    padding: 9px 11px;
    border-radius: 14px;
    font-size: 12px;
  }

  .limi-menu-toggle {
    min-width: 94px;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 10px;
  }

  .limi-library-toggle {
    top: 10px;
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .limi-shell {
    transform: none;
    transition: opacity 300ms ease;
  }

  .limi-image,
  .limi-shell[data-state] .limi-image {
    animation: none;
  }

  .limi-message {
    transition: opacity 200ms ease;
  }

  .limi-menu-toggle {
    transition: opacity 200ms ease;
  }
}
