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

@property --r {
  syntax: "<integer>";
  inherits: true;
  initial-value: 204;
}
@property --g {
  syntax: "<integer>";
  inherits: true;
  initial-value: 228;
}
@property --b {
  syntax: "<integer>";
  inherits: true;
  initial-value: 255;
}
@counter-style hx {
  system: numeric;
  symbols: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F";
  pad: 2 "0";
}
.pk {
  box-sizing: border-box;
  width: 288px;
  max-width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  font-family: inherit;
  --hue: 212;
}

.pk * {
  box-sizing: border-box;
}

.pk__sv {
  position: relative;
  height: 80px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
  background-color: hsl(var(--hue), 100%, 50%);
  background-image: linear-gradient(to top, #000000, rgba(0, 0, 0, 0)), linear-gradient(to right, #ffffff, rgba(255, 255, 255, 0));
}

.pk__sv:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 3px;
}

.pk__dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translate(52.8px, 0) translate(-50%, -50%);
}

.pk__hue {
  position: relative;
  height: 12px;
  margin-top: 8px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  background-image: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.pk__hue:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 3px;
}

.pk__knob {
  position: absolute;
  top: 50%;
  left: 58.9%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translate(-50%, -50%);
}

.pk__read {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.pk__chip {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgb(var(--r), var(--g), var(--b));
}

.pk__hex {
  counter-set: cr calc(var(--r)) cg calc(var(--g)) cb calc(var(--b));
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.pk__hex::after {
  content: "#" counter(cr, hx) counter(cg, hx) counter(cb, hx);
}

.pk__rgb {
  counter-set: cr calc(var(--r)) cg calc(var(--g)) cb calc(var(--b));
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(23, 20, 26, 0.62);
}

.pk__rgb::after {
  content: "rgb(" counter(cr) " " counter(cg) " " counter(cb) ")";
}

.pk.is-demo .pk__dot {
  animation-name: pkDot;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

.pk.is-demo {
  animation-name: pkColor;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

@keyframes pkDot {
  0% {
    transform: translate(52.8px, 0) translate(-50%, -50%);
  }
  30%, 40% {
    transform: translate(248.2px, 0) translate(-50%, -50%);
  }
  60%, 70% {
    transform: translate(248.2px, 36px) translate(-50%, -50%);
  }
  80% {
    transform: translate(248.2px, 0) translate(-50%, -50%);
  }
  90%, 100% {
    transform: translate(52.8px, 0) translate(-50%, -50%);
  }
}
@keyframes pkColor {
  0% {
    --r: 204;
    --g: 228;
    --b: 255;
  }
  30%, 40% {
    --r: 15;
    --g: 127;
    --b: 255;
  }
  60%, 70% {
    --r: 8;
    --g: 70;
    --b: 140;
  }
  80% {
    --r: 15;
    --g: 127;
    --b: 255;
  }
  90%, 100% {
    --r: 204;
    --g: 228;
    --b: 255;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pk.is-demo,
  .pk.is-demo .pk__dot {
    animation: none !important;
  }
}
