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

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

@property --r {
  syntax: "<integer>";
  inherits: true;
  initial-value: 255;
}
@property --g {
  syntax: "<integer>";
  inherits: true;
  initial-value: 117;
}
@property --b {
  syntax: "<integer>";
  inherits: true;
  initial-value: 40;
}
@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";
}
.ed {
  position: relative;
  box-sizing: border-box;
  width: 288px;
  max-width: 100%;
  padding: 12px;
  border-radius: 16px;
  background: #fff7e6;
  color: #17141a;
  font-family: inherit;
}

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

.ed__box {
  position: relative;
}

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

.ed__canvas {
  display: block;
  width: 264px;
  max-width: 100%;
  height: 88px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

.ed__loupe {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  background: rgb(var(--r), var(--g), var(--b));
  pointer-events: none;
  transform: translate(40px, 28px) translate(-50%, -50%);
}

.ed__loupe::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  transform: translate(-50%, -50%);
}

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

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

.ed__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;
}

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

.ed__pick {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 2px solid rgba(23, 20, 26, 0.16);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.ed__pick svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

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

.ed__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ed.is-demo .ed__loupe {
  animation-name: edMove;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

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

@keyframes edMove {
  0% {
    transform: translate(40px, 28px) translate(-50%, -50%);
  }
  22.5% {
    transform: translate(132px, 28px) translate(-50%, -50%);
  }
  45%, 55% {
    transform: translate(224px, 28px) translate(-50%, -50%);
  }
  72.5% {
    transform: translate(132px, 28px) translate(-50%, -50%);
  }
  90%, 100% {
    transform: translate(40px, 28px) translate(-50%, -50%);
  }
}
@keyframes edColor {
  0% {
    --r: 255;
    --g: 117;
    --b: 40;
  }
  22.5% {
    --r: 254;
    --g: 209;
    --b: 63;
  }
  45%, 55% {
    --r: 109;
    --g: 139;
    --b: 191;
  }
  72.5% {
    --r: 254;
    --g: 209;
    --b: 63;
  }
  90%, 100% {
    --r: 255;
    --g: 117;
    --b: 40;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ed.is-demo,
  .ed.is-demo .ed__loupe {
    animation: none !important;
  }
}
