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

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

.rl {
  --spin: 0deg;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 20px);
  width: 100%;
  max-width: 380px;
  height: 100%;
  max-height: 100%;
}

.rl__wheel {
  position: relative;
  flex: 0 0 auto;
  width: clamp(112px, 40vw, 192px);
  aspect-ratio: 1;
}

.rl__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 4px #17141a;
  background-image: conic-gradient(#17141a 0deg 1deg, #0a4fe8 1deg 60deg, #17141a 60deg 61deg, #ffd23f 61deg 120deg, #17141a 120deg 121deg, #ff4d1f 121deg 180deg, #17141a 180deg 181deg, #b9a0ff 181deg 240deg, #17141a 240deg 241deg, #fff7e6 241deg 300deg, #17141a 300deg 301deg, #17141a 301deg 360deg);
  transform: rotate(var(--spin));
  transition-property: transform;
  transition-duration: 2400ms;
  transition-timing-function: cubic-bezier(0.12, 0.72, 0.12, 1);
}

.rl__label {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12%;
  transform: rotate(var(--a));
  font-weight: 800;
  font-size: clamp(9px, 2.6vw, 12px);
  line-height: 1;
}

.rl__labelText {
  display: block;
  white-space: nowrap;
  transform: rotate(calc(var(--a) * -1 - var(--spin)));
  transition-property: transform;
  transition-duration: 2400ms;
  transition-timing-function: cubic-bezier(0.12, 0.72, 0.12, 1);
}

.rl__label--1 {
  --a: 30deg;
  color: #fff7e6;
}

.rl__label--2 {
  --a: 90deg;
  color: #17141a;
}

.rl__label--3 {
  --a: 150deg;
  color: #17141a;
}

.rl__label--4 {
  --a: 210deg;
  color: #17141a;
}

.rl__label--5 {
  --a: 270deg;
  color: #17141a;
}

.rl__label--6 {
  --a: 330deg;
  color: #fff7e6;
}

.rl__label--1 .rl__labelText {
  background-color: #0a4fe8;
}

.rl__label--2 .rl__labelText {
  background-color: #ffd23f;
}

.rl__label--3 .rl__labelText {
  background-color: #ff4d1f;
}

.rl__label--4 .rl__labelText {
  background-color: #b9a0ff;
}

.rl__label--5 .rl__labelText {
  background-color: #fff7e6;
}

.rl__label--6 .rl__labelText {
  background-color: #17141a;
}

.rl__hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px #17141a;
}

.rl__pointer {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 3;
  width: clamp(20px, 6vw, 28px);
  aspect-ratio: 1;
  transform: translate(-50%, -70%);
  color: #17141a;
}

.rl__pointer svg {
  display: block;
  width: 100%;
  height: 100%;
}

.rl__side {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rl__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, 3.2vw, 16px);
  color: #17141a;
}

.rl__spin {
  align-self: flex-start;
  padding: clamp(8px, 2vw, 12px) 16px;
  border: 0;
  border-radius: 999px;
  background-color: #0a4fe8;
  color: #fff7e6;
  font-weight: 800;
  font-size: clamp(11px, 3vw, 14px);
  line-height: 1;
  cursor: pointer;
  transition: transform 220ms ease-out;
}

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

.rl__spin:active {
  transform: scale(0.96);
}

.rl__spin[disabled] {
  cursor: default;
  opacity: 0.82;
}

.rl__out {
  display: grid;
}

.rl__result, .rl__ghost {
  grid-area: 1/1;
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 13px);
  line-height: 1.3;
  color: #17141a;
}

.rl__ghost {
  opacity: 0;
}

.rl.is-demo .rl__disc {
  animation-name: rlTurn;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.rl.is-demo .rl__labelText {
  animation-name: rlLabelHold;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

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

.rl.is-demo .rl__ghost--b {
  animation-name: rlGhostB;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes rlTurn {
  0% {
    transform: rotate(0deg);
  }
  60% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes rlLabelHold {
  0% {
    transform: rotate(calc(var(--a) * -1));
  }
  60% {
    transform: rotate(calc(var(--a) * -1 - 360deg));
  }
  100% {
    transform: rotate(calc(var(--a) * -1 - 360deg));
  }
}
@keyframes rlOutOff {
  0% {
    opacity: 1;
  }
  60% {
    opacity: 0;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 1;
  }
}
@keyframes rlGhostB {
  0% {
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  88% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
@media (max-width: 340px) {
  .rl {
    gap: 8px;
  }
  .rl__side {
    gap: 4px;
  }
  .rl__spin {
    padding: 8px 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rl__disc {
    transition: none !important;
  }
  .rl__labelText {
    transition: none !important;
  }
  .rl__spin {
    transition: none !important;
  }
  .rl.is-demo .rl__disc,
  .rl.is-demo .rl__labelText,
  .rl.is-demo .rl__result,
  .rl.is-demo .rl__ghost {
    animation: none !important;
  }
  .rl.is-demo .rl__ghost {
    opacity: 0 !important;
  }
  .rl.is-demo .rl__result {
    opacity: 1 !important;
  }
}
