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

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

@property --r {
  syntax: "<integer>";
  inherits: true;
  initial-value: 13;
}
@property --g {
  syntax: "<integer>";
  inherits: true;
  initial-value: 120;
}
@property --b {
  syntax: "<integer>";
  inherits: true;
  initial-value: 242;
}
@property --hh {
  syntax: "<integer>";
  inherits: true;
  initial-value: 212;
}
@property --ss {
  syntax: "<integer>";
  inherits: true;
  initial-value: 90;
}
@property --ll {
  syntax: "<integer>";
  inherits: true;
  initial-value: 50;
}
@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";
}
.sy {
  box-sizing: border-box;
  width: 288px;
  max-width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  font-family: inherit;
}

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

.sy__band {
  height: 32px;
  border-radius: 8px;
  background: rgb(var(--r), var(--g), var(--b));
}

.sy__row {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.sy__label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: rgba(23, 20, 26, 0.62);
}

.sy__field {
  position: relative;
  display: block;
}

.sy__input {
  display: block;
  width: 100%;
  height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(23, 20, 26, 0.22);
  border-radius: 4px;
  background: #ffffff;
  color: #17141a;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

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

.sy__input[aria-invalid=true] {
  border-color: #c2361a;
  background: #ffe0d8;
}

.sy__bad {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  padding: 0 4px;
  border-radius: 4px;
  background: #ffe0d8;
  color: #c2361a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
  opacity: 0;
  pointer-events: none;
}

.sy__row.is-bad .sy__bad {
  opacity: 1;
}

.sy__ghost {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
}

.sy__ghost--hex {
  counter-set: cr calc(var(--r)) cg calc(var(--g)) cb calc(var(--b));
}

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

.sy__ghost--rgb {
  counter-set: cr calc(var(--r)) cg calc(var(--g)) cb calc(var(--b));
}

.sy__ghost--rgb::after {
  content: "rgb(" counter(cr) ", " counter(cg) ", " counter(cb) ")";
}

.sy__ghost--hsl {
  counter-set: chh calc(var(--hh)) css calc(var(--ss)) cll calc(var(--ll));
}

.sy__ghost--hsl::after {
  content: "hsl(" counter(chh) ", " counter(css) "%, " counter(cll) "%)";
}

.sy.is-demo .sy__input {
  color: transparent;
}

.sy.is-demo .sy__ghost {
  opacity: 1;
}

.sy.is-demo {
  animation-name: syColor;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes syColor {
  0% {
    --ll: 50;
    --r: 13;
    --g: 120;
    --b: 242;
  }
  45%, 55% {
    --ll: 24;
    --r: 6;
    --g: 58;
    --b: 116;
  }
  90%, 100% {
    --ll: 50;
    --r: 13;
    --g: 120;
    --b: 242;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sy.is-demo {
    animation: none !important;
  }
  .sy.is-demo .sy__input {
    color: #17141a !important;
  }
  .sy.is-demo .sy__ghost {
    opacity: 0 !important;
  }
}
