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

.tear {
  display: grid;
  place-items: center;
}

.tear__check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tear__ticket {
  position: relative;
  display: flex;
  width: min(320px, 90vw);
  height: 128px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
  overflow: hidden;
}

.tear__half {
  box-sizing: border-box;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  background: #ffffff;
  transition: transform 720ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
}

.tear__half--l {
  flex: 1 1 auto;
  border-right: 0;
}

.tear__half--r {
  flex: 0 0 112px;
  justify-items: center;
  background: linear-gradient(180deg, #ffffff 0%, rgba(47, 109, 246, 0.12) 100%);
}

.tear__title {
  margin: 0;
  font-weight: 800;
  font-size: clamp(16px, 4.6vw, 20px);
  font-family: inherit;
  color: #17141a;
}

.tear__seat {
  margin: 0;
  font-weight: 600;
  font-size: clamp(12px, 3.4vw, 14px);
  font-family: inherit;
  color: rgba(23, 20, 26, 0.6);
}

.tear__barcode {
  width: 56px;
  height: 44px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #17141a 0 4px, transparent 4px 8px, #17141a 8px 10px, transparent 10px 16px);
}

.tear__btn {
  padding: 4px 12px;
  border-radius: 12px;
  background: #17141a;
  font-weight: 700;
  font-size: 12px;
  font-family: inherit;
  color: #ffffff;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tear__btn:active {
  transform: scale(0.94);
}

.tear__perf {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(100% - 112px);
  width: 0;
  border-left: 2px dashed rgba(23, 20, 26, 0.3);
  z-index: 2;
  transition: border-color 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

#tear-ok:checked ~ .tear__ticket .tear__perf {
  border-color: rgba(23, 20, 26, 0.9);
}

#tear-ok:checked ~ .tear__ticket .tear__half--l {
  transform: translate(-52px, 26px) rotate(-9deg);
  opacity: 0;
}

#tear-ok:checked ~ .tear__ticket .tear__half--r {
  transform: translate(44px, 30px) rotate(8deg);
  opacity: 0;
}

.tear.is-demo .tear__half--l {
  animation: half-l 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tear.is-demo .tear__half--r {
  animation: half-r 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tear.is-demo .tear__perf {
  animation: perf 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes half-l {
  0%, 24% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  56%, 84% {
    transform: translate(-52px, 26px) rotate(-9deg);
    opacity: 0;
  }
  92%, 100% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
}
@keyframes half-r {
  0%, 24% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
  56%, 84% {
    transform: translate(44px, 30px) rotate(8deg);
    opacity: 0;
  }
  92%, 100% {
    transform: translate(0, 0) rotate(0);
    opacity: 1;
  }
}
@keyframes perf {
  0%, 24% {
    border-color: rgba(23, 20, 26, 0.3);
  }
  32%, 52% {
    border-color: rgba(23, 20, 26, 0.9);
  }
  60%, 100% {
    border-color: rgba(23, 20, 26, 0.3);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tear__half, .tear__perf, .tear__btn {
    transition: none;
  }
  .tear.is-demo .tear__half,
  .tear.is-demo .tear__perf {
    animation: none;
  }
}
