:root {
  --xcpp-ink: #17202a;
  --xcpp-panel: #fffaf2;
  --xcpp-soft-panel: #fffaf4;
  --xcpp-soft-border: #e8ded0;
  --xcpp-panel-dark: #1f2430;
  --xcpp-plaid: #b84a55;
  --xcpp-silver: #d8dde3;
  --xcpp-focus: #4d7cff;
}

.xcpp-pet {
  --xcpp-scale: 1;
  --xcpp-cell-w: 192px;
  --xcpp-cell-h: 208px;
  --xcpp-frame: 0;
  --xcpp-row: 0;
  --xcpp-frames: 6;
  position: fixed;
  z-index: 99999;
  width: calc(var(--xcpp-cell-w) * var(--xcpp-scale));
  height: calc(var(--xcpp-cell-h) * var(--xcpp-scale));
  touch-action: none;
  user-select: none;
  filter: drop-shadow(0 12px 18px rgb(23 32 42 / 18%));
}

.xcpp-pet button,
.xcpp-pet button:hover,
.xcpp-pet button:focus,
.xcpp-pet button:focus-visible,
.xcpp-pet button:active,
.xcpp-restore,
.xcpp-restore:hover,
.xcpp-restore:focus,
.xcpp-restore:focus-visible,
.xcpp-restore:active {
  outline: none !important;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
}

.xcpp-pet.is-hidden {
  display: none;
}

.xcpp-sprite {
  width: 100%;
  height: 100%;
  border: 0 !important;
  outline: 0 !important;
  padding: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: var(--xcpp-sprite-url);
  background-repeat: no-repeat;
  background-size: calc(1536px * var(--xcpp-scale)) calc(1872px * var(--xcpp-scale));
  background-position:
    calc(var(--xcpp-frame) * -1 * var(--xcpp-cell-w) * var(--xcpp-scale))
    calc(var(--xcpp-row) * -1 * var(--xcpp-cell-h) * var(--xcpp-scale));
  background-color: transparent;
  box-shadow: none !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: grab;
}

.xcpp-sprite:hover,
.xcpp-sprite:focus,
.xcpp-sprite:focus-visible,
.xcpp-sprite:active {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background-color: transparent !important;
}

.xcpp-sprite::-moz-focus-inner,
.xcpp-toggle::-moz-focus-inner,
.xcpp-restore::-moz-focus-inner {
  border: 0;
}

.xcpp-pet.is-dragging .xcpp-sprite {
  cursor: grabbing;
}

.xcpp-bubble {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(100% + 8px);
  min-width: 176px;
  max-width: min(280px, 76vw);
  padding: 10px 12px;
  border: 2px solid var(--xcpp-ink);
  border-radius: 8px;
  background: var(--xcpp-panel);
  color: var(--xcpp-ink);
  font: 600 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  box-shadow: 5px 5px 0 var(--xcpp-plaid);
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.xcpp-bubble::before {
  content: ">";
  color: var(--xcpp-plaid);
  margin-right: 6px;
}

.xcpp-bubble.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.xcpp-controls {
  position: absolute;
  right: 4px;
  top: -16px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.xcpp-pet.show-controls .xcpp-controls {
  opacity: 1;
  transform: translateY(0);
}

.xcpp-toggle {
  min-width: 54px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--xcpp-soft-border) !important;
  border-radius: 999px;
  background: var(--xcpp-soft-panel);
  color: var(--xcpp-ink);
  font: 500 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 3px 8px rgb(23 32 42 / 8%) !important;
  white-space: nowrap;
}

.xcpp-toggle:hover,
.xcpp-toggle:focus,
.xcpp-toggle:focus-visible,
.xcpp-toggle:active,
.xcpp-restore:hover,
.xcpp-restore:focus,
.xcpp-restore:focus-visible,
.xcpp-restore:active {
  border-color: var(--xcpp-soft-border) !important;
  background: var(--xcpp-soft-panel) !important;
  color: var(--xcpp-ink) !important;
  box-shadow: 0 3px 8px rgb(23 32 42 / 8%) !important;
}

.xcpp-restore {
  position: fixed;
  z-index: 99999;
  left: 18px;
  top: 18px;
  min-width: 76px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--xcpp-soft-border) !important;
  border-radius: 999px;
  background: var(--xcpp-soft-panel);
  color: var(--xcpp-ink);
  font: 600 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 0 3px 8px rgb(23 32 42 / 8%) !important;
  white-space: nowrap;
}

.xcpp-restore[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .xcpp-bubble {
    left: 50%;
    bottom: calc(100% + 6px);
    min-width: 154px;
    max-width: min(230px, 78vw);
    font-size: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  .xcpp-bubble,
  .xcpp-restore {
    border-color: #edf2ff;
    background: var(--xcpp-panel-dark);
    color: #f6f7fb;
    box-shadow: 5px 5px 0 #7f5af0;
  }

  .xcpp-toggle {
    border-color: rgb(237 242 255 / 22%) !important;
    background: #fffaf4 !important;
    color: #17202a !important;
    box-shadow: 0 3px 8px rgb(0 0 0 / 18%) !important;
  }

  .xcpp-restore {
    border-color: rgb(237 242 255 / 22%) !important;
    background: #fffaf4;
    color: #17202a;
    box-shadow: 0 3px 8px rgb(0 0 0 / 18%) !important;
  }

  .xcpp-bubble {
    border-color: #edf2ff;
    background: var(--xcpp-panel-dark);
    color: #f6f7fb;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xcpp-bubble,
  .xcpp-controls {
    transition: none;
  }
}
