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

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

.tr {
  display: grid;
  place-items: center;
  width: 100%;
}

.tr__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tr__head {
  display: flex;
  justify-content: space-between;
  width: 250px;
}

.tr__side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tr__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(23, 20, 26, 0.28);
}

.tr__word {
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  color: rgba(23, 20, 26, 0.72);
}

.tr__side--off .tr__dot {
  background: #17141a;
}

.tr__side--off .tr__word {
  color: #17141a;
}

.tr.is-on .tr__side--off .tr__dot {
  background: rgba(23, 20, 26, 0.28);
}

.tr.is-on .tr__side--off .tr__word {
  color: rgba(23, 20, 26, 0.72);
}

.tr.is-on .tr__side--on .tr__dot {
  background: #17141a;
}

.tr.is-on .tr__side--on .tr__word {
  color: #17141a;
}

.tr__track {
  --travel: 163px;
  --roll: 271deg;
  position: relative;
  width: 250px;
  height: 84px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 247, 230, 0.06), rgba(23, 20, 26, 0.25)), #17141a;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.5), 0 3px 0 rgba(255, 255, 255, 0.5);
}

.tr__rack {
  position: absolute;
  left: 24px;
  right: 24px;
  height: 9px;
  display: flex;
  justify-content: space-between;
}

.tr__rack--top {
  top: 6px;
}

.tr__rack--bottom {
  bottom: 6px;
}

.tr__tooth {
  width: 13px;
  height: 100%;
  background: #fff7e6;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.tr__rack--top .tr__tooth {
  border-radius: 0 0 4px 4px;
}

.tr__rack--bottom .tr__tooth {
  border-radius: 4px 4px 0 0;
}

.tr__knob {
  position: absolute;
  left: 9px;
  top: 8px;
  width: 69px;
  height: 69px;
  transform: translateX(0);
  transition: transform 300ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.tr__roll {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(160deg, #fff7e6, rgba(255, 247, 230, 0.88) 45%, rgba(23, 20, 26, 0.16) 92%);
  box-shadow: 0 4px 8px rgba(23, 20, 26, 0.45), inset 0 2px 2px rgba(255, 255, 255, 0.8), inset 0 -3px 5px rgba(23, 20, 26, 0.22);
  transform: rotate(0deg);
  transition: transform 300ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.tr__grip {
  position: absolute;
  left: 22px;
  top: 17px;
  width: 24px;
  height: 34px;
  background: linear-gradient(90deg, rgba(23, 20, 26, 0.42) 0 2px, transparent 2px 11px) 0 0/11px 100%;
}

.tr__eyes {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tr__eye {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #17141a;
  transform: scaleY(0);
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.tr.is-on .tr__eye {
  transform: scaleY(1);
  transition: transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1) 300ms;
}

.tr.is-on .tr__knob {
  transform: translateX(var(--travel));
}

.tr.is-on .tr__roll {
  transform: rotate(var(--roll));
}

.tr__hit {
  position: absolute;
  inset: 0;
  z-index: 10;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

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

.tr__state {
  position: relative;
  margin: 0;
  width: 72px;
  height: 16px;
}

.tr__wordOn, .tr__wordOff {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  color: #17141a;
}

.tr__wordOn {
  display: none;
}

.tr.is-on .tr__wordOn {
  display: flex;
}

.tr.is-on .tr__wordOff {
  display: none;
}

.tr.is-demo .tr__knob, .tr.is-demo .tr__roll {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

.tr.is-demo .tr__knob {
  animation-name: trRollX;
}

.tr.is-demo .tr__roll {
  animation-name: trRollSpin;
}

@keyframes trRollX {
  0%, 8% {
    transform: translateX(0);
  }
  36% {
    transform: translateX(calc(var(--travel) + 5px));
  }
  42% {
    transform: translateX(calc(var(--travel) - 3px));
  }
  46%, 66% {
    transform: translateX(var(--travel));
  }
  88% {
    transform: translateX(-4px);
  }
  92% {
    transform: translateX(2px);
  }
  96%, 100% {
    transform: translateX(0);
  }
}
@keyframes trRollSpin {
  0%, 8% {
    transform: rotate(0deg);
  }
  36% {
    transform: rotate(calc(var(--roll) + 9deg));
  }
  42% {
    transform: rotate(calc(var(--roll) - 5deg));
  }
  46%, 66% {
    transform: rotate(var(--roll));
  }
  88% {
    transform: rotate(-7deg);
  }
  92% {
    transform: rotate(3deg);
  }
  96%, 100% {
    transform: rotate(0deg);
  }
}
.tr.is-demo .tr__eye {
  animation-name: trEyeLoop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes trEyeLoop {
  0%, 46% {
    transform: scaleY(0);
  }
  52%, 64% {
    transform: scaleY(1);
  }
  69%, 100% {
    transform: scaleY(0);
  }
}
.tr.is-demo .tr__side--off .tr__dot {
  animation-name: trDotOff;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trDotOff {
  0% {
    background-color: #17141a;
  }
  46% {
    background-color: rgba(23, 20, 26, 0.28);
  }
  92% {
    background-color: #17141a;
  }
  100% {
    background-color: #17141a;
  }
}
.tr.is-demo .tr__side--on .tr__dot {
  animation-name: trDotOn;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trDotOn {
  0% {
    background-color: rgba(23, 20, 26, 0.28);
  }
  46% {
    background-color: #17141a;
  }
  92% {
    background-color: rgba(23, 20, 26, 0.28);
  }
  100% {
    background-color: rgba(23, 20, 26, 0.28);
  }
}
.tr.is-demo .tr__side--off .tr__word {
  animation-name: trLitOff;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trLitOff {
  0% {
    color: #17141a;
  }
  46% {
    color: rgba(23, 20, 26, 0.72);
  }
  92% {
    color: #17141a;
  }
  100% {
    color: #17141a;
  }
}
.tr.is-demo .tr__side--on .tr__word {
  animation-name: trLitOn;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trLitOn {
  0% {
    color: rgba(23, 20, 26, 0.72);
  }
  46% {
    color: #17141a;
  }
  92% {
    color: rgba(23, 20, 26, 0.72);
  }
  100% {
    color: rgba(23, 20, 26, 0.72);
  }
}
.tr.is-demo .tr__wordOn {
  display: flex;
  opacity: 0;
}

.tr.is-demo .tr__wordOff {
  opacity: 1;
}

.tr.is-demo .tr__wordOn {
  animation-name: trWordOn;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trWordOn {
  0%, 46% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  92% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
.tr.is-demo .tr__wordOff {
  animation-name: trWordOff;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes trWordOff {
  0%, 46% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  92% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@media (max-width: 340px) {
  .tr__unit {
    gap: 4px;
  }
  .tr__head {
    width: 210px;
  }
  .tr__word {
    font-size: 11px;
  }
  .tr__track {
    --travel: 142px;
    --roll: 313deg;
    width: 210px;
    height: 64px;
  }
  .tr__rack {
    left: 20px;
    right: 20px;
    height: 7px;
  }
  .tr__rack--top {
    top: 4px;
  }
  .tr__rack--bottom {
    bottom: 4px;
  }
  .tr__tooth {
    width: 11px;
  }
  .tr__knob {
    left: 8px;
    top: 6px;
    width: 52px;
    height: 52px;
  }
  .tr__grip {
    left: 17px;
    top: 13px;
    width: 18px;
    height: 26px;
    background: linear-gradient(90deg, rgba(23, 20, 26, 0.42) 0 2px, transparent 2px 8px) 0 0/8px 100%;
  }
  .tr__eye {
    width: 6px;
    height: 6px;
  }
  .tr__state {
    width: 60px;
    height: 14px;
  }
  .tr__wordOn, .tr__wordOff {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tr .tr__knob {
    transition: none !important;
  }
  .tr .tr__roll {
    transition: none !important;
  }
  .tr .tr__eye {
    transition: none !important;
  }
  .tr.is-demo .tr__knob {
    animation: none !important;
    transform: translateX(0) !important;
  }
  .tr.is-demo .tr__roll {
    animation: none !important;
    transform: rotate(0deg) !important;
  }
  .tr.is-demo .tr__eye {
    animation: none !important;
    transform: scaleY(0) !important;
  }
  .tr.is-demo .tr__dot {
    animation: none !important;
  }
  .tr.is-demo .tr__word {
    animation: none !important;
  }
  .tr.is-demo .tr__wordOn {
    animation: none !important;
    opacity: 0 !important;
  }
  .tr.is-demo .tr__wordOff {
    animation: none !important;
    opacity: 1 !important;
  }
}
