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);
}

.ch {
  position: relative;
  display: grid;
  justify-items: end;
  align-content: end;
  gap: 8px;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.ch__panel {
  box-sizing: border-box;
  width: min(236px, 92vw);
  height: 148px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 8px;
  border: 1px solid rgba(23, 20, 26, 0.14);
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 140ms linear;
}

.ch__head {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.ch__name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.ch__log {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: hidden;
}

.ch__bubble {
  margin: 0;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.45;
}

.ch__bubble--bot {
  justify-self: start;
  background: rgba(23, 20, 26, 0.07);
}

.ch__bubble--me {
  justify-self: end;
  background: #ff4d1f;
  color: #fff7e6;
}

.ch__form {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.ch__input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  height: 32px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid rgba(23, 20, 26, 0.22);
  border-radius: 999px;
  background: transparent;
  color: #17141a;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.3;
}

.ch__input::placeholder {
  color: rgba(23, 20, 26, 0.45);
}

.ch__input:focus-visible {
  outline: 2px solid #ff4d1f;
  outline-offset: 1px;
}

.ch__send {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ff4d1f;
  color: #fff7e6;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.ch__send:focus-visible {
  outline: 2px solid #17141a;
  outline-offset: 2px;
}

.ch__fab {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #17141a;
  color: #ff4d1f;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  transition: transform 140ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.ch__fab:focus-visible {
  outline: 3px solid #fff7e6;
  outline-offset: 3px;
}

.ch__fab:active {
  transform: scale(0.92);
}

.ch.is-open .ch__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@keyframes ch-loop-panel {
  0%, 9% {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  28%, 100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@keyframes ch-loop-me {
  0%, 42% {
    transform: translateY(10px);
    opacity: 0;
  }
  43% {
    opacity: 1;
  }
  56%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes ch-loop-dots {
  0%, 47% {
    transform: translateY(10px);
    opacity: 0;
  }
  48% {
    opacity: 1;
  }
  60%, 68% {
    transform: translateY(0);
    opacity: 1;
  }
  69%, 100% {
    transform: translateY(0);
    opacity: 0;
  }
}
@keyframes ch-loop-reply {
  0%, 68% {
    transform: translateY(10px);
    opacity: 0;
  }
  69% {
    opacity: 1;
  }
  80%, 100% {
    transform: translateY(0);
    opacity: 1;
  }
}
.ch__loop-me,
.ch__loop-dots,
.ch__loop-reply {
  justify-self: end;
  display: none;
}

.ch__loop-me {
  background: #ff4d1f;
  color: #fff7e6;
}

.ch__loop-dots,
.ch__loop-reply {
  justify-self: start;
  background: rgba(23, 20, 26, 0.07);
}

.ch.is-demo .ch__panel {
  animation-name: ch-loop-panel;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}
.ch.is-demo .ch__loop-me {
  display: block;
  animation-name: ch-loop-me;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.ch.is-demo .ch__loop-dots {
  display: block;
  animation-name: ch-loop-dots;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.ch.is-demo .ch__loop-reply {
  display: block;
  animation-name: ch-loop-reply;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@media (max-width: 340px) {
  .ch__panel {
    height: 112px;
    padding: 4px;
  }
  .ch__bubble {
    font-size: 10px;
  }
  .ch__input, .ch__send {
    height: 28px;
  }
  .ch__send {
    width: 28px;
    font-size: 14px;
  }
  .ch__fab {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ch.is-demo .ch__panel,
  .ch.is-demo .ch__loop-me,
  .ch.is-demo .ch__loop-dots,
  .ch.is-demo .ch__loop-reply {
    animation: none !important;
    transform: none !important;
  }
  .ch.is-demo .ch__panel {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .ch.is-demo .ch__loop-me,
  .ch.is-demo .ch__loop-reply {
    opacity: 1 !important;
    display: block !important;
  }
  .ch.is-demo .ch__loop-dots {
    opacity: 0 !important;
    display: none !important;
  }
}
