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

.pb {
  --kx: 1;
  --ky: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 424px;
}

.pb__hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 700;
  font-size: clamp(10px, 2.8vw, 12px);
  color: #fff7e6;
}

.pb__ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #ffd23f;
}

.pb__field {
  position: relative;
  height: 176px;
  border-radius: 16px;
  background: rgba(255, 247, 230, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 247, 230, 0.14);
  overflow: hidden;
  touch-action: none;
  cursor: none;
}

.pb__field:focus-visible {
  outline: 2px solid #ffd23f;
  outline-offset: 2px;
}

.pb__bricks {
  position: absolute;
  inset: 0;
}

.pb__brick {
  position: absolute;
  left: 0;
  top: 0;
  width: 60px;
  height: 14px;
  border-radius: 4px;
}

.pb__brick--r0 {
  background: #ff4d1f;
}

.pb__brick--r1 {
  background: #ffd23f;
}

.pb__brick--r2 {
  background: #fff7e6;
}

.pb__brick.is-hit {
  visibility: hidden;
}

.pb__ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff7e6;
}

.pb__paddle {
  position: absolute;
  left: 0;
  top: 0;
  width: 68px;
  height: 10px;
  border-radius: 999px;
  background: #ffd23f;
}

.pb__score {
  position: absolute;
  left: 8px;
  top: 4px;
  margin: 0;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 11px);
  color: #fff7e6;
  z-index: 1;
}

.pb__scoreLoop {
  position: absolute;
  inset: 0;
  display: grid;
  visibility: hidden;
}

.pb__scoreLoop i {
  grid-area: 1/1;
  font-style: normal;
  visibility: hidden;
}

.pb__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pb__launch, .pb__reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  padding: 4px 12px;
  background: #ffd23f;
  color: #17141a;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(10px, 2.6vw, 11px);
  line-height: 1;
}

.pb__launch .pb__ico, .pb__reset .pb__ico {
  color: #17141a;
}

.pb.is-demo .pb__ball {
  animation-name: pbBall;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

@keyframes pbBall {
  0% {
    transform: translate(calc(var(--kx) * 210px), calc(var(--ky) * 158px));
  }
  9% {
    transform: translate(calc(var(--kx) * 318px), calc(var(--ky) * 40px));
  }
  17% {
    transform: translate(calc(var(--kx) * 398px), calc(var(--ky) * 116px));
  }
  25% {
    transform: translate(calc(var(--kx) * 306px), calc(var(--ky) * 158px));
  }
  33% {
    transform: translate(calc(var(--kx) * 252px), calc(var(--ky) * 48px));
  }
  41% {
    transform: translate(calc(var(--kx) * 128px), calc(var(--ky) * 52px));
  }
  49% {
    transform: translate(calc(var(--kx) * 24px), calc(var(--ky) * 116px));
  }
  57% {
    transform: translate(calc(var(--kx) * 110px), calc(var(--ky) * 158px));
  }
  65% {
    transform: translate(calc(var(--kx) * 196px), calc(var(--ky) * 100px));
  }
  73% {
    transform: translate(calc(var(--kx) * 280px), calc(var(--ky) * 20px));
  }
  81% {
    transform: translate(calc(var(--kx) * 398px), calc(var(--ky) * 84px));
  }
  89% {
    transform: translate(calc(var(--kx) * 330px), calc(var(--ky) * 130px));
  }
  94% {
    transform: translate(calc(var(--kx) * 160px), calc(var(--ky) * 134px));
  }
  100% {
    transform: translate(calc(var(--kx) * 210px), calc(var(--ky) * 158px));
  }
}
.pb.is-demo .pb__paddle {
  animation-name: pbPaddle;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes pbPaddle {
  0% {
    transform: translate(calc(var(--kx) * 176px), calc(var(--ky) * 158px));
  }
  9% {
    transform: translate(calc(var(--kx) * 284px), calc(var(--ky) * 158px));
  }
  25% {
    transform: translate(calc(var(--kx) * 272px), calc(var(--ky) * 158px));
  }
  41% {
    transform: translate(calc(var(--kx) * 94px), calc(var(--ky) * 158px));
  }
  57% {
    transform: translate(calc(var(--kx) * 76px), calc(var(--ky) * 158px));
  }
  73% {
    transform: translate(calc(var(--kx) * 246px), calc(var(--ky) * 158px));
  }
  89% {
    transform: translate(calc(var(--kx) * 296px), calc(var(--ky) * 158px));
  }
  96% {
    transform: translate(calc(var(--kx) * 136px), calc(var(--ky) * 158px));
  }
  100% {
    transform: translate(calc(var(--kx) * 176px), calc(var(--ky) * 158px));
  }
}
.pb.is-demo .pb__brick--r1c4 {
  animation: pbFlash 2s linear infinite;
  animation-delay: 0ms;
}

.pb.is-demo .pb__brick--r2c3 {
  animation: pbFlash 2s linear infinite;
  animation-delay: 460ms;
}

.pb.is-demo .pb__brick--r2c1 {
  animation: pbFlash 2s linear infinite;
  animation-delay: 620ms;
}

.pb.is-demo .pb__brick--r0c4 {
  animation: pbFlash 2s linear infinite;
  animation-delay: 1260ms;
}

@keyframes pbFlash {
  0%, 7%, 13%, 100% {
    opacity: 1;
  }
  10% {
    opacity: 0.3;
  }
}
.pb.is-demo .pb__scoreVal {
  color: transparent;
}

.pb.is-demo .pb__scoreLoop {
  visibility: visible;
}

.pb.is-demo .pb__scoreLoop i {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.pb.is-demo .pb__scoreLoop i:nth-child(1) {
  animation-name: pbScore0;
}

.pb.is-demo .pb__scoreLoop i:nth-child(2) {
  animation-name: pbScore1;
}

.pb.is-demo .pb__scoreLoop i:nth-child(3) {
  animation-name: pbScore2;
}

@keyframes pbScore0 {
  0%, 8% {
    visibility: visible;
  }
  9%, 95% {
    visibility: hidden;
  }
  96%, 100% {
    visibility: visible;
  }
}
@keyframes pbScore1 {
  0%, 8% {
    visibility: hidden;
  }
  9%, 32% {
    visibility: visible;
  }
  33%, 100% {
    visibility: hidden;
  }
}
@keyframes pbScore2 {
  0%, 32% {
    visibility: hidden;
  }
  33%, 95% {
    visibility: visible;
  }
  96%, 100% {
    visibility: hidden;
  }
}
@media (max-width: 340px) {
  .pb {
    --kx: .68;
    --ky: .59;
    gap: 8px;
  }
  .pb__field {
    height: 104px;
  }
  .pb__brick {
    width: 40px;
    height: 10px;
  }
  .pb__paddle {
    width: 52px;
    height: 8px;
  }
  .pb__ball {
    width: 10px;
    height: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pb.is-demo .pb__ball,
  .pb.is-demo .pb__paddle,
  .pb.is-demo .pb__brick,
  .pb.is-demo .pb__scoreLoop i {
    animation: none !important;
  }
  .pb.is-demo .pb__ball {
    transform: translate(calc(var(--kx) * 210px), calc(var(--ky) * 144px)) !important;
  }
  .pb.is-demo .pb__paddle {
    transform: translate(calc(var(--kx) * 176px), calc(var(--ky) * 158px)) !important;
  }
  .pb.is-demo .pb__scoreVal {
    color: #fff7e6 !important;
  }
  .pb.is-demo .pb__scoreLoop {
    visibility: hidden !important;
  }
}
