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

.sb {
  box-sizing: border-box;
  width: clamp(248px, 78vw, 320px);
  height: 216px;
  overflow: hidden;
  border-radius: 16px;
  background: #fdf8f0;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.sb__view {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.sb__doc {
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.sb__body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.sb__title {
  margin: 0;
  color: #15131a;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  font-family: inherit;
}

.sb__row {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #e3ddd2;
}

.sb__row--full {
  width: 100%;
}

.sb__row--wide {
  width: 86%;
}

.sb__row--mid {
  width: 62%;
}

.sb__row--short {
  width: 40%;
}

.sb__bar {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: #15131a;
}

.is-demo .sb__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

.is-demo .sb {
  position: relative;
}

.sb__handle {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #bdb7c6;
  cursor: pointer;
  touch-action: pan-y;
}

.sb__handle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -2px;
}

.sb__handleName {
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
}

.sb__caret {
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sb__caret svg {
  display: block;
}

.sb__panel {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  transition: grid-template-rows 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sb__inner {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
  padding: 0 12px 12px;
}

.sb__pick {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #2b2833;
  color: #ffffff;
  text-decoration: none;
}

.sb__pick svg {
  display: block;
}

.sb__pick:hover, .sb__pick:focus-visible {
  color: #c8dce4;
}

.sb__pick:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.sb.is-open .sb__panel {
  grid-template-rows: 1fr;
}

.sb.is-open .sb__caret {
  transform: rotate(180deg);
}

.is-demo .sb__panel {
  animation-name: sbOpen;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.is-demo .sb__caret {
  animation-name: sbTurn;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
}

.is-demo .sb__pick {
  animation-name: sbPop;
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}

.is-demo .sb__pick:nth-child(1) {
  animation-delay: 0.5s;
}

.is-demo .sb__pick:nth-child(2) {
  animation-delay: 0.58s;
}

.is-demo .sb__pick:nth-child(3) {
  animation-delay: 0.66s;
}

.is-demo .sb__pick:nth-child(4) {
  animation-delay: 0.74s;
}

.is-demo .sb__pick:nth-child(5) {
  animation-delay: 0.82s;
}

@keyframes sbOpen {
  0%, 24.9% {
    grid-template-rows: 0fr;
  }
  25%, 100% {
    grid-template-rows: 1fr;
  }
}
@keyframes sbTurn {
  0%, 8% {
    transform: rotate(0deg);
  }
  25%, 100% {
    transform: rotate(180deg);
  }
}
@keyframes sbPop {
  0% {
    transform: translateY(8px) scale(0.88);
  }
  26%, 100% {
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 340px), (max-height: 220px) {
  .sb {
    height: 156px;
  }
  .sb__doc {
    min-height: 220px;
  }
  .sb__body {
    gap: 4px;
    padding: 12px;
  }
  .sb__title {
    font-size: 13px;
  }
  .sb__row {
    height: 6px;
  }
  .sb__handle {
    height: 32px;
    padding: 0 8px;
  }
  .sb__inner {
    gap: 4px;
    padding: 0 8px 8px;
  }
  .sb__pick {
    width: 32px;
    height: 32px;
  }
  .sb__pick svg {
    width: 16px;
    height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .is-demo .sb__panel, .is-demo .sb__caret, .is-demo .sb__pick {
    animation: none !important;
  }
  .sb__panel, .sb__caret {
    transition: none !important;
  }
  .sb.is-open .sb__panel {
    grid-template-rows: 1fr;
  }
  .sb__pick {
    transform: none;
  }
}
