html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #ffd23f;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.mb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.mb__hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  color: #17141a;
}

.mb__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #17141a;
}

.mb__floor {
  position: relative;
  width: 100%;
  height: 150px;
  display: grid;
  place-items: end center;
}

.mb__char {
  position: relative;
  display: block;
  width: 136px;
  height: 132px;
}

.mb__body {
  position: absolute;
  left: 50%;
  bottom: 8px;
  display: block;
  width: 88px;
  height: 96px;
  margin-left: -44px;
  border-radius: 50% 50% 46% 46%;
  background: #17141a;
  transform-origin: 50% 100%;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.mb__eye {
  position: absolute;
  top: 40px;
  width: 10px;
  height: 12px;
  border-radius: 50%;
  background: #fff7e6;
  transform-origin: 50% 50%;
}

.mb__eye--l {
  left: 22px;
}

.mb__eye--r {
  right: 22px;
}

.mb.is-asleep .mb__eye {
  transform: scaleY(0.1);
}

.mb__cheek {
  position: absolute;
  top: 56px;
  width: 12px;
  height: 6px;
  border-radius: 999px;
  background: #ff9ebb;
  opacity: 0.9;
}

.mb__cheek--l {
  left: 14px;
}

.mb__cheek--r {
  right: 14px;
}

.mb__mouth {
  position: absolute;
  top: 60px;
  left: 50%;
  width: 16px;
  height: 8px;
  margin-left: -8px;
  border-bottom: 3px solid #fff7e6;
  border-radius: 0 0 999px 999px;
}

.mb__shadow {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 72px;
  height: 10px;
  margin-left: -36px;
  border-radius: 50%;
  background: rgba(23, 20, 26, 0.18);
}

.mb.is-asleep .mb__shadow {
  transform: scaleX(1.12);
}

.mb__zLayer {
  position: absolute;
  top: 0;
  right: -24px;
  width: 72px;
  height: 112px;
  pointer-events: none;
}

.mb__z {
  position: absolute;
  opacity: 0;
  color: #17141a;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  transform-origin: 50% 50%;
}

.mb__z--1 {
  left: 0;
  top: 52px;
  font-size: 13px;
}

.mb__z--2 {
  left: 26px;
  top: 30px;
  font-size: 17px;
}

.mb__z--3 {
  left: 52px;
  top: 10px;
  font-size: 21px;
}

.mb__state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.mb__dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f6df6;
}

.mb.is-asleep .mb__dot {
  background: #17141a;
}

.mb__stateText {
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  color: #17141a;
}

.mb.is-asleep .mb__body {
  animation-name: mzBreathSleep;
  animation-duration: 3.6s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

.mb.is-asleep .mb__z {
  animation-name: mzZFloat;
  animation-duration: 2.8s;
  animation-delay: calc(var(--i) * 0.46s);
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.mb.is-wake .mb__body {
  animation-name: mzWakePop;
  animation-duration: 460ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes mzBodyLoop {
  0% {
    transform: scale(1, 1);
  }
  8% {
    transform: scale(0.99, 1.015);
  }
  16% {
    transform: scale(1, 1);
  }
  22% {
    transform: scale(1.06, 0.93);
  }
  42% {
    transform: scale(1.03, 0.965);
  }
  68% {
    transform: scale(1.06, 0.93);
  }
  88%, 100% {
    transform: scale(1.015, 0.99);
  }
}
@keyframes mzLidLoop {
  0%, 16% {
    transform: scaleY(1);
  }
  18%, 100% {
    transform: scaleY(0.1);
  }
}
@keyframes mzShadowLoop {
  0% {
    transform: scaleX(1);
  }
  8% {
    transform: scaleX(0.97);
  }
  16% {
    transform: scaleX(1);
  }
  22% {
    transform: scaleX(1.12);
  }
  42% {
    transform: scaleX(1.06);
  }
  68% {
    transform: scaleX(1.12);
  }
  88%, 100% {
    transform: scaleX(1.03);
  }
}
@keyframes mzZLoop {
  0% {
    transform: translateY(8px) scale(0.4);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  78% {
    transform: translateY(-28px) scale(1);
  }
  100% {
    transform: translateY(-34px) scale(1);
    opacity: 1;
  }
}
@keyframes mzBreathSleep {
  0%, 100% {
    transform: scale(1.045, 0.955);
  }
  50% {
    transform: scale(1.02, 0.985);
  }
}
@keyframes mzZFloat {
  0% {
    transform: translateY(8px) scale(0.5);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    transform: translateY(-38px) scale(1);
    opacity: 0;
  }
}
@keyframes mzWakePop {
  0% {
    transform: scale(1.045, 0.955);
  }
  45% {
    transform: scale(0.97, 1.05);
  }
  100% {
    transform: scale(1, 1);
  }
}
.mb.is-demo .mb__body {
  animation-name: mzBodyLoop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

.mb.is-demo .mb__eye {
  animation-name: mzLidLoop;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.mb.is-demo .mb__shadow {
  animation-name: mzShadowLoop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

.mb.is-demo .mb__z {
  animation-name: mzZLoop;
  animation-duration: 2s;
  animation-delay: calc(var(--i) * 240ms);
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@media (max-width: 340px) {
  .mb {
    gap: 8px;
  }
  .mb__floor {
    height: 118px;
  }
  .mb__char {
    width: 120px;
    height: 112px;
  }
  .mb__body {
    width: 80px;
    height: 84px;
    margin-left: -40px;
  }
  .mb__eye {
    top: 36px;
    width: 9px;
    height: 11px;
  }
  .mb__eye--l {
    left: 20px;
  }
  .mb__eye--r {
    right: 20px;
  }
  .mb__cheek {
    top: 50px;
  }
  .mb__mouth {
    top: 54px;
  }
  .mb__shadow {
    width: 64px;
    margin-left: -32px;
  }
  .mb__zLayer {
    right: -20px;
    width: 64px;
    height: 96px;
  }
  .mb__z--1 {
    left: 0;
    top: 44px;
    font-size: 12px;
  }
  .mb__z--2 {
    left: 22px;
    top: 26px;
    font-size: 15px;
  }
  .mb__z--3 {
    left: 44px;
    top: 8px;
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .mb.is-demo .mb__body,
  .mb.is-demo .mb__eye,
  .mb.is-demo .mb__shadow,
  .mb.is-demo .mb__z,
  .mb.is-asleep .mb__body,
  .mb.is-asleep .mb__z,
  .mb.is-wake .mb__body {
    animation: none !important;
  }
  .mb.is-demo .mb__body {
    transform: scale(1.045, 0.955) !important;
  }
  .mb.is-demo .mb__eye {
    transform: scaleY(0.1) !important;
  }
  .mb.is-demo .mb__shadow {
    transform: scaleX(1.12) !important;
  }
  .mb.is-demo .mb__z {
    opacity: 1 !important;
    transform: translateY(-26px) scale(1) !important;
  }
  .mb.is-asleep .mb__body {
    transform: scale(1.045, 0.955) !important;
  }
  .mb.is-asleep .mb__shadow {
    transform: scaleX(1.12) !important;
  }
  .mb.is-asleep .mb__z {
    opacity: 1 !important;
    transform: translateY(-26px) scale(1) !important;
  }
}
