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

.sq {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.sq__cap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 800;
  font-size: clamp(9px, 2.4vw, 11px);
  color: #17141a;
}

.sq__ico {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.sq__frame {
  position: relative;
  height: clamp(80px, 38vh, 130px);
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.sq__out {
  display: block;
  width: 100%;
  height: 100%;
}

.sq__ghost {
  display: none;
  position: absolute;
  inset: 0;
  background: #ffffff;
}

.sq__ghostImg {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  aspect-ratio: 16/10;
  background-image: var(--photo);
  background-size: cover;
  transform: translateY(-50%);
}

.sq__row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.sq__c {
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  border: 2px solid rgba(255, 247, 230, 0.7);
  border-radius: 50%;
}

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

.sq__c[aria-pressed=true] {
  border-color: #17141a;
}

.sq__c--paper {
  background: #ffffff;
}

.sq__c--ink {
  background: #17141a;
}

.sq__c--cream {
  background: #fff7e6;
}

.sq__c--blue {
  background: #2f6df6;
}

.sq__pad {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sq__lab {
  font-weight: 800;
  font-size: clamp(8px, 2.2vw, 10px);
  color: #17141a;
  background: #fff7e6;
  padding: 0 4px;
  border-radius: 4px;
}

.sq__track {
  position: relative;
  display: block;
  width: 72px;
  height: 6px;
  cursor: pointer;
  border-radius: 999px;
  background: rgba(255, 247, 230, 0.4);
}

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

.sq__thumb {
  position: absolute;
  top: 50%;
  left: 40%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 12px rgba(23, 20, 26, 0.32);
  transform: translate(-50%, -50%);
}

.sq.is-demo .sq__out {
  visibility: hidden;
}

.sq.is-demo .sq__ghost {
  display: block;
  animation-name: sqBg;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes sqBg {
  0%, 18% {
    background: #ffffff;
  }
  20%, 40% {
    background: #17141a;
  }
  42%, 62% {
    background: #fff7e6;
  }
  64%, 86% {
    background: #2f6df6;
  }
  88%, 100% {
    background: #ffffff;
  }
}
.sq.is-demo .sq__ghostImg {
  animation-name: sqPad;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes sqPad {
  0% {
    transform: translateY(-50%) scale(1);
  }
  44% {
    transform: translateY(-50%) scale(0.76);
  }
  88%, 100% {
    transform: translateY(-50%) scale(1);
  }
}
.sq.is-demo .sq__thumb {
  animation-name: sqThumb;
  animation-duration: 2s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

@keyframes sqThumb {
  0% {
    transform: translate(-50%, -50%);
  }
  44% {
    transform: translate(-50%, -50%) translateX(36px);
  }
  88%, 100% {
    transform: translate(-50%, -50%);
  }
}
.sq.is-demo .sq__c {
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.sq.is-demo .sq__c--paper {
  animation-name: sqPickA;
}

.sq.is-demo .sq__c--ink {
  animation-name: sqPickB;
}

.sq.is-demo .sq__c--cream {
  animation-name: sqPickC;
}

.sq.is-demo .sq__c--blue {
  animation-name: sqPickD;
}

@keyframes sqPickA {
  0%, 19% {
    border-color: #17141a;
  }
  20%, 87% {
    border-color: rgba(255, 247, 230, 0.7);
  }
  88%, 100% {
    border-color: #17141a;
  }
}
@keyframes sqPickB {
  0%, 19% {
    border-color: rgba(255, 247, 230, 0.7);
  }
  20%, 41% {
    border-color: #17141a;
  }
  42%, 100% {
    border-color: rgba(255, 247, 230, 0.7);
  }
}
@keyframes sqPickC {
  0%, 41% {
    border-color: rgba(255, 247, 230, 0.7);
  }
  42%, 63% {
    border-color: #17141a;
  }
  64%, 100% {
    border-color: rgba(255, 247, 230, 0.7);
  }
}
@keyframes sqPickD {
  0%, 63% {
    border-color: rgba(255, 247, 230, 0.7);
  }
  64%, 87% {
    border-color: #17141a;
  }
  88%, 100% {
    border-color: rgba(255, 247, 230, 0.7);
  }
}
@media (max-width: 340px) {
  .sq__row {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sq.is-demo .sq__ghost,
  .sq.is-demo .sq__ghostImg,
  .sq.is-demo .sq__thumb,
  .sq.is-demo .sq__c {
    animation: none !important;
  }
  .sq.is-demo .sq__ghost {
    background: #17141a !important;
  }
  .sq.is-demo .sq__ghostImg {
    transform: translateY(-50%) scale(0.76) !important;
  }
  .sq.is-demo .sq__thumb {
    transform: translate(-50%, -50%) translateX(36px) !important;
  }
  .sq.is-demo .sq__c--ink {
    border-color: #17141a !important;
  }
  .sq.is-demo .sq__c--paper {
    border-color: rgba(255, 247, 230, 0.7) !important;
  }
}
