.chloe-stage {
  --chloe-size: 120px;
  --chloe-dock-width: 142px;
  position: fixed;
  z-index: 84;
  right: 90px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  height: 160px;
  pointer-events: none;
}

.ims-pro-no-chloe .chloe-stage { display: none; }
.cookie-robot-open .chloe-stage { visibility: hidden; }

.chloe-dock {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--chloe-dock-width);
  height: 103px;
}

.chloe-table {
  position: absolute;
  inset: auto -5px 0;
  height: 24px;
  border: 1px solid #613d2dcc;
  border-radius: 32% 32% 10px 10px / 10px 10px 8px 8px;
  background: repeating-linear-gradient(3deg, #ffffff05 0 2px, #633a250a 2px 4px),
    linear-gradient(#b28056 0 42%, #6f432c 42%, #442a24 100%);
  box-shadow: 0 5px 11px #14221c38;
}

:root[data-season="halloween"] .chloe-table {
  background: linear-gradient(#85648b 0 42%, #482f51 42%, #2c2036 100%);
}

:root[data-season="christmas"] .chloe-table {
  background: linear-gradient(#547860 0 42%, #2d4f40 42%, #142d28 100%);
}

.chloe-bed {
  position: absolute;
  inset: auto 0 13px;
  width: 100%;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 3px 3px #2a1a1840);
}

.chloe-name {
  position: absolute;
  bottom: 0;
  left: 50%;
  color: #fff1d8;
  font: 650 10px/1.3 system-ui, sans-serif;
  letter-spacing: .045em;
  transform: translateX(-50%);
}

.chloe-pause {
  position: absolute;
  z-index: 3;
  right: -8px;
  bottom: 0;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  padding: 0;
  border: 1px solid #9eb6ad;
  border-radius: 50%;
  background: #19362f;
  color: #fff;
  font: 700 12px/1 system-ui, sans-serif;
  opacity: .76;
  pointer-events: auto;
  cursor: pointer;
}

.chloe-pause[hidden] { display: none; }
.chloe-pause:is(:hover, :focus-visible) { opacity: 1; }

.chloe-pet {
  position: absolute;
  z-index: 2;
  left: 0;
  bottom: 7px;
  width: var(--chloe-size);
  height: var(--chloe-size);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  transform: translate3d(var(--chloe-x, 0px), 0, 0);
  cursor: pointer;
  pointer-events: auto;
}

.chloe-pet[data-pose="sleep"], .chloe-is-static .chloe-pet {
  bottom: 17px;
  height: calc(var(--chloe-size) * .79);
}
.chloe-pet:focus-visible, .chloe-pause:focus-visible {
  outline: 3px solid #168657;
  outline-offset: 2px;
}

.chloe-sprite, .chloe-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: scaleX(var(--chloe-facing, 1));
  filter: drop-shadow(0 2px 2px #211c2930);
  pointer-events: none;
}

.chloe-still { display: none; background: var(--chloe-pose-image) center / contain no-repeat; }
.chloe-no-canvas .chloe-sprite { display: none; }
.chloe-no-canvas .chloe-still { display: block; }
.chloe-pet[data-pose="sleep"] .chloe-sprite,
.chloe-pet[data-pose="sleep"] .chloe-still,
.chloe-is-static .chloe-sprite,
.chloe-is-static .chloe-still { visibility: hidden; }

.chloe-shadow {
  position: absolute;
  inset: auto 14% 1px;
  height: 8px;
  border-radius: 50%;
  background: #17232438;
  filter: blur(4px);
  pointer-events: none;
}

.chloe-sleep {
  position: absolute;
  inset: auto 3% 12px;
  height: 80%;
  visibility: hidden;
  background: var(--chloe-sleep-image) center bottom / contain no-repeat;
  transform-origin: 48% 90%;
  filter: drop-shadow(0 2px 2px #31221d38);
  pointer-events: none;
}

.chloe-pet[data-pose="sleep"] .chloe-sleep,
.chloe-is-static .chloe-sleep {
  visibility: visible;
  animation: chloe-breathe 3s ease-in-out infinite;
}

.chloe-pet[data-pose="sleep"] .chloe-shadow,
.chloe-is-static .chloe-shadow { visibility: hidden; }

.chloe-bubble {
  position: absolute;
  z-index: 1;
  top: -12px;
  right: -2px;
  visibility: hidden;
  padding: 5px 9px;
  border-radius: 14px 14px 14px 3px;
  background: #fff8ee;
  color: #503924;
  box-shadow: 0 3px 10px #291d252a;
  font: 750 11px/1.2 system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

.chloe-pet[data-pose="bark"] .chloe-bubble { visibility: visible; animation: chloe-greet .24s ease-out both; }

.chloe-dream {
  --dream-art: url("../images/chloe-blue-knot.webp");
  position: absolute;
  z-index: 2;
  right: 11%;
  bottom: 71%;
  width: clamp(77px, 7.8vw, 104px);
  aspect-ratio: 1;
  background: url("../images/chloe-thought-cloud.png") center / contain no-repeat;
  filter: drop-shadow(0 2px 3px #23243957);
  pointer-events: none;
  visibility: hidden;
}

.chloe-dream::before {
  position: absolute;
  top: 34.5%;
  left: 49%;
  width: 52%;
  height: 46%;
  background: var(--dream-art) center / contain no-repeat;
  transform: translate(-50%, -50%);
  content: "";
}

.chloe-stage[data-costume="halloween"] .chloe-dream {
  --dream-art: url("../images/chloe-skeleton-bone.webp");
}

.chloe-stage[data-costume="christmas"] .chloe-dream {
  --dream-art: url("../images/chloe-wrapped-bone.webp");
}

.chloe-pet[data-pose="sleep"] .chloe-dream {
  visibility: visible;
  animation: chloe-dream-drift 3.4s ease-in-out infinite alternate;
}

.chloe-mini-tree, .chloe-parcel, .chloe-trick-basket {
  position: absolute;
  display: none;
  pointer-events: none;
}

.chloe-stage[data-costume="christmas"] :is(.chloe-mini-tree, .chloe-parcel),
.chloe-stage[data-costume="halloween"] .chloe-trick-basket { display: block; }

.chloe-mini-tree {
  z-index: 1;
  bottom: 55px;
  left: 12px;
  width: 26px;
  height: 34px;
  background: url("../images/chloe-mini-tree.svg") center / contain no-repeat;
  filter: drop-shadow(0 2px 2px #4a372c55);
}

.chloe-parcel {
  z-index: 3;
  left: 3px;
  bottom: 1px;
  width: 41px;
  height: 41px;
  background: url("../images/chloe-gift.svg") center / contain no-repeat;
  filter: drop-shadow(0 4px 4px #41262c77);
  transition: none;
  visibility: hidden;
}

.chloe-parcel:is(.is-falling, .is-landed) { visibility: visible; }

.chloe-trick-basket {
  z-index: 3;
  left: -31px;
  bottom: 2px;
  width: 53px;
  height: 49px;
  filter: drop-shadow(0 3px 4px #39213268);
}

.chloe-trick-basket svg { display: block; width: 100%; height: 100%; }
.chloe-basket-candies > g { visibility: hidden; }
.chloe-basket-candies > .is-collected { visibility: visible; }

.chloe-candy-mouth {
  position: absolute;
  left: 22%;
  top: 42%;
  width: 56%;
  height: 15%;
}

.chloe-falling-candy {
  position: fixed;
  z-index: 1010;
  width: 16px;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(100deg, transparent 41%, #fff5d1 42% 56%, transparent 57%), var(--candy-color);
  clip-path: polygon(0 9%, 27% 24%, 37% 12%, 65% 12%, 74% 24%, 100% 9%, 91% 50%, 100% 93%, 73% 75%, 64% 88%, 37% 88%, 27% 74%, 0 93%, 9% 50%);
  pointer-events: none;
}

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

@keyframes chloe-greet {
  from { transform: scale(.72); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes chloe-dream-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

@keyframes chloe-breathe {
  50% { transform: scale(1.015, 1.045); }
}

.chloe-is-static .chloe-sleep,
.chloe-is-static .chloe-dream,
.chloe-is-static .chloe-bubble { animation: none !important; }

@media (max-width: 700px) {
  .chloe-stage {
    --chloe-size: 95px;
    --chloe-dock-width: 112px;
    right: 80px;
    left: 12px;
    bottom: calc(111px + env(safe-area-inset-bottom, 0px));
    height: 126px;
  }
  .chloe-dock { height: 90px; }
  .chloe-bed { bottom: 11px; }
  .chloe-table { height: 20px; }
  .chloe-mini-tree { width: 21px; height: 28px; left: 9px; bottom: 43px; }
  .chloe-parcel { width: 34px; height: 34px; }
  .chloe-trick-basket { width: 44px; height: 41px; left: -24px; }
}
