:root {
  --stackling-size: clamp(104px, 9vw, 128px);
}

#stackling-mascot {
  --stackling-gaze-x: 0px;
  --stackling-gaze-y: 0px;
  --stackling-left-arm-x: 0px;
  --stackling-left-arm-y: 0px;
  --stackling-left-arm-rotate: 0deg;
  --stackling-right-arm-x: 0px;
  --stackling-right-arm-y: 0px;
  --stackling-right-arm-rotate: 0deg;
  --stackling-left-brow-y: 0px;
  --stackling-right-brow-y: 0px;
  --stackling-head-lift: 0px;
  --stackling-head-tilt: 0deg;
  --stackling-body-lean: 0deg;
  --stackling-motion-duration: 3.6s;
  --stackling-head-motion-duration: 8.5s;
  position: absolute;
  bottom: calc(var(--stackling-size) * -0.225);
  left: 0;
  z-index: 3;
  width: var(--stackling-size);
  height: var(--stackling-size);
  pointer-events: none;
  opacity: 0;
  overflow: visible;
  transform: translateX(-50%);
  contain: layout;
}

#stackling-mascot.is-ready {
  opacity: 1;
}

#stackling-mascot.is-parked {
  opacity: 0 !important;
}

#stackling-mascot.is-terminal-anchored {
  z-index: 5;
}

.stackling-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stackling-art {
  filter:
    drop-shadow(0 2px 1px rgba(0, 0, 0, 0.24))
    drop-shadow(0 8px 7px rgba(0, 0, 0, 0.2));
}

.stackling-body {
  transform: translateY(96px);
  transition: transform 720ms cubic-bezier(0.2, 0.82, 0.28, 1);
  transition-delay: 0ms;
  will-change: transform;
}

.stackling-hands {
  opacity: 0;
  transition: opacity 140ms ease-out;
}

.stackling-seated-body {
  opacity: 0;
  transform: translateY(45px);
  transition: transform 720ms cubic-bezier(0.2, 0.82, 0.28, 1);
}

#stackling-mascot:not(.is-seated) .stackling-head {
  transform: translateY(var(--stackling-head-lift)) rotate(var(--stackling-head-tilt));
  transform-origin: 80px 108px;
  transition: transform 420ms cubic-bezier(0.2, 0.82, 0.28, 1);
}

.stackling-seated-arm {
  transform-box: view-box;
  transition: transform 560ms cubic-bezier(0.18, 0.78, 0.24, 1);
  will-change: transform;
}

.stackling-seated-arm-left {
  transform-origin: 58px 104px;
  transform:
    translate(var(--stackling-left-arm-x), var(--stackling-left-arm-y))
    rotate(var(--stackling-left-arm-rotate));
}

.stackling-seated-arm-right {
  transform-origin: 102px 104px;
  transform:
    translate(var(--stackling-right-arm-x), var(--stackling-right-arm-y))
    rotate(var(--stackling-right-arm-rotate));
}

.stackling-hand-rig {
  transform-box: view-box;
  transition: transform 560ms cubic-bezier(0.18, 0.78, 0.24, 1);
  will-change: transform;
}

#stackling-mascot.is-seated .stackling-hand-rig-left {
  transform-origin: 58px 104px;
  transform:
    translate(var(--stackling-left-arm-x), var(--stackling-left-arm-y))
    rotate(var(--stackling-left-arm-rotate));
}

#stackling-mascot.is-seated .stackling-hand-rig-right {
  transform-origin: 102px 104px;
  transform:
    translate(var(--stackling-right-arm-x), var(--stackling-right-arm-y))
    rotate(var(--stackling-right-arm-rotate));
}

.stackling-hand-leveler {
  transform-box: view-box;
  transition: transform 560ms cubic-bezier(0.18, 0.78, 0.24, 1);
  will-change: transform;
}

#stackling-mascot.is-seated .stackling-hand-leveler-left {
  transform-origin: 30px 129px;
  transform: rotate(calc(0deg - var(--stackling-left-arm-rotate)));
}

#stackling-mascot.is-seated .stackling-hand-leveler-right {
  transform-origin: 130px 129px;
  transform: rotate(calc(0deg - var(--stackling-right-arm-rotate)));
}

#stackling-mascot.is-shy:not(.is-retreating) .stackling-body {
  transform: translateY(23px);
}

#stackling-mascot.is-shy:not(.is-retreating) .stackling-hands {
  opacity: 1;
}

#stackling-mascot.is-peeking .stackling-body {
  transform: translateY(0);
  transition-delay: 0ms;
}

#stackling-mascot.is-peeking .stackling-hands {
  opacity: 1;
}

#stackling-mascot.is-retreating .stackling-body {
  transform: translateY(96px);
  transition-duration: 360ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.8, 0.3);
  transition-delay: 0ms;
}

#stackling-mascot.is-retreating .stackling-hands {
  opacity: 0;
  transition-duration: 280ms;
}

#stackling-mascot.is-seated .stackling-body {
  transform: translateY(0);
  transition: none;
}

#stackling-mascot.is-seated .stackling-head {
  transform: translateY(calc(-40px + var(--stackling-head-lift))) rotate(var(--stackling-head-tilt));
  transform-origin: 80px 108px;
  transition: transform 420ms cubic-bezier(0.2, 0.82, 0.28, 1);
}

#stackling-mascot.is-seated .stackling-seated-body {
  transform: translateY(-6px) rotate(var(--stackling-body-lean));
  transform-origin: 80px 132px;
  transition: transform 420ms cubic-bezier(0.2, 0.82, 0.28, 1);
}

#stackling-mascot.is-seated .stackling-hands,
#stackling-mascot.is-seated .stackling-seated-body {
  opacity: 1;
}

#stackling-mascot.is-seated .stackling-peek-torso,
#stackling-mascot.is-seated .stackling-peek-arms {
  opacity: 0;
}

#stackling-mascot.is-seated .stackling-mouth-rest {
  opacity: 0;
  transition: none;
}

#stackling-mascot.is-seated .stackling-smile {
  opacity: 1;
  transform: scaleY(1);
  transition: none;
}

.stackling-mouth {
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.2, 0.82, 0.28, 1);
}

.stackling-mouth-rest {
  opacity: 1;
}

.stackling-smile {
  opacity: 0;
  transform: scaleY(0.35);
}

.stackling-mouth-focused,
.stackling-mouth-concerned,
.stackling-mouth-surprised {
  opacity: 0;
  transform: scale(0.55);
}

#stackling-mascot.is-expression-neutral .stackling-mouth,
#stackling-mascot.is-expression-happy .stackling-mouth,
#stackling-mascot.is-expression-curious .stackling-mouth,
#stackling-mascot.is-expression-focused .stackling-mouth,
#stackling-mascot.is-expression-concerned .stackling-mouth,
#stackling-mascot.is-expression-surprised .stackling-mouth {
  opacity: 0 !important;
  transition-delay: 0ms !important;
}

#stackling-mascot.is-expression-neutral .stackling-mouth-rest,
#stackling-mascot.is-expression-curious .stackling-mouth-rest {
  opacity: 1 !important;
  transform: scale(1) !important;
}

#stackling-mascot.is-expression-happy .stackling-smile {
  opacity: 1 !important;
  transform: scaleY(1) !important;
}

#stackling-mascot.is-expression-focused .stackling-mouth-focused,
#stackling-mascot.is-expression-concerned .stackling-mouth-concerned,
#stackling-mascot.is-expression-surprised .stackling-mouth-surprised {
  opacity: 1 !important;
  transform: scale(1) !important;
}

#stackling-mascot.is-peeking .stackling-mouth-rest {
  opacity: 0;
  transition-delay: 720ms;
}

#stackling-mascot.is-peeking .stackling-smile {
  opacity: 1;
  transform: scaleY(1);
  transition-delay: 760ms;
}

#stackling-mascot.is-retreating .stackling-mouth-rest {
  opacity: 1;
  transition-delay: 500ms;
}

#stackling-mascot.is-retreating .stackling-smile {
  opacity: 0;
  transform: scaleY(0.35);
  transition-delay: 0ms;
}

.stackling-eye {
  transform-box: fill-box;
  transform-origin: center;
}

.stackling-brow {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 320ms ease-out;
}

.stackling-brow-left {
  transform: translateY(var(--stackling-left-brow-y));
}

.stackling-brow-right {
  transform: translateY(var(--stackling-right-brow-y));
}

#stackling-mascot.is-expression-curious .stackling-brow-left {
  transform: translateY(calc(var(--stackling-left-brow-y) - 2px)) rotate(-5deg);
}

#stackling-mascot.is-expression-curious .stackling-brow-right {
  transform: translateY(calc(var(--stackling-right-brow-y) + 1px)) rotate(4deg);
}

#stackling-mascot.is-expression-focused .stackling-brow-left {
  transform: translateY(calc(var(--stackling-left-brow-y) + 2px)) rotate(7deg);
}

#stackling-mascot.is-expression-focused .stackling-brow-right {
  transform: translateY(calc(var(--stackling-right-brow-y) + 2px)) rotate(-7deg);
}

#stackling-mascot.is-expression-concerned .stackling-brow-left {
  transform: translateY(calc(var(--stackling-left-brow-y) - 1px)) rotate(-8deg);
}

#stackling-mascot.is-expression-concerned .stackling-brow-right {
  transform: translateY(calc(var(--stackling-right-brow-y) - 1px)) rotate(8deg);
}

#stackling-mascot.is-expression-surprised .stackling-brow-left,
#stackling-mascot.is-expression-surprised .stackling-brow-right {
  transform: translateY(-3px);
}

#stackling-mascot.is-studio-blinking .stackling-eye,
#stackling-mascot.is-studio-winking-left .stackling-eye-left,
#stackling-mascot.is-studio-winking-right .stackling-eye-right {
  animation: none !important;
  transform: scaleY(0.12);
}

#stackling-mascot.is-studio-blink-off .stackling-eye {
  animation: none !important;
}

.stackling-head-motion {
  transform-box: view-box;
  transform-origin: 80px 108px;
  will-change: transform;
}

#stackling-mascot.is-studio-idle:not(.is-studio-performing) .stackling-head-motion {
  animation: stackling-studio-head-idle var(--stackling-head-motion-duration) ease-in-out infinite;
}

#stackling-mascot.is-studio-performing .stackling-head-motion {
  animation: stackling-studio-head-perform 1500ms cubic-bezier(0.2, 0.82, 0.28, 1) both;
}

.stackling-pupil {
  transform: translate(var(--stackling-gaze-x), var(--stackling-gaze-y));
  transition: transform 90ms ease-out;
  will-change: transform;
}

#stackling-mascot.is-shy .stackling-eye,
#stackling-mascot.is-peeking .stackling-eye {
  animation: stackling-blink 3.8s ease-in-out 0.95s infinite;
}

.stackling-host {
  position: relative !important;
  overflow: visible !important;
  isolation: isolate;
}

.stackling-host.stackling-terminal-host {
  overflow: hidden !important;
}

.stackling-host.stackling-terminal-host.stackling-bottom-perch-host {
  overflow: visible !important;
}

.stackling-bottom-perch-host .concepts-terminal,
.stackling-bottom-perch-host .concepts-code-editor,
.stackling-bottom-perch-host #terminal .text-editor-wrap {
  clip-path: inset(0 0 var(--terminal-etch-bottom-overlap, 42px) 0 round 12px);
}

.demo-terminal-row .stackling-bottom-perch-host #terminal .text-editor-wrap {
  clip-path: none;
}

#white-paper > .row.stackling-host::before,
#home .container#examples .comparison-scroller > .col.stackling-host::before,
.home-concepts-section .concepts-feature-inner.stackling-host::before,
.examples-page .concepts-feature-inner.stackling-host::before,
.demo-terminal-row > .col.stackling-host::before,
.pricing-selfhosted.stackling-host::before {
  left: 16px !important;
  right: 16px !important;
}

.stackling-content-shield {
  position: relative !important;
  z-index: 4 !important;
}

@keyframes stackling-blink {
  0%, 7%, 11%, 100% { transform: scaleY(1); }
  9% { transform: scaleY(0.12); }
}

@keyframes stackling-studio-head-idle {
  0%, 16%, 100% { transform: translate(0, 0) rotate(0); }
  31% { transform: translate(0.35px, -0.45px) rotate(0.55deg); }
  52% { transform: translate(-0.25px, 0.15px) rotate(-0.38deg); }
  74% { transform: translate(0.15px, -0.2px) rotate(0.22deg); }
  87% { transform: translate(0, 0) rotate(0); }
}

@keyframes stackling-studio-head-perform {
  0% { transform: translateY(0) rotate(0); }
  18% { transform: translateY(0.8px) rotate(-0.45deg); }
  44% { transform: translateY(-2.2px) rotate(0.75deg); }
  68% { transform: translateY(-0.4px) rotate(-0.25deg); }
  100% { transform: translateY(0) rotate(0); }
}

.mascot-studio {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1050;
  width: 368px;
  max-height: calc(100vh - 36px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(38, 38, 38, 0.94);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(82, 82, 82, 0.97) 0%, rgba(47, 47, 47, 0.97) 76%, rgba(58, 58, 58, 0.97) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.46),
    0 9px 24px rgba(0, 0, 0, 0.30);
  color: #f2f2f2;
  font-family: Roboto, sans-serif;
  font-size: 12px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.64);
}

.mascot-studio.is-collapsed {
  width: 196px;
  overflow: visible;
}

.mascot-studio button {
  font-family: Roboto, sans-serif;
}

.mascot-studio-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 13px;
  border-bottom: 1px solid rgba(10, 10, 10, 0.72);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.mascot-studio-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid rgba(225, 225, 225, 0.76);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #e5e5e5);
  color: #2a2a2a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
  text-shadow: none;
}

.mascot-studio-heading {
  min-width: 0;
  flex: 1;
}

.mascot-studio-heading strong,
.mascot-studio-heading span {
  display: block;
}

.mascot-studio-heading strong {
  color: #fff;
  font-size: 13px;
  line-height: 1.1;
}

.mascot-studio-heading span {
  margin-top: 3px;
  color: #c8c8c8;
  font-size: 10px;
  font-weight: 500;
}

.mascot-studio-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #d7d7d7;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.mascot-studio-live::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9bcf85;
  box-shadow: 0 0 0 2px rgba(155, 207, 133, 0.14);
  content: '';
}

.mascot-studio-toggle {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: #f2f2f2;
  cursor: pointer;
}

.mascot-studio.is-collapsed .mascot-studio-heading span,
.mascot-studio.is-collapsed .mascot-studio-live {
  display: none;
}

.mascot-studio-choice,
.mascot-studio-action,
.mascot-studio-reset {
  min-height: 34px;
  border: 1px solid rgba(176, 176, 176, 0.78);
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff 0%, #eeeeee 100%);
  color: #222;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -1px 0 rgba(0, 0, 0, 0.09),
    0 1px 3px rgba(0, 0, 0, 0.24);
  font: 700 11px/1 Roboto, sans-serif;
  text-shadow: none;
  cursor: pointer;
}

.mascot-studio.is-collapsed .mascot-studio-panel {
  display: none;
}

.mascot-studio-panel {
  display: grid;
  gap: 0;
  padding: 0 12px 12px;
}

.mascot-studio-section {
  padding: 11px 0 10px;
  border-bottom: 1px solid rgba(230, 230, 230, 0.14);
}

.mascot-studio-section:last-of-type {
  border-bottom: 0;
}

.mascot-studio-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mascot-studio-section h3 {
  margin: 0;
  color: #f3f3f3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mascot-studio-note {
  color: #aaa;
  font-size: 9px;
  text-shadow: none;
}

.mascot-pose-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.mascot-pose-grid .mascot-studio-choice {
  display: grid;
  min-width: 0;
  min-height: 50px;
  place-items: center;
  gap: 3px;
  padding: 5px 2px;
}

.mascot-pose-grid i {
  color: #4d4d4d;
  font-size: 15px;
}

.mascot-pose-grid span {
  overflow: hidden;
  max-width: 100%;
  font-size: 9px;
  text-overflow: ellipsis;
}

.mascot-expression-row,
.mascot-eye-row,
.mascot-tempo-row {
  display: grid;
  gap: 5px;
}

.mascot-expression-row {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.mascot-expression-row .mascot-studio-choice {
  grid-column: span 3;
}

.mascot-expression-row .mascot-studio-choice:nth-child(n + 5) {
  grid-column: span 4;
}

.mascot-eye-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 6px;
}

.mascot-tempo-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mascot-studio-choice:hover,
.mascot-studio-choice:focus,
.mascot-studio-action:hover,
.mascot-studio-action:focus,
.mascot-studio-reset:hover,
.mascot-studio-reset:focus,
.mascot-studio-toggle:hover,
.mascot-studio-toggle:focus {
  outline: none;
  filter: brightness(1.04);
}

.mascot-studio-choice.is-active {
  border-color: #f4f4f4;
  background: linear-gradient(180deg, #d9d9d9, #f5f5f5);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(20, 20, 20, 0.72);
}

.mascot-motion-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}

.mascot-switch {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid rgba(15, 15, 15, 0.62);
  border-radius: 5px;
  background: rgba(20, 20, 20, 0.2);
  color: #eee;
  font-weight: 700;
}

.mascot-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mascot-switch-track {
  position: relative;
  width: 28px;
  height: 16px;
  flex: 0 0 28px;
  border: 1px solid #242424;
  border-radius: 8px;
  background: #777;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.52);
}

.mascot-switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f8f8f8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.46);
  content: '';
  transition: transform 160ms ease;
}

.mascot-switch input:checked + .mascot-switch-track {
  background: #9b9b9b;
}

.mascot-switch input:checked + .mascot-switch-track::after {
  transform: translateX(12px);
}

.mascot-studio-footer {
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 7px;
  padding-top: 4px;
}

.mascot-studio-reset,
.mascot-studio-action {
  padding: 0 10px;
}

.mascot-studio-action {
  border-color: #1f1f1f;
  background: linear-gradient(180deg, #fefefe, #d8d8d8);
}

.mascot-studio-action i,
.mascot-studio-reset i {
  margin-right: 5px;
}

@media (max-width: 767.98px) {
  :root {
    --stackling-size: 90px;
  }

  .mascot-studio {
    right: 10px;
    bottom: 76px;
    width: min(368px, calc(100vw - 20px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #stackling-mascot {
    display: none !important;
  }
}
