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

.cg {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-bottom: 8px;
}

.cg__card {
  width: min(100%, 420px);
  background: #fff7e6;
  border-radius: 16px;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  padding: 8px 16px 4px;
}

.cg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cg__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(12px, 3vw, 14px);
  color: #17141a;
}

.cg__chip {
  font-weight: 700;
  font-size: clamp(9px, 2.4vw, 10px);
  color: rgba(23, 20, 26, 0.66);
  border: 1px solid rgba(23, 20, 26, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
}

.cg__plot {
  position: relative;
}

.cg__svg {
  display: block;
  width: 100%;
  height: auto;
}

.cg__scale text {
  fill: rgba(23, 20, 26, 0.72);
  font-weight: 700;
  font-size: 10px;
  text-anchor: middle;
}

.cg__track {
  fill: none;
  stroke: rgba(23, 20, 26, 0.14);
  stroke-width: 20;
  stroke-linecap: round;
}

.cg__arc {
  fill: none;
  stroke: #2f6df6;
  stroke-width: 20;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 32;
}

.cg__hit {
  fill: none;
  stroke: transparent;
  stroke-width: 34;
  pointer-events: stroke;
  cursor: pointer;
}

.cg__needle {
  transform-origin: 220px 126px;
}

.cg__pin {
  stroke: #17141a;
  stroke-width: 4;
  stroke-linecap: round;
}

.cg__hub {
  fill: #17141a;
}

.cg__val, .cg__liveVal {
  fill: #17141a;
  font-weight: 800;
  font-size: 24px;
}

.cg__val {
  display: none;
}

.cg__liveVal {
  display: block;
}

.cg:not(.is-demo) .cg__arc {
  transition: stroke-dashoffset 300ms ease-out;
}

.cg:not(.is-demo) .cg__needle {
  transition: transform 300ms ease-out;
}

.cg__tip {
  position: absolute;
  transform: translate(-50%, -130%);
  transform-origin: 50% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #17141a;
  color: #ffffff;
  border-radius: 4px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.cg__tip.is-on {
  opacity: 1;
}

.cg__tip strong {
  font-size: 11px;
}

.cg__sr {
  position: fixed;
  top: 0;
  left: -640px;
  width: 320px;
  margin: 0;
}

.cg__inputRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 0 8px;
}

.cg__lab {
  font-weight: 700;
  font-size: 11px;
  color: rgba(23, 20, 26, 0.72);
}

.cg__input {
  width: 64px;
  box-sizing: border-box;
  border: 1px solid rgba(23, 20, 26, 0.34);
  border-radius: 8px;
  background: #ffffff;
  color: #17141a;
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  text-align: right;
  padding: 4px 8px;
  line-height: 1.4;
}

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

.cg__unit {
  font-weight: 700;
  font-size: 11px;
  color: rgba(23, 20, 26, 0.72);
}

.cg.is-demo .cg__arc {
  animation-name: cgFill;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes cgFill {
  0%, 6% {
    stroke-dashoffset: 100;
  }
  58%, 96% {
    stroke-dashoffset: 32;
  }
  98%, 100% {
    stroke-dashoffset: 100;
  }
}
.cg.is-demo .cg__needle {
  animation-name: cgSwing;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes cgSwing {
  0%, 6% {
    transform: rotate(-90deg);
  }
  58%, 96% {
    transform: rotate(32.4deg);
  }
  98%, 100% {
    transform: rotate(-90deg);
  }
}
.cg.is-demo .cg__liveVal {
  display: none;
}

.cg.is-demo .cg__val {
  display: block;
}

.cg.is-demo .cg__val--zero,
.cg.is-demo .cg__val--full {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.cg.is-demo .cg__val--zero {
  animation-name: cgLblZero;
}

.cg.is-demo .cg__val--full {
  animation-name: cgLblFull;
}

@keyframes cgLblZero {
  0%, 56% {
    opacity: 1;
  }
  58%, 100% {
    opacity: 0;
  }
}
@keyframes cgLblFull {
  0%, 56% {
    opacity: 0;
  }
  58%, 96% {
    opacity: 1;
  }
  98%, 100% {
    opacity: 0;
  }
}
.cg.is-demo .cg__tip {
  animation-name: cgTip;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes cgTip {
  0%, 56% {
    opacity: 0;
  }
  58%, 96% {
    opacity: 1;
  }
  98%, 100% {
    opacity: 0;
  }
}
@media (max-width: 340px) {
  .cg {
    padding-bottom: 0;
  }
  .cg__card {
    padding: 4px 12px 0;
  }
  .cg__head {
    margin-bottom: 4px;
  }
  .cg__inputRow {
    padding: 4px 0 0;
  }
  .cg__val, .cg__liveVal {
    font-size: 20px;
  }
  .cg__input {
    font-size: 12px;
    width: 52px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cg.is-demo .cg__arc,
  .cg.is-demo .cg__needle,
  .cg.is-demo .cg__val--zero,
  .cg.is-demo .cg__val--full,
  .cg.is-demo .cg__tip {
    animation: none !important;
  }
  .cg.is-demo .cg__arc {
    stroke-dashoffset: 32 !important;
  }
  .cg.is-demo .cg__needle {
    transform: rotate(32.4deg) !important;
  }
  .cg.is-demo .cg__val--zero {
    opacity: 0 !important;
  }
  .cg.is-demo .cg__val--full {
    opacity: 1 !important;
  }
  .cg.is-demo .cg__tip {
    opacity: 1 !important;
  }
}
