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

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

.cg {
  box-sizing: border-box;
  width: min(384px, 88vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  --step: 36px;
  --fold: 12px;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  color: #17141a;
}

.cg__box {
  position: relative;
  width: 100%;
  height: 150px;
}

.cg__list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cg__item {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  z-index: calc(9 - var(--i));
  transform: translateY(calc(var(--i) * var(--fold) * -1)) scale(calc(1 - var(--i) * 0.04));
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
}

.cg__list.is-open .cg__item {
  transform: translateY(calc(var(--i) * var(--step) * -1)) scale(1);
}

.cg__in {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff7e6;
  color: #17141a;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
}

.cg__ic {
  display: inline-flex;
  flex: 0 0 auto;
  color: #2f6df6;
}

.cg__ic svg {
  display: block;
}

.cg__msg {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cg__more {
  flex: 0 0 auto;
  padding: 0 8px;
  border-radius: 999px;
  background: #17141a;
  color: #fff7e6;
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
}

.cg__list.is-open .cg__more {
  opacity: 0;
}

.cg__toggle {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 16px;
  border: 0;
  border-radius: 999px;
  background: #17141a;
  color: #fff7e6;
  font-family: inherit;
  font-size: 12px;
  line-height: 20px;
  font-weight: 700;
  cursor: pointer;
}

.cg__caret {
  display: inline-flex;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cg__caret svg {
  display: block;
}

.cg__toggle[aria-expanded=true] .cg__caret {
  transform: rotate(180deg);
}

.cg__toggle:focus-visible {
  outline: 2px solid #fff7e6;
  outline-offset: 2px;
}

.cg.is-demo .cg__item {
  transition: none;
  animation-name: cg-fan;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cg-fan {
  0%, 26% {
    transform: translateY(calc(var(--i) * var(--fold) * -1)) scale(calc(1 - var(--i) * 0.04));
  }
  42% {
    transform: translateY(calc(var(--i) * var(--step) * -1)) scale(1);
  }
  68% {
    transform: translateY(calc(var(--i) * var(--step) * -1)) scale(1);
  }
  84% {
    transform: translateY(calc(var(--i) * var(--fold) * -1)) scale(calc(1 - var(--i) * 0.04));
  }
  90%, 100% {
    transform: translateY(calc(var(--i) * var(--fold) * -1)) scale(calc(1 - var(--i) * 0.04));
  }
}
.cg.is-demo .cg__more {
  animation-name: cg-more;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes cg-more {
  0% {
    opacity: 1;
  }
  31% {
    opacity: 0;
  }
  81% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
.cg.is-demo .cg__caret {
  transition: none;
  animation-name: cg-caret;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes cg-caret {
  0%, 26% {
    transform: rotate(0deg);
  }
  42% {
    transform: rotate(180deg);
  }
  68% {
    transform: rotate(180deg);
  }
  84% {
    transform: rotate(0deg);
  }
  90%, 100% {
    transform: rotate(0deg);
  }
}
@media (max-width: 340px) {
  .cg {
    gap: 8px;
    --step: 28px;
    --fold: 8px;
  }
  .cg__box {
    height: 118px;
  }
  .cg__in {
    padding: 4px 8px;
  }
  .cg__msg {
    font-size: 11px;
    line-height: 16px;
  }
  .cg__more {
    font-size: 10px;
    line-height: 16px;
  }
  .cg__toggle {
    padding: 0 12px;
    font-size: 11px;
    line-height: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cg.is-demo .cg__item,
  .cg.is-demo .cg__more,
  .cg.is-demo .cg__caret {
    animation: none !important;
  }
  .cg__item,
  .cg__caret {
    transition: none;
  }
}
