@property --h {
  syntax: "<percentage>";
  initial-value: 0%;
  inherits: false;
}
@property --g {
  syntax: "<number>";
  initial-value: 1;
  inherits: true;
}
@property --mx {
  syntax: "<integer>";
  initial-value: 460;
  inherits: true;
}
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);
}

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

.lg {
  --g: 1;
  --mx: 460;
  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;
}

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

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

.lg__lab {
  font-size: 12px;
  line-height: 18px;
  color: rgba(23, 20, 26, 0.62);
}

.lg__n {
  font-style: normal;
  counter-reset: mx var(--mx);
}

.lg__n::after {
  content: counter(mx);
}

.lg__val {
  font-size: 13px;
  line-height: 18px;
  font-weight: 800;
  color: #2f6df6;
  font-variant-numeric: tabular-nums;
}

.lg__plot {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lg__groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  height: 112px;
}

.lg__group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  align-items: end;
}

.lg__bar {
  --h: var(--b);
  justify-self: center;
  width: 64%;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  background: #2f6df6;
  transform-origin: 50% 100%;
}

.lg__bar[data-s="1"] {
  background: #17141a;
}

.lg__bar[data-s="2"] {
  background: rgb(23.9843137255%, 62.0549019608%, 49.7254901961%);
}

.lg__bar[data-fold="1"] {
  transform: scaleY(0);
}

.lg__axis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.lg__axis span {
  text-align: center;
  font-size: 11px;
  line-height: 14px;
  color: rgba(23, 20, 26, 0.62);
}

.lg__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 0 4px;
}

.lg__chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px 8px;
  border: 1.5px solid rgba(23, 20, 26, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: #17141a;
  font-family: inherit;
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  cursor: pointer;
}

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

.lg__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f6df6;
}

.lg__chip[data-s="1"] .lg__dot {
  background: #17141a;
}

.lg__chip[data-s="2"] .lg__dot {
  background: rgb(23.9843137255%, 62.0549019608%, 49.7254901961%);
}

.lg__chip[aria-pressed=false] {
  color: rgba(23, 20, 26, 0.62);
}

.lg__chip[aria-pressed=false] .lg__dot {
  transform: scale(0.55);
}

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

.lg:not(.is-demo) .lg__bar {
  transition-property: --h, transform;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lg:not(.is-demo) .lg__dot {
  transition-property: transform;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lg.is-demo .lg__bar {
  --h: calc(var(--b) * var(--g));
}

.lg.is-demo,
.lg.is-demo .lg__bar[data-s="0"] {
  animation-duration: 2s;
  animation-iteration-count: infinite;
}

@keyframes lg-grow {
  0%, 12% {
    --g: 1;
  }
  30%, 68% {
    --g: 1.7692;
  }
  84%, 100% {
    --g: 1;
  }
}
.lg.is-demo .lg__bar[data-s="0"] {
  animation-name: lg-fold;
  animation-timing-function: steps(1, end);
}

@keyframes lg-fold {
  0%, 11.99% {
    transform: scaleY(1);
  }
  12%, 83.99% {
    transform: scaleY(0);
  }
  84%, 100% {
    transform: scaleY(1);
  }
}
.lg.is-demo .lg__chip[data-s="0"] {
  animation-name: lg-chip;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.lg.is-demo {
  animation-name: lg-grow, lg-mx;
  animation-timing-function: ease-out, steps(1, end);
}

@keyframes lg-mx {
  0%, 11.99% {
    --mx: 460;
  }
  12%, 83.99% {
    --mx: 260;
  }
  84%, 100% {
    --mx: 460;
  }
}
@keyframes lg-chip {
  0%, 11.99% {
    color: #17141a;
  }
  12%, 83.99% {
    color: rgba(23, 20, 26, 0.62);
  }
  84%, 100% {
    color: #17141a;
  }
}
.lg.is-demo .lg__chip[data-s="0"] .lg__dot {
  animation-name: lg-dot;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 1.4, 0.4, 1);
  animation-iteration-count: infinite;
}

@keyframes lg-dot {
  0%, 12% {
    transform: scale(1);
  }
  30%, 68% {
    transform: scale(0.55);
  }
  84%, 100% {
    transform: scale(1);
  }
}
@media (max-width: 340px) {
  .lg {
    padding: 8px;
    gap: 4px;
  }
  .lg__groups {
    height: 84px;
    gap: 4px;
  }
  .lg__title, .lg__val {
    font-size: 12px;
    line-height: 16px;
  }
  .lg__lab {
    font-size: 11px;
    line-height: 16px;
  }
  .lg__chip {
    padding: 4px;
    font-size: 11px;
    line-height: 14px;
  }
  .lg__hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lg.is-demo,
  .lg.is-demo .lg__bar[data-s="0"],
  .lg.is-demo .lg__chip[data-s="0"],
  .lg.is-demo .lg__chip[data-s="0"] .lg__dot {
    animation: none !important;
  }
  .lg:not(.is-demo) .lg__bar,
  .lg:not(.is-demo) .lg__dot {
    transition: none !important;
  }
}
