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

.cp {
  box-sizing: border-box;
  width: min(300px, 92vw);
  padding: 12px;
  border-radius: 16px;
  background: #17141a;
  color: #fff7e6;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.cp * {
  box-sizing: border-box;
}

.cp__title {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.cp__sum {
  display: grid;
}

.cp__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  font-size: 11px;
  line-height: 1.4;
}

.cp__k {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  opacity: 0.74;
}

.cp__v {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cp__v--off {
  color: #ffd23f;
}

.cp__line--disc .cp__k {
  color: #ffd23f;
  opacity: 1;
}

.cp__line--total {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 247, 230, 0.22);
  font-size: 12px;
}

.cp__v--total {
  position: relative;
  font-size: 13px;
}

.cp__alt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center end;
  opacity: 0;
}

.cp__disc {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cp.is-on .cp__disc {
  grid-template-rows: 1fr;
}

.cp__box {
  min-height: 0;
  overflow: hidden;
}

.cp__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.cp__field {
  position: relative;
  display: grid;
}

.cp__code {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(255, 247, 230, 0.28);
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.1);
  color: #fff7e6;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
}
.cp__code::placeholder {
  color: rgba(255, 247, 230, 0.5);
  font-weight: 500;
  letter-spacing: 0;
}
.cp__code:focus-visible {
  outline: 2px solid #ffd23f;
  outline-offset: 1px;
}

.cp__ghost {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: center;
  padding-left: 8px;
  color: transparent;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.cp__go {
  padding: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: #ffd23f;
  color: #17141a;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.cp__go:focus-visible {
  outline: 2px solid #fff7e6;
  outline-offset: 2px;
}

.cp__msg {
  position: relative;
  min-height: 14px;
  margin: 4px 0 0;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.cp__msg-t {
  opacity: 0;
  transition: opacity 220ms ease-out;
}

.cp.is-said .cp__msg-t {
  opacity: 1;
}

.cp__msg-d {
  position: absolute;
  inset: 0;
  opacity: 0;
}

@keyframes cp-open {
  0% {
    grid-template-rows: 0fr;
    animation-timing-function: steps(1, end);
  }
  24% {
    grid-template-rows: 0fr;
    animation-timing-function: steps(1, end);
  }
  25% {
    grid-template-rows: 1fr;
    animation-timing-function: steps(1, end);
  }
  70% {
    grid-template-rows: 1fr;
    animation-timing-function: ease-out;
  }
  86% {
    grid-template-rows: 0fr;
  }
  100% {
    grid-template-rows: 0fr;
  }
}
@keyframes cp-settle {
  0%, 24% {
    transform: translateY(-8px);
  }
  45%, 100% {
    transform: translateY(0);
  }
}
@keyframes cp-ghost {
  0%, 11% {
    opacity: 0;
  }
  12%, 85% {
    opacity: 1;
  }
  86%, 100% {
    opacity: 0;
  }
}
@keyframes cp-press {
  0%, 20% {
    transform: scale(1);
  }
  25% {
    transform: scale(0.88);
  }
  37%, 100% {
    transform: scale(1);
  }
}
@keyframes cp-a {
  0%, 24% {
    opacity: 1;
  }
  25%, 85% {
    opacity: 0;
  }
  86%, 100% {
    opacity: 1;
  }
}
@keyframes cp-b {
  0%, 24% {
    opacity: 0;
  }
  25%, 85% {
    opacity: 1;
  }
  86%, 100% {
    opacity: 0;
  }
}
.cp.is-demo .cp__code::placeholder {
  color: transparent;
}
.cp.is-demo .cp__ghost {
  color: #fff7e6;
  animation-name: cp-ghost;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.cp.is-demo .cp__disc {
  animation-name: cp-open;
  animation-duration: 2s;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.cp.is-demo .cp__line--disc {
  animation-name: cp-settle;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.cp.is-demo .cp__go {
  animation-name: cp-press;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.cp.is-demo .cp__swap .cp__t {
  animation-name: cp-a;
}
.cp.is-demo .cp__swap .cp__alt,
.cp.is-demo .cp__msg-d {
  animation-name: cp-b;
}
.cp.is-demo .cp__swap .cp__t,
.cp.is-demo .cp__swap .cp__alt,
.cp.is-demo .cp__msg-d {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@media (max-width: 340px) {
  .cp {
    padding: 8px;
  }
  .cp__line {
    padding: 0;
  }
  .cp__line--total {
    padding-top: 4px;
  }
  .cp__form {
    gap: 4px;
  }
  .cp__go {
    padding: 4px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cp.is-demo .cp__disc,
  .cp.is-demo .cp__line--disc,
  .cp.is-demo .cp__go,
  .cp.is-demo .cp__t {
    animation: none !important;
    transform: none !important;
  }
  .cp.is-demo .cp__t {
    opacity: 1 !important;
  }
  .cp.is-demo .cp__alt,
  .cp.is-demo .cp__msg-d {
    animation: none !important;
    opacity: 0 !important;
  }
  .cp.is-demo .cp__ghost {
    animation: none !important;
    opacity: 0 !important;
  }
  .cp.is-demo .cp__code::placeholder {
    color: rgba(255, 247, 230, 0.5) !important;
  }
  .cp__disc {
    transition: none !important;
  }
  .cp__msg-t {
    transition: none !important;
  }
}
