.hp {
  --line: #9ff4ff;
  --dim: #9ff4ff80;
  --fringe: #ff7a66;
  position: relative;
  width: 540px;
  height: 540px;
  box-sizing: border-box;
  background: #021014;
  color: var(--line);
  font-family: "Chakra Petch", sans-serif;
}

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

/* Projection scanlines over everything. */
.hp::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background: repeating-linear-gradient(0deg, #02101400 0 3px, #02101430 3px 4px);
  pointer-events: none;
}

.hp-picker {
  position: absolute;
  inset: 0;
  filter: drop-shadow(1.5px 0 0 #ff7a66cc) drop-shadow(0 0 7px #5fe9ff66);
}

/* Rulers along the area: a tick every 10%, a long one every 50%. */
.hp-rule {
  position: absolute;
  background-repeat: no-repeat;
}

.hp-rule-x {
  left: 26px;
  top: 420px;
  width: 417px;
  height: 8px;
  background:
    linear-gradient(var(--line), var(--line)) 100% 0 / 1px 8px no-repeat,
    linear-gradient(90deg, var(--line) 0 1px, #0000 1px) 0 0 / 208px 8px repeat-x,
    linear-gradient(90deg, var(--dim) 0 1px, #0000 1px) 0 0 / 41.6px 4px repeat-x;
}

.hp-rule-y {
  left: 12px;
  top: 25px;
  width: 8px;
  height: 389px;
  background:
    linear-gradient(var(--line), var(--line)) 0 0 / 8px 1px no-repeat,
    linear-gradient(0deg, var(--line) 0 1px, #0000 1px) 100% 100% / 8px 194px repeat-y,
    linear-gradient(0deg, var(--dim) 0 1px, #0000 1px) 100% 100% / 4px 38.8px repeat-y;
}

/* A plate is a chamfered outline: a line-coloured polygon with the part inset
   2 px, so the line follows the cut corners. The glow and fringe are filters. */
.hp-plate {
  --cut: 18px;
  position: absolute;
  padding: 2px;
  background: var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

.hp-plate > * {
  width: 100%;
  height: 100%;
  clip-path: polygon(calc(var(--cut) - 1px) 0, 100% 0, 100% calc(100% - var(--cut) + 1px), calc(100% - var(--cut) + 1px) 100%, 0 100%, 0 calc(var(--cut) - 1px));
}

.hp-plate-area { left: 24px; top: 24px; width: 420px; height: 392px; }
.hp-plate-hue { --cut: 12px; left: 468px; top: 24px; width: 48px; height: 392px; }
.hp-plate-swatch { --cut: 12px; left: 24px; top: 440px; width: 100px; height: 76px; }

.hp-area {
  background: var(--color-area-background);
  cursor: crosshair;
  overflow: hidden;
}

/* Shimmer: faint vertical grain on the projected colour. */
.hp-area::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, #ffffff00 0 3px, #ffffff0f 3px 4px);
  pointer-events: none;
}

.hp-reticle {
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-picker-color) 0 7px, #fff 7px 9px, #0000 9px);
  box-shadow: 0 0 10px #9ff4ffcc, inset 0 0 6px #9ff4ff99;
  translate: -50% -50%;
  outline: none;
}

/* Crosshair hairlines run the full area and stop short of the ring. */
.hp-reticle::before,
.hp-reticle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
}

.hp-reticle::before {
  width: 1200px;
  height: 1px;
  margin: -0.5px 0 0 -600px;
  background: linear-gradient(90deg, #ffffffb3 0 576px, #0000 576px 624px, #ffffffb3 624px);
}

.hp-reticle::after {
  width: 1px;
  height: 1200px;
  margin: -600px 0 0 -0.5px;
  background: linear-gradient(180deg, #ffffffb3 0 576px, #0000 576px 624px, #ffffffb3 624px);
}

.hp-tag {
  position: absolute;
  left: 30px;
  top: 30px;
  height: 20px;
  padding: 0 6px;
  background: #021014cc;
  box-shadow: inset 0 0 0 1px var(--line);
  color: #eafdff;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hp-hue {
  background: linear-gradient(to top, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

/* Thick window over the strip: the selection indicator. */
.hp-hue-thumb {
  left: 0;
  right: 0;
  height: 20px;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1.5px #021014, inset 0 0 0 1.5px #021014, 0 0 12px #9ff4ff;
  translate: 0 50%;
  outline: none;
}

.hp-swatch {
  background: var(--color-picker-color);
}

.hp-hex {
  position: absolute;
  left: 142px;
  top: 440px;
  width: 200px;
  height: 76px;
  padding: 0;
  border: 0;
  background: none;
  color: #eafdff;
  font: inherit;
  font-size: 40px;
  font-weight: 600;
  line-height: 76px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-shadow: 0 0 14px #5fe9ffb3;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.hp-channels {
  position: absolute;
  left: 356px;
  top: 440px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 160px;
  height: 76px;
  border-left: 1px solid var(--dim);
}

.hp-channel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding-left: 12px;
  border-right: 1px solid var(--dim);
}

.hp-channel:last-child { border-right: 0; }

.hp-channel span {
  color: var(--dim);
  font-size: 12px;
  font-weight: 500;
  line-height: 12px;
}

.hp-channel input {
  width: 100%;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: #eafdff;
  font: inherit;
  font-size: 22px;
  font-weight: 500;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px #5fe9ff99;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.hp-channel input::-webkit-inner-spin-button,
.hp-channel input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
