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

.rtl {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  height: calc(100vh - clamp(16px, 8vw, 48px));
}

.rtl__bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.rtl__title {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  margin-right: auto;
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1.2;
  color: #fff7e6;
}

.rtl__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #4cd4a6;
}

.rtl__ico--sm {
  width: 12px;
  height: 12px;
}

.rtl__pill {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 247, 230, 0.1);
  font-weight: 700;
  font-size: clamp(9px, 2.4vw, 11px);
  line-height: 1.2;
  color: #fff7e6;
  white-space: nowrap;
}

.rtl__label {
  font-weight: 600;
  color: rgba(255, 247, 230, 0.72);
}

.rtl__num {
  font-weight: 800;
}

.rtl__btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: rgba(255, 247, 230, 0.12);
  cursor: pointer;
  color: #fff7e6;
}

.rtl__btn:hover {
  background: rgba(255, 247, 230, 0.2);
}

.rtl__btn:focus-visible {
  outline: 2px solid #4cd4a6;
  outline-offset: 0;
}

.rtl__board {
  position: relative;
  display: flex;
  gap: 4px;
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 247, 230, 0.05);
  overflow: hidden;
}

.rtl__lane {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rtl__well {
  position: relative;
  height: clamp(64px, 40vh, 140px);
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.06);
  --fall-h: calc(clamp(64px, 40vh, 140px) - 6px);
}

.rtl__key {
  display: grid;
  place-items: center;
  height: 20px;
  border-radius: 4px;
  background: rgba(255, 247, 230, 0.12);
  font-weight: 700;
  font-size: 10px;
  line-height: 1;
  color: #fff7e6;
}

.rtl__line {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 32px;
  height: 2px;
  background: rgba(255, 247, 230, 0.8);
  box-shadow: 0 0 8px rgba(255, 247, 230, 0.4);
}

.rtl__note, .rtl__pv {
  position: absolute;
  left: 50%;
  top: 0;
  width: 62%;
  height: 14px;
  margin-left: -31%;
}

.rtl__note::before, .rtl__pv::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #4cd4a6;
}

.rtl__note {
  animation-name: rtlFall;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: both;
}

.rtl__note.is-hit {
  animation-play-state: paused;
}

.rtl__note.is-hit::before {
  animation-name: rtlPop;
  animation-duration: 240ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

.rtl__note.is-miss::before {
  animation-name: rtlFade;
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

.rtl__note.is-due {
  transform: translateY(var(--fall-h));
}

@keyframes rtlFall {
  from {
    transform: translateY(-16px);
  }
  to {
    transform: translateY(var(--fall-h));
  }
}
@keyframes rtlPop {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}
@keyframes rtlFade {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(8px);
    opacity: 0.15;
  }
}
.rtl__verdict {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(12px, 3.2vw, 15px);
  line-height: 1.2;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
}

.rtl__verdict.is-perfect {
  color: #4cd4a6;
}

.rtl__verdict.is-good {
  color: #5b8cf8;
}

.rtl__verdict.is-miss {
  color: #ffe0d8;
}

.rtl__verdict.is-show {
  animation-name: rtlVerdict;
  animation-duration: 900ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

@keyframes rtlVerdict {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  12% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(0) scale(1);
  }
}
.rtl__combo {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 64px;
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: clamp(10px, 2.8vw, 13px);
  line-height: 1.2;
  color: #fff7e6;
  opacity: 0.92;
  pointer-events: none;
}

.rtl__combo.is-bump {
  animation-name: rtlBump;
  animation-duration: 300ms;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: 1;
}

@keyframes rtlBump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}
.rtl [hidden] {
  display: none !important;
}

.rtl__start, .rtl__result {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  background: rgba(23, 20, 26, 0.8);
  text-align: center;
  padding: 12px;
}

.rtl__startTitle, .rtl__resultTitle {
  margin: 0;
  font-weight: 800;
  font-size: clamp(13px, 3.4vw, 16px);
  line-height: 1.3;
  color: #fff7e6;
}

.rtl__startSub {
  margin: 0;
  font-weight: 500;
  font-size: clamp(9px, 2.4vw, 11px);
  line-height: 1.5;
  color: rgba(255, 247, 230, 0.72);
}

.rtl__resultLine {
  margin: 0;
  font-weight: 600;
  font-size: clamp(10px, 2.6vw, 12px);
  line-height: 1.5;
  color: rgba(255, 247, 230, 0.72);
}

.rtl__again {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 12px;
  padding: 4px 12px;
  background: #0a4fe8;
  color: #fff7e6;
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(10px, 2.6vw, 12px);
  line-height: 1.4;
  cursor: pointer;
}

.rtl__again:hover {
  background: #2f6df6;
}

.rtl__again:focus-visible {
  outline: 2px solid #5b8cf8;
  outline-offset: 2px;
}

.rtl__hint {
  margin: 0;
  font-weight: 500;
  font-size: clamp(9px, 2.4vw, 11px);
  line-height: 1.4;
  color: rgba(255, 247, 230, 0.72);
}

.rtl__pv {
  animation-name: rtlFall;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
  animation-delay: var(--d);
}

.rtl:not(.is-demo) .rtl__pv {
  display: none;
}

.rtl.is-demo .rtl__start {
  display: none;
}

.rtl.is-demo .rtl__key {
  animation-name: rtlKeyPulse;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
  animation-delay: calc(var(--k) * 666ms);
}

@keyframes rtlKeyPulse {
  0%, 100% {
    opacity: 0.78;
    transform: scale(1);
  }
  15% {
    opacity: 1;
    transform: scale(1.05);
  }
  30% {
    opacity: 0.78;
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .rtl__well {
    height: 64px;
    --fall-h: 58px;
  }
  .rtl__combo {
    bottom: 56px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rtl__note, .rtl__pv, .rtl__key {
    animation: none !important;
  }
  .rtl__note.is-hit::before, .rtl__note.is-miss::before {
    animation: none !important;
  }
  .rtl__pv {
    display: none !important;
  }
  .rtl__note {
    opacity: 0;
  }
  .rtl__note.is-due, .rtl__note.is-hit, .rtl__note.is-miss {
    opacity: 1;
  }
  .rtl__verdict.is-show {
    animation: none !important;
    opacity: 1 !important;
  }
  .rtl__combo.is-bump {
    animation: none !important;
  }
}
