#dspl-root {
  --dspl-size: 220px;
  --dspl-bottom: 120px;
  --dspl-ink: #17355c;
  --dspl-blue: #168fd2;
  --dspl-cyan: #57d5ff;
  position: fixed;
  bottom: var(--dspl-bottom);
  z-index: 98;
  display: grid;
  width: max(var(--dspl-size), 260px);
  justify-items: center;
  color: var(--dspl-ink);
  font-family: ui-rounded, "Hiragino Maru Gothic ProN", "Microsoft YaHei", sans-serif;
  pointer-events: none;
  filter: none;
  isolation: isolate;
}

#dspl-root[data-side="right"] {
  right: 16px;
}

#dspl-root[data-side="left"] {
  left: 16px;
}

#dspl-root .dspl-bubble {
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  width: min(260px, 78vw);
  max-height: 100px;
  margin-bottom: -10px;
  padding: 10px 13px;
  overflow: hidden;
  border: 0;
  border-radius: 17px 17px 5px 17px;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: 82% 100%;
  transition: opacity 180ms ease, transform 260ms ease;
}

#dspl-root[data-side="right"] .dspl-bubble {
  justify-self: end;
  text-align: right;
}

#dspl-root[data-side="left"] .dspl-bubble {
  border-radius: 17px 17px 17px 5px;
  justify-self: start;
  text-align: left;
  transform-origin: 18% 100%;
}

#dspl-root .dspl-bubble[data-visible="true"] {
  opacity: 1;
  transform: none;
}

#dspl-root .dspl-bubble strong,
#dspl-root .dspl-bubble span {
  display: block;
  text-shadow: none;
}

#dspl-root .dspl-bubble strong {
  color: #187bb6;
  font-size: 12px;
  letter-spacing: 0.04em;
}

#dspl-root .dspl-bubble span {
  margin-top: 2px;
  color: #193a62;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

#dspl-root .dspl-stage {
  position: relative;
  box-sizing: border-box;
  width: var(--dspl-size);
  height: var(--dspl-size);
  padding: 0;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 100%;
}

#dspl-root .dspl-stage::after {
  display: none;
}

#dspl-root .dspl-stage:focus-visible {
  box-shadow: none !important;
}

#dspl-root .dspl-reaction {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scaleX(-1);
  user-select: none;
  transition: opacity 260ms ease;
}

#dspl-root .dspl-reaction[data-active="true"],
#dspl-root .dspl-blink[data-visible="true"] {
  opacity: 1;
}

#dspl-root .dspl-blink {
  z-index: 2;
  transition: opacity 40ms steps(1, end);
}

#dspl-root[data-reaction="rice"] .dspl-stage,
#dspl-root[data-reaction="hungry"] .dspl-stage,
#dspl-root[data-reaction="idle"] .dspl-stage {
  animation: dspl-breathe 4.8s ease-in-out infinite;
}

#dspl-root[data-reaction="cheerful"] .dspl-stage {
  animation: dspl-cheer 520ms cubic-bezier(0.2, 0.8, 0.25, 1.15) both;
}

#dspl-root[data-reaction="sleepy"] .dspl-stage,
#dspl-root[data-reaction="sleeping"] .dspl-stage {
  animation: dspl-doze 3.8s ease-in-out infinite;
}

#dspl-root .dspl-tools {
  position: relative;
  z-index: 4;
  display: flex;
  gap: 7px;
  height: 30px;
  margin-top: -20px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
}

#dspl-root:hover .dspl-tools,
#dspl-root:focus-within .dspl-tools {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

#dspl-root .dspl-collapse,
#dspl-root .dspl-switch {
  width: 30px;
  height: 30px;
  padding: 0 0 3px;
  border: 0 !important;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  color: #197db7;
  font: 700 20px/1 ui-rounded, sans-serif;
  cursor: pointer;
  pointer-events: auto;
  text-shadow: none;
}

#dspl-root .dspl-collapse:hover,
#dspl-root .dspl-collapse:focus-visible,
#dspl-root .dspl-switch:hover,
#dspl-root .dspl-switch:focus-visible {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0;
  transform: translateY(-1px);
}

#dspl-root[data-collapsed="true"] {
  width: 58px;
}

#dspl-root[data-collapsed="true"] .dspl-bubble,
#dspl-root[data-collapsed="true"] .dspl-tools {
  display: none;
}

#dspl-root[data-collapsed="true"] .dspl-stage {
  width: 58px;
  height: 58px;
  animation: none;
  filter: none;
}

@keyframes dspl-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.008); }
}

@keyframes dspl-cheer {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-9px) scale(1.035); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes dspl-doze {
  0%, 100% { transform: rotate(-0.6deg) translateY(0); }
  50% { transform: rotate(0.6deg) translateY(2px); }
}

@media (max-width: 640px) {
  #dspl-root[data-show-mobile="false"] {
    display: none;
  }

  #dspl-root {
    width: min(max(var(--dspl-size), 260px), calc(100vw - 14px));
  }

  #dspl-root[data-side="right"] { right: 7px; }
  #dspl-root[data-side="left"] { left: 7px; }

  #dspl-root .dspl-stage {
    width: min(var(--dspl-size), 46vw);
    height: min(var(--dspl-size), 46vw);
  }
}

@media (hover: none) {
  #dspl-root .dspl-tools {
    opacity: 0.86;
    pointer-events: auto;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #dspl-root *,
  #dspl-root *::before,
  #dspl-root *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
