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

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

.cb {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.cb__work {
  position: relative;
  flex: 1 1 auto;
  aspect-ratio: 3/2;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  touch-action: none;
}

.cb__photo {
  display: block;
  width: 100%;
  height: 100%;
}

.cb__shade {
  position: absolute;
  inset: 0;
  background: rgba(23, 20, 26, 0.58);
  pointer-events: none;
}

.cb__box {
  position: absolute;
  border: 2px solid #ffffff;
  cursor: move;
}

.cb__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.5) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 33.34% 33.34%;
  background-position: 33.33% 33.33%;
}

.cb__h {
  position: absolute;
  width: 11px;
  height: 11px;
  padding: 0;
  cursor: pointer;
  border: 2px solid #17141a;
  border-radius: 50%;
  background: #ffffff;
}

.cb__h:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 2px;
}

.cb__h--nw {
  left: -6px;
  top: -6px;
}

.cb__h--n {
  left: calc(50% - 6px);
  top: -6px;
}

.cb__h--ne {
  right: -6px;
  top: -6px;
}

.cb__h--w {
  left: -6px;
  top: calc(50% - 6px);
}

.cb__h--e {
  right: -6px;
  top: calc(50% - 6px);
}

.cb__h--sw {
  left: -6px;
  bottom: -6px;
}

.cb__h--s {
  left: calc(50% - 6px);
  bottom: -6px;
}

.cb__h--se {
  right: -6px;
  bottom: -6px;
}

.cb__side {
  flex: 0 0 auto;
  width: 96px;
}

.cb__cap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px;
  font-weight: 800;
  font-size: clamp(9px, 2.4vw, 11px);
  color: #17141a;
}

.cb__ico {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.cb__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3/2;
  display: grid;
  place-items: center;
  border-radius: 4px;
  overflow: hidden;
  background: #fff7e6;
}

.cb__out {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.cb__ghost {
  display: none;
  position: absolute;
  inset: 0;
  background-image: var(--photo);
  background-size: 185% 179%;
  background-position: 39% 36%;
}

.cb__size {
  margin: 4px 0 0;
  font-weight: 700;
  font-size: clamp(9px, 2.4vw, 11px);
  color: rgba(23, 20, 26, 0.72);
}

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

@keyframes cbMove {
  0%, 8% {
    transform: translate(0, 0);
  }
  40%, 56% {
    transform: translate(25.9%, 14.3%);
  }
  86%, 100% {
    transform: translate(0, 0);
  }
}
.cb.is-demo .cb__shade {
  animation-name: cbShade;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cbShade {
  0%, 8% {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 18% 16%, 18% 72%, 72% 72%, 72% 16%, 18% 16%);
  }
  40%, 56% {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 32% 24%, 32% 80%, 86% 80%, 86% 24%, 32% 24%);
  }
  86%, 100% {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 18% 16%, 18% 72%, 72% 72%, 72% 16%, 18% 16%);
  }
}
.cb.is-demo .cb__out {
  visibility: hidden;
}

.cb.is-demo .cb__ghost {
  display: block;
  animation-name: cbGhost;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cbGhost {
  0%, 8% {
    background-position: 39% 36%;
  }
  40%, 56% {
    background-position: 70% 54%;
  }
  86%, 100% {
    background-position: 39% 36%;
  }
}
.cb.is-demo .cb__h--se {
  animation-name: cbPop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes cbPop {
  0%, 6% {
    transform: scale(1);
  }
  14%, 46% {
    transform: scale(1.7);
  }
  60%, 100% {
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .cb {
    gap: 8px;
  }
  .cb__side {
    width: 76px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cb.is-demo .cb__box,
  .cb.is-demo .cb__shade,
  .cb.is-demo .cb__ghost,
  .cb.is-demo .cb__h--se {
    animation: none !important;
  }
  .cb.is-demo .cb__box {
    transform: translate(25.9%, 14.3%) !important;
  }
  .cb.is-demo .cb__shade {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 32% 24%, 32% 80%, 86% 80%, 86% 24%, 32% 24%) !important;
  }
  .cb.is-demo .cb__ghost {
    background-position: 70% 54% !important;
  }
}
