@property --d {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
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);
}

.od {
  display: flex;
  justify-content: center;
  width: 100%;
}

.od__board {
  width: min(100%, 320px);
  background: #231f28;
  border-radius: 16px;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  padding: 16px 12px;
  overflow: hidden;
  text-align: center;
}

.od__label {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  line-height: 1.4;
  color: #9a93a6;
  letter-spacing: 0.06em;
}

.od__value {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(26px, 9vw, 40px);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: #ff7a5e;
  transition: color 300ms ease-out;
}

.od.is-up .od__value {
  color: #3ddc97;
}

.od.is-down .od__value {
  color: #ff7a5e;
}

.od__sign {
  display: grid;
  width: 0.66em;
  height: 1.15em;
}

.od__glyph {
  grid-area: 1/1;
  line-height: 1.15;
}

.od:not(.is-demo) .od__glyph--b {
  opacity: 0;
}

.od__digit {
  display: block;
  overflow: hidden;
  width: 0.64em;
  height: 1.15em;
}

.od__strip {
  display: block;
  transform: translateY(calc(var(--d) * -1.15em));
  transition: --d 600ms ease-out;
}

.od__n {
  display: block;
  height: 1.15em;
  line-height: 1.15;
  text-align: center;
}

.od__fixed {
  display: block;
  width: 0.3em;
  height: 1.15em;
  line-height: 1.15;
}

.od__digit.is-lead, .od__fixed.is-lead {
  opacity: 0.32;
}

.od__unit {
  align-self: center;
  margin-left: 4px;
  font-weight: 700;
  font-size: 0.42em;
  line-height: 1.4;
  color: #9a93a6;
}

.od__delta {
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.od__deltaLabel {
  color: #9a93a6;
}

.od__deltaWrap {
  display: grid;
  justify-items: center;
}

.od__deltaText {
  grid-area: 1/1;
}

.od__deltaText--a, .od__deltaText.is-minus {
  color: #ff7a5e;
}

.od__deltaText--b, .od__deltaText.is-plus {
  color: #3ddc97;
}

.od__delta .od__unit {
  font-size: 1em;
  margin-left: 0;
}

.od:not(.is-demo) .od__deltaText--b {
  opacity: 0;
}

.od.is-demo .od__value {
  animation-name: odHue;
}

.od.is-demo .od__strip[data-d="0"] {
  animation-name: odRoll0;
}

.od.is-demo .od__strip[data-d="1"] {
  animation-name: odRoll1;
}

.od.is-demo .od__strip[data-d="2"] {
  animation-name: odRoll2;
}

.od.is-demo .od__strip[data-d="3"] {
  animation-name: odRoll3;
}

.od.is-demo .od__strip[data-d="4"] {
  animation-name: odRoll4;
}

.od.is-demo .od__strip[data-d="5"] {
  animation-name: odRoll5;
}

.od.is-demo .od__value, .od.is-demo .od__strip {
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes odRoll5 {
  0%, 24% {
    --d: 5;
  }
  30%, 60% {
    --d: 5;
  }
  66%, 100% {
    --d: 5;
  }
}
@keyframes odRoll4 {
  0%, 27% {
    --d: 2;
  }
  33%, 63% {
    --d: 6;
  }
  69%, 100% {
    --d: 2;
  }
}
@keyframes odRoll3 {
  0%, 30% {
    --d: 9;
  }
  36%, 66% {
    --d: 6;
  }
  72%, 100% {
    --d: 9;
  }
}
@keyframes odRoll2 {
  0%, 33% {
    --d: 6;
  }
  39%, 69% {
    --d: 7;
  }
  75%, 100% {
    --d: 6;
  }
}
@keyframes odRoll1 {
  0%, 36% {
    --d: 3;
  }
  42%, 72% {
    --d: 7;
  }
  78%, 100% {
    --d: 3;
  }
}
@keyframes odRoll0 {
  0%, 39% {
    --d: 1;
  }
  45%, 75% {
    --d: 2;
  }
  81%, 100% {
    --d: 1;
  }
}
@keyframes odHue {
  0%, 24% {
    color: #ff7a5e;
  }
  45%, 60% {
    color: #3ddc97;
  }
  81%, 100% {
    color: #ff7a5e;
  }
}
.od.is-demo .od__glyph--a, .od.is-demo .od__glyph--b,
.od.is-demo .od__deltaText--a, .od.is-demo .od__deltaText--b {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.od.is-demo .od__glyph--a, .od.is-demo .od__deltaText--a {
  animation-name: odCutA;
}

.od.is-demo .od__glyph--b, .od.is-demo .od__deltaText--b {
  animation-name: odCutB;
}

@keyframes odCutA {
  0%, 23% {
    opacity: 1;
  }
  25%, 59% {
    opacity: 0;
  }
  61%, 100% {
    opacity: 1;
  }
}
@keyframes odCutB {
  0%, 23% {
    opacity: 0;
  }
  25%, 59% {
    opacity: 1;
  }
  61%, 100% {
    opacity: 0;
  }
}
@media (max-width: 340px) {
  .od__board {
    padding: 8px;
  }
  .od__label {
    margin: 0 0 4px;
  }
  .od__delta {
    margin: 4px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .od__value {
    transition: none !important;
  }
  .od__strip {
    transition: none !important;
  }
  .od.is-demo .od__value, .od.is-demo .od__strip {
    animation: none !important;
  }
  .od.is-demo .od__glyph--a, .od.is-demo .od__deltaText--a {
    animation: none !important;
    opacity: 1 !important;
  }
  .od.is-demo .od__glyph--b, .od.is-demo .od__deltaText--b {
    animation: none !important;
    opacity: 0 !important;
  }
}
