@property --h {
  syntax: "<percentage>";
  initial-value: 50%;
  inherits: false;
}
@property --seg {
  syntax: "<integer>";
  initial-value: 0;
  inherits: true;
}
@property --avg {
  syntax: "<integer>";
  initial-value: 343;
  inherits: true;
}
@property --max {
  syntax: "<integer>";
  initial-value: 430;
  inherits: true;
}
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);
}

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

.pg {
  box-sizing: border-box;
  width: min(392px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  color: #17141a;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}

.pg__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.pg__title {
  font-size: 13px;
  line-height: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pg__sum {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.pg__k {
  color: rgba(23, 20, 26, 0.62);
}

.pg__u {
  color: rgba(23, 20, 26, 0.62);
}

.pg__slash {
  color: rgba(23, 20, 26, 0.62);
}

.pg__n {
  color: #2f6df6;
}

.pg__n--avg {
  counter-reset: a var(--avg);
}

.pg__n--avg::after {
  content: counter(a);
}

.pg__n--max {
  counter-reset: m var(--max);
}

.pg__n--max::after {
  content: counter(m);
}

.pg__seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 4px;
  border-bottom: 1px solid rgba(23, 20, 26, 0.14);
}

.pg__tab {
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(23, 20, 26, 0.62);
  font-family: inherit;
  font-size: 12px;
  line-height: 18px;
  font-weight: 800;
  cursor: pointer;
}

.pg__tab[aria-selected=true] {
  color: #17141a;
}

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

.pg__ind {
  position: absolute;
  left: 4px;
  bottom: -1px;
  height: 2px;
  width: calc((100% - 2 * 4px) / 3);
  border-radius: 999px;
  background: #2f6df6;
  transform: translateX(calc(var(--seg) * 100%));
}

.pg__plot {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: 88px;
  align-items: end;
  gap: 4px;
  padding: 0 4px;
  border-bottom: 1px solid rgba(23, 20, 26, 0.14);
}

.pg__bar {
  height: var(--h);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: #2f6df6;
}

.pg__hint {
  margin: 0;
  padding: 0 4px;
  font-size: 11px;
  line-height: 16px;
  color: rgba(23, 20, 26, 0.62);
}

.pg[data-period="7"] {
  --seg: 0;
  --avg: 343;
  --max: 430;
}

.pg[data-period="30"] {
  --seg: 1;
  --avg: 293;
  --max: 372;
}

.pg[data-period="90"] {
  --seg: 2;
  --avg: 253;
  --max: 310;
}

.pg[data-period="7"] .pg__bar:nth-child(1) {
  --h: 62.4%;
}

.pg[data-period="7"] .pg__bar:nth-child(2) {
  --h: 53.6%;
}

.pg[data-period="7"] .pg__bar:nth-child(3) {
  --h: 80.2%;
}

.pg[data-period="7"] .pg__bar:nth-child(4) {
  --h: 71%;
}

.pg[data-period="7"] .pg__bar:nth-child(5) {
  --h: 57.8%;
}

.pg[data-period="7"] .pg__bar:nth-child(6) {
  --h: 86%;
}

.pg[data-period="7"] .pg__bar:nth-child(7) {
  --h: 74.4%;
}

.pg[data-period="7"] .pg__bar:nth-child(8) {
  --h: 63.4%;
}

.pg[data-period="30"] .pg__bar:nth-child(1) {
  --h: 51.6%;
}

.pg[data-period="30"] .pg__bar:nth-child(2) {
  --h: 59.2%;
}

.pg[data-period="30"] .pg__bar:nth-child(3) {
  --h: 44.2%;
}

.pg[data-period="30"] .pg__bar:nth-child(4) {
  --h: 68%;
}

.pg[data-period="30"] .pg__bar:nth-child(5) {
  --h: 74.4%;
}

.pg[data-period="30"] .pg__bar:nth-child(6) {
  --h: 61%;
}

.pg[data-period="30"] .pg__bar:nth-child(7) {
  --h: 52.8%;
}

.pg[data-period="30"] .pg__bar:nth-child(8) {
  --h: 57.6%;
}

.pg[data-period="90"] .pg__bar:nth-child(1) {
  --h: 39.6%;
}

.pg[data-period="90"] .pg__bar:nth-child(2) {
  --h: 47%;
}

.pg[data-period="90"] .pg__bar:nth-child(3) {
  --h: 52.4%;
}

.pg[data-period="90"] .pg__bar:nth-child(4) {
  --h: 42.8%;
}

.pg[data-period="90"] .pg__bar:nth-child(5) {
  --h: 57.8%;
}

.pg[data-period="90"] .pg__bar:nth-child(6) {
  --h: 49.2%;
}

.pg[data-period="90"] .pg__bar:nth-child(7) {
  --h: 62%;
}

.pg[data-period="90"] .pg__bar:nth-child(8) {
  --h: 54%;
}

.pg:not(.is-demo) .pg__bar {
  transition-property: --h;
  transition-duration: 220ms;
  transition-timing-function: ease-out;
}

.pg:not(.is-demo) .pg__ind {
  transition-property: transform;
  transition-duration: 220ms;
  transition-timing-function: ease-out;
}

@keyframes pg-h1 {
  0%, 20% {
    --h: 62.4%;
  }
  28%, 48% {
    --h: 51.6%;
  }
  56%, 76% {
    --h: 39.6%;
  }
  84%, 100% {
    --h: 62.4%;
  }
}
.pg.is-demo .pg__bar:nth-child(1) {
  animation-name: pg-h1;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h2 {
  0%, 20% {
    --h: 53.6%;
  }
  28%, 48% {
    --h: 59.2%;
  }
  56%, 76% {
    --h: 47%;
  }
  84%, 100% {
    --h: 53.6%;
  }
}
.pg.is-demo .pg__bar:nth-child(2) {
  animation-name: pg-h2;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h3 {
  0%, 20% {
    --h: 80.2%;
  }
  28%, 48% {
    --h: 44.2%;
  }
  56%, 76% {
    --h: 52.4%;
  }
  84%, 100% {
    --h: 80.2%;
  }
}
.pg.is-demo .pg__bar:nth-child(3) {
  animation-name: pg-h3;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h4 {
  0%, 20% {
    --h: 71%;
  }
  28%, 48% {
    --h: 68%;
  }
  56%, 76% {
    --h: 42.8%;
  }
  84%, 100% {
    --h: 71%;
  }
}
.pg.is-demo .pg__bar:nth-child(4) {
  animation-name: pg-h4;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h5 {
  0%, 20% {
    --h: 57.8%;
  }
  28%, 48% {
    --h: 74.4%;
  }
  56%, 76% {
    --h: 57.8%;
  }
  84%, 100% {
    --h: 57.8%;
  }
}
.pg.is-demo .pg__bar:nth-child(5) {
  animation-name: pg-h5;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h6 {
  0%, 20% {
    --h: 86%;
  }
  28%, 48% {
    --h: 61%;
  }
  56%, 76% {
    --h: 49.2%;
  }
  84%, 100% {
    --h: 86%;
  }
}
.pg.is-demo .pg__bar:nth-child(6) {
  animation-name: pg-h6;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h7 {
  0%, 20% {
    --h: 74.4%;
  }
  28%, 48% {
    --h: 52.8%;
  }
  56%, 76% {
    --h: 62%;
  }
  84%, 100% {
    --h: 74.4%;
  }
}
.pg.is-demo .pg__bar:nth-child(7) {
  animation-name: pg-h7;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-h8 {
  0%, 20% {
    --h: 63.4%;
  }
  28%, 48% {
    --h: 57.6%;
  }
  56%, 76% {
    --h: 54%;
  }
  84%, 100% {
    --h: 63.4%;
  }
}
.pg.is-demo .pg__bar:nth-child(8) {
  animation-name: pg-h8;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

.pg.is-demo .pg__ind {
  animation-name: pg-ind;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes pg-ind {
  0%, 20% {
    transform: translateX(0);
  }
  23%, 48% {
    transform: translateX(100%);
  }
  51%, 76% {
    transform: translateX(200%);
  }
  79%, 100% {
    transform: translateX(0);
  }
}
.pg.is-demo {
  animation-name: pg-sum;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes pg-sum {
  0% {
    --avg: 343;
    --max: 430;
  }
  20% {
    --avg: 293;
    --max: 372;
  }
  48% {
    --avg: 253;
    --max: 310;
  }
  76%, 100% {
    --avg: 343;
    --max: 430;
  }
}
.pg.is-demo .pg__tab:nth-of-type(1) {
  animation-name: pg-t1;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes pg-t1 {
  0% {
    color: #17141a;
  }
  20% {
    color: rgba(23, 20, 26, 0.62);
  }
  76%, 100% {
    color: #17141a;
  }
}
.pg.is-demo .pg__tab:nth-of-type(2) {
  animation-name: pg-t2;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes pg-t2 {
  0% {
    color: rgba(23, 20, 26, 0.62);
  }
  20% {
    color: #17141a;
  }
  48%, 100% {
    color: rgba(23, 20, 26, 0.62);
  }
}
.pg.is-demo .pg__tab:nth-of-type(3) {
  animation-name: pg-t3;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes pg-t3 {
  0% {
    color: rgba(23, 20, 26, 0.62);
  }
  48% {
    color: #17141a;
  }
  76%, 100% {
    color: rgba(23, 20, 26, 0.62);
  }
}
.pg.is-demo .pg__sum {
  animation-name: pg-pop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes pg-pop {
  0%, 20%, 48%, 76% {
    transform: scale(1);
  }
  4%, 24%, 52%, 80% {
    transform: scale(1.07);
  }
  10%, 30%, 58%, 86% {
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .pg {
    padding: 8px;
    gap: 4px;
  }
  .pg__hint {
    display: none;
  }
  .pg__title, .pg__sum {
    font-size: 11px;
    line-height: 16px;
  }
  .pg__plot {
    grid-template-rows: 64px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pg.is-demo,
  .pg.is-demo .pg__bar,
  .pg.is-demo .pg__ind,
  .pg.is-demo .pg__sum,
  .pg.is-demo .pg__tab {
    animation: none !important;
  }
  .pg:not(.is-demo) .pg__bar,
  .pg:not(.is-demo) .pg__ind {
    transition: none !important;
  }
}
