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

.rp {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  height: 100%;
  counter-reset: rpTaps;
}

.rp__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rp__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, 3vw, 15px);
  color: #fff7e6;
}

.rp__restart {
  display: grid;
  place-items: center;
  width: clamp(24px, 5vw, 28px);
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(255, 247, 230, 0.3);
  border-radius: 12px;
  background: none;
  color: #fff7e6;
  cursor: pointer;
}

.rp__restart svg {
  width: 62%;
  height: 62%;
}

.rp__restart:focus-visible {
  outline: 2px solid #fff7e6;
  outline-offset: 2px;
}

.rp__hint {
  margin: 0;
  font-weight: 500;
  font-size: clamp(8px, 2.2vw, 10px);
  color: rgba(255, 247, 230, 0.72);
}

.rp__board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.rp__check {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}

.rp__check:checked {
  counter-increment: rpTaps;
}

.rp__grid {
  flex: 1 1 auto;
  display: grid;
  grid-template: repeat(3, 1fr)/repeat(3, 1fr);
  gap: 8px;
}

.rp__pad {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid rgba(255, 247, 230, 0.14);
  background-color: rgba(255, 247, 230, 0.05);
  pointer-events: none;
  cursor: default;
  transition: background-color 220ms ease-out, border-color 220ms ease-out, box-shadow 220ms ease-out, transform 220ms cubic-bezier(0.2, 1.4, 0.4, 1);
}

.rp__no {
  position: relative;
  z-index: 1;
  font-weight: 800;
  font-size: clamp(11px, 3vw, 16px);
  color: rgba(255, 247, 230, 0.72);
}

.rp__pad::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background-color: #0a4fe8;
  opacity: 0;
}

.rp__pad::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 2;
  border: 2px solid #fff7e6;
  border-radius: inherit;
  opacity: 0;
}

#rpP1:not(:checked) ~ .rp__grid .rp__pad:nth-child(1),
#rpP1:checked ~ .rp__grid .rp__pad:nth-child(2),
#rpP2:checked ~ .rp__grid .rp__pad:nth-child(3),
#rpP3:checked ~ .rp__grid .rp__pad:nth-child(4),
#rpP4:checked ~ .rp__grid .rp__pad:nth-child(5),
#rpP5:checked ~ .rp__grid .rp__pad:nth-child(6),
#rpP6:checked ~ .rp__grid .rp__pad:nth-child(7),
#rpP7:checked ~ .rp__grid .rp__pad:nth-child(8),
#rpP8:checked ~ .rp__grid .rp__pad:nth-child(9) {
  pointer-events: auto;
  cursor: pointer;
  background-color: #fff7e6;
  border-color: #fff7e6;
  box-shadow: 0 0 0 4px rgba(255, 247, 230, 0.16), 0 0 22px rgba(255, 247, 230, 0.3);
}
#rpP1:not(:checked) ~ .rp__grid .rp__pad:nth-child(1) .rp__no,
#rpP1:checked ~ .rp__grid .rp__pad:nth-child(2) .rp__no,
#rpP2:checked ~ .rp__grid .rp__pad:nth-child(3) .rp__no,
#rpP3:checked ~ .rp__grid .rp__pad:nth-child(4) .rp__no,
#rpP4:checked ~ .rp__grid .rp__pad:nth-child(5) .rp__no,
#rpP5:checked ~ .rp__grid .rp__pad:nth-child(6) .rp__no,
#rpP6:checked ~ .rp__grid .rp__pad:nth-child(7) .rp__no,
#rpP7:checked ~ .rp__grid .rp__pad:nth-child(8) .rp__no,
#rpP8:checked ~ .rp__grid .rp__pad:nth-child(9) .rp__no {
  color: #17141a;
}

#rpP1:checked ~ .rp__grid .rp__pad:nth-child(1),
#rpP2:checked ~ .rp__grid .rp__pad:nth-child(2),
#rpP3:checked ~ .rp__grid .rp__pad:nth-child(3),
#rpP4:checked ~ .rp__grid .rp__pad:nth-child(4),
#rpP5:checked ~ .rp__grid .rp__pad:nth-child(5),
#rpP6:checked ~ .rp__grid .rp__pad:nth-child(6),
#rpP7:checked ~ .rp__grid .rp__pad:nth-child(7),
#rpP8:checked ~ .rp__grid .rp__pad:nth-child(8),
#rpP9:checked ~ .rp__grid .rp__pad:nth-child(9) {
  background-color: #0a4fe8;
  border-color: #0a4fe8;
  box-shadow: none;
}
#rpP1:checked ~ .rp__grid .rp__pad:nth-child(1) .rp__no,
#rpP2:checked ~ .rp__grid .rp__pad:nth-child(2) .rp__no,
#rpP3:checked ~ .rp__grid .rp__pad:nth-child(3) .rp__no,
#rpP4:checked ~ .rp__grid .rp__pad:nth-child(4) .rp__no,
#rpP5:checked ~ .rp__grid .rp__pad:nth-child(5) .rp__no,
#rpP6:checked ~ .rp__grid .rp__pad:nth-child(6) .rp__no,
#rpP7:checked ~ .rp__grid .rp__pad:nth-child(7) .rp__no,
#rpP8:checked ~ .rp__grid .rp__pad:nth-child(8) .rp__no,
#rpP9:checked ~ .rp__grid .rp__pad:nth-child(9) .rp__no {
  color: #fff7e6;
}

#rpP1:focus-visible ~ .rp__grid .rp__pad:nth-child(1),
#rpP2:focus-visible ~ .rp__grid .rp__pad:nth-child(2),
#rpP3:focus-visible ~ .rp__grid .rp__pad:nth-child(3),
#rpP4:focus-visible ~ .rp__grid .rp__pad:nth-child(4),
#rpP5:focus-visible ~ .rp__grid .rp__pad:nth-child(5),
#rpP6:focus-visible ~ .rp__grid .rp__pad:nth-child(6),
#rpP7:focus-visible ~ .rp__grid .rp__pad:nth-child(7),
#rpP8:focus-visible ~ .rp__grid .rp__pad:nth-child(8),
#rpP9:focus-visible ~ .rp__grid .rp__pad:nth-child(9) {
  outline: 2px solid #fff7e6;
  outline-offset: 2px;
}

.rp__pad:active {
  transform: scale(0.93);
}

.rp__done {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  place-items: center;
  margin: 0;
}

#rpP9:checked ~ .rp__done {
  display: grid;
}

.rp__done b {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  background-color: #fff7e6;
  color: #17141a;
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 14px);
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  animation-name: rpDoneIn;
  animation-duration: 600ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: 1;
  animation-fill-mode: both;
}

@keyframes rpDoneIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.rp__tally {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
}

.rp__tallyLabel {
  font-weight: 700;
  font-size: clamp(9px, 2.4vw, 11px);
  color: rgba(255, 247, 230, 0.72);
}

.rp__count {
  font-weight: 800;
  font-size: clamp(11px, 2.8vw, 14px);
  color: #fff7e6;
}

.rp__count::after {
  content: counter(rpTaps) " / 9";
}

.rp.is-demo .rp__pad,
.rp.is-demo .rp__pad::after,
.rp.is-demo .rp__pad::before,
.rp.is-demo .rp__no {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
  animation-delay: calc(var(--i) * 180ms);
}

.rp.is-demo .rp__pad {
  animation-name: rpPress;
}

.rp.is-demo .rp__pad::after {
  animation-name: rpFill;
}

.rp.is-demo .rp__pad::before {
  animation-name: rpRipple;
}

.rp.is-demo .rp__no {
  animation-name: rpNo;
}

@keyframes rpPress {
  0% {
    transform: scale(1);
  }
  28% {
    transform: scale(0.9);
  }
  58% {
    transform: scale(1);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes rpFill {
  0% {
    opacity: 0;
  }
  26% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes rpRipple {
  0% {
    transform: scale(1);
    opacity: 0;
  }
  26% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    transform: scale(1.32);
    opacity: 0;
  }
}
@keyframes rpNo {
  0% {
    color: rgba(255, 247, 230, 0.72);
  }
  26% {
    color: #fff7e6;
  }
  78% {
    color: #fff7e6;
  }
  100% {
    color: rgba(255, 247, 230, 0.72);
  }
}
@media (max-width: 340px) {
  .rp {
    gap: 4px;
  }
  .rp__grid {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rp.is-demo .rp__pad,
  .rp.is-demo .rp__pad::before,
  .rp.is-demo .rp__pad::after,
  .rp.is-demo .rp__no {
    animation: none !important;
  }
  .rp__done b {
    animation: none !important;
  }
  .rp__pad {
    transition: none !important;
  }
}
