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

.dt {
  position: relative;
  box-sizing: border-box;
  width: min(312px, 92vw);
  border-radius: 16px;
  background: #231f28;
  border: 1px solid rgba(255, 247, 230, 0.16);
  color: #fff7e6;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  overflow: hidden;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.dt__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
}

.dt__title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.dt__attr {
  margin: 0;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.3;
  color: rgba(255, 247, 230, 0.75);
}
.dt__attr code {
  font-family: "Consolas", "Menlo", monospace;
}

.dt__view {
  height: 168px;
  overflow-y: auto;
  padding: 0 12px;
  outline: none;
}

.dt__track {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  padding-bottom: 120px;
}

.dt__hint {
  margin: 0;
  box-sizing: border-box;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  color: rgba(255, 247, 230, 0.75);
  border: 1px dashed rgba(255, 247, 230, 0.32);
  border-radius: 12px;
  padding: 12px 0;
  text-align: center;
}

.dt__card {
  box-sizing: border-box;
  margin-top: 116px;
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7e6;
  color: #17141a;
  opacity: 0;
  transform: translateY(28px);
  transition-property: opacity, transform;
  transition-duration: 220ms, 600ms;
  transition-timing-function: ease-out, cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dt__card b {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  color: #0a4fe8;
}
.dt__card span {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.dt__card[data-dir=up] {
  transform: translateY(-28px);
}

.dt__card.is-visible {
  opacity: 1;
  transform: none;
}

.dt__card.is-exit[data-dir=down] {
  opacity: 0;
  transform: translateY(-30px) rotate(-5deg) scale(0.94);
}

.dt__card.is-exit[data-dir=up] {
  opacity: 0;
  transform: translateY(34px) rotate(5deg) scale(0.94);
}

.dt__filler {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  color: rgba(255, 247, 230, 0.75);
  border-radius: 12px;
  background: rgba(255, 247, 230, 0.08);
  padding: 24px 0;
  text-align: center;
}

.dt__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 247, 230, 0.16);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.dt__dirBox {
  position: relative;
  height: 20px;
  flex: 0 0 auto;
}

.dt__dir {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  opacity: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  color: #5b8cf8;
}

[data-dir=down] .dt__dir--down {
  opacity: 1;
}

[data-dir=up] .dt__dir--up {
  opacity: 1;
}

.dt__ico {
  width: 12px;
  height: 12px;
}

.dt__phase {
  position: relative;
  height: 20px;
  margin-left: auto;
}

.dt__phaseWait,
.dt__phaseIn,
.dt__phaseOut {
  position: absolute;
  right: 0;
  top: 0;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
}

.dt__phaseWait {
  background: rgba(255, 247, 230, 0.16);
  color: #fff7e6;
  opacity: 1;
}

.dt__phaseIn {
  background: #5b8cf8;
  color: #17141a;
}

.dt__phaseOut {
  background: #fff7e6;
  color: #17141a;
}

.dt.is-enter .dt__phaseWait {
  opacity: 0;
}

.dt.is-enter .dt__phaseIn {
  opacity: 1;
}

.dt.is-leave .dt__phaseWait {
  opacity: 0;
}

.dt.is-leave .dt__phaseOut {
  opacity: 1;
}

.dt.is-demo .dt__track {
  animation-name: dt-flow;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.dt.is-demo .dt__card {
  animation-name: dt-cut, dt-move;
  animation-duration: 2s, 2s;
  animation-timing-function: steps(1, end), cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite, infinite;
  animation-fill-mode: backwards, backwards;
}
.dt.is-demo .dt__hint {
  animation-name: dt-hint;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}
.dt.is-demo .dt__phaseWait {
  animation-name: dt-p-wait;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}
.dt.is-demo .dt__phaseIn {
  animation-name: dt-p-in;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}
.dt.is-demo .dt__phaseOut {
  animation-name: dt-p-out;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes dt-flow {
  0%, 8% {
    transform: translateY(0);
  }
  26%, 56% {
    transform: translateY(-144px);
    animation-timing-function: linear;
  }
  80%, 100% {
    transform: translateY(-264px);
  }
}
@keyframes dt-cut {
  0% {
    opacity: 0;
  }
  10%, 78% {
    opacity: 1;
  }
  80%, 100% {
    opacity: 0;
  }
}
@keyframes dt-move {
  0% {
    transform: translateY(28px);
  }
  26%, 56% {
    transform: none;
    animation-timing-function: linear;
  }
  80%, 100% {
    transform: translateY(-30px) rotate(-5deg) scale(0.94);
  }
}
@keyframes dt-hint {
  0%, 10% {
    opacity: 1;
  }
  12%, 100% {
    opacity: 0;
  }
}
@keyframes dt-p-wait {
  0%, 12% {
    opacity: 1;
  }
  14%, 100% {
    opacity: 0;
  }
}
@keyframes dt-p-in {
  0%, 12% {
    opacity: 0;
  }
  14%, 58% {
    opacity: 1;
  }
  60%, 100% {
    opacity: 0;
  }
}
@keyframes dt-p-out {
  0%, 60% {
    opacity: 0;
  }
  62%, 100% {
    opacity: 1;
  }
}
@media (max-width: 340px) {
  .dt {
    width: 100%;
  }
  .dt__head {
    padding: 4px 8px;
  }
  .dt__view {
    height: 108px;
  }
  .dt__hint {
    padding: 8px 0;
  }
  .dt__card {
    margin-top: 96px;
  }
  .dt__filler {
    padding: 16px 0;
  }
  .dt__foot {
    padding: 4px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .dt__card {
    transition: none !important;
  }
  .dt.is-demo .dt__track,
  .dt.is-demo .dt__card,
  .dt.is-demo .dt__hint,
  .dt.is-demo .dt__phaseWait,
  .dt.is-demo .dt__phaseIn,
  .dt.is-demo .dt__phaseOut {
    animation: none !important;
  }
  .dt.is-demo .dt__card {
    opacity: 1 !important;
    transform: none !important;
  }
  .dt.is-demo .dt__track {
    transform: translateY(-144px) !important;
  }
  .dt.is-demo .dt__hint {
    opacity: 0 !important;
  }
  .dt.is-demo .dt__phaseIn {
    opacity: 1 !important;
  }
  .dt.is-demo .dt__phaseWait,
  .dt.is-demo .dt__phaseOut {
    opacity: 0 !important;
  }
}
