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

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

.tc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  width: min(100%, 408px);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

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

.tc__sign {
  flex: 0 0 auto;
  color: #2b9d74;
  font-weight: 800;
  font-size: clamp(11px, 3vw, 12px);
  line-height: 1.4;
}

.tc__input {
  flex: 1 1 auto;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff7e6;
  font-family: inherit;
  font-weight: 600;
  font-size: clamp(10px, 2.8vw, 12px);
  line-height: 1.4;
}

.tc__input:focus-visible {
  outline: 2px solid #2f6df6;
  outline-offset: 1px;
}

.tc__hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  font-size: clamp(9px, 2.4vw, 10px);
  line-height: 1.3;
}

.tc.is-open .tc__hint {
  visibility: hidden;
}

.tc__cands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  visibility: hidden;
}

.tc.is-open .tc__cands {
  visibility: visible;
}

.tc__cand {
  position: relative;
  box-sizing: border-box;
  padding: 4px 8px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-weight: 600;
  font-size: clamp(9px, 2.6vw, 11px);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
}

.tc__cand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 2px;
  border-radius: 999px;
  background: #2b9d74;
  transform: scaleY(0);
  transform-origin: center top;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tc__cand[aria-selected=true] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff7e6;
}

.tc__cand[aria-selected=true]::before {
  transform: scaleY(1);
}

.tc.is-demo .tc__cands,
.tc.is-demo .tc__hint {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.tc.is-demo .tc__cands {
  animation-name: tcOpen;
}

.tc.is-demo .tc__hint {
  animation-name: tcHint;
}

@keyframes tcOpen {
  0%, 16% {
    visibility: hidden;
  }
  17%, 100% {
    visibility: visible;
  }
}
@keyframes tcHint {
  0%, 16% {
    visibility: visible;
  }
  17%, 100% {
    visibility: hidden;
  }
}
.tc.is-demo .tc__cand {
  animation-name: tcDrop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
  animation-delay: calc(var(--i) * 40ms);
}

@keyframes tcDrop {
  0%, 17% {
    transform: translateY(-6px);
  }
  27%, 100% {
    transform: translateY(0);
  }
}
.tc.is-demo .tc__cand:nth-child(1) {
  animation-name: tcDrop, tcPick1;
}

.tc.is-demo .tc__cand:nth-child(2) {
  animation-name: tcDrop, tcPick2;
}

.tc.is-demo .tc__cand:nth-child(4) {
  animation-name: tcDrop, tcPick3;
}

.tc.is-demo .tc__cand:nth-child(1),
.tc.is-demo .tc__cand:nth-child(2),
.tc.is-demo .tc__cand:nth-child(4) {
  animation-duration: 2s, 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1), steps(1, end);
  animation-iteration-count: infinite, infinite;
  animation-fill-mode: backwards, backwards;
  animation-delay: calc(var(--i) * 40ms), 0s;
}

@keyframes tcPick1 {
  0%, 39% {
    background: rgba(255, 255, 255, 0.1);
    color: #fff7e6;
  }
  40%, 100% {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
  }
}
@keyframes tcPick2 {
  0%, 39% {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
  }
  40%, 67% {
    background: rgba(255, 255, 255, 0.1);
    color: #fff7e6;
  }
  68%, 100% {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
  }
}
@keyframes tcPick3 {
  0%, 67% {
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
  }
  68%, 100% {
    background: rgba(255, 255, 255, 0.1);
    color: #fff7e6;
  }
}
.tc.is-demo .tc__cand:nth-child(1)::before {
  animation-name: tcMark1;
}

.tc.is-demo .tc__cand:nth-child(2)::before {
  animation-name: tcMark2;
}

.tc.is-demo .tc__cand:nth-child(4)::before {
  animation-name: tcMark3;
}

.tc.is-demo .tc__cand::before {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes tcMark1 {
  0%, 17% {
    transform: scaleY(0);
  }
  27%, 39% {
    transform: scaleY(1);
  }
  40%, 100% {
    transform: scaleY(0);
  }
}
@keyframes tcMark2 {
  0%, 40% {
    transform: scaleY(0);
  }
  50%, 67% {
    transform: scaleY(1);
  }
  68%, 100% {
    transform: scaleY(0);
  }
}
@keyframes tcMark3 {
  0%, 68% {
    transform: scaleY(0);
  }
  78%, 100% {
    transform: scaleY(1);
  }
}
@media (max-width: 340px) {
  .tc {
    padding: 8px;
    gap: 4px;
  }
  .tc__cands {
    gap: 0 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tc.is-demo .tc__cands,
  .tc.is-demo .tc__hint,
  .tc.is-demo .tc__cand,
  .tc.is-demo .tc__cand::before {
    animation: none !important;
  }
  .tc.is-demo .tc__cands {
    visibility: visible !important;
  }
  .tc.is-demo .tc__hint {
    visibility: hidden !important;
  }
  .tc__cand::before {
    transition: none !important;
  }
}
