/* z-index 정리 */
/* .img-piece : 1 */
/* .img-piece 움직이는 것 : 2 */
/* #img-full : 3 */
/* #app-intro : 4 */
/* [data-name="mojs-shape"] : 5 */
/* #message-container : 6 */
/* #confetti-wrapper : 7 */


#app-wrapper {
  width: 100%;
  /* header 높이만큼 뺀다. */
  height: calc(100vh - var(--header-height));
  padding: 15px;
  position: relative;
  display: flex;
  flex-direction: column;
}

#jigsaw-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#page-title {
  width: 100%;
  text-align: center;
  padding: 20px;
  font-size: 24px;
}

/* 타이머다. */
#timer-wrapper {
  width: 80%;
  height: 30px;
  margin: 10px 0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
  background: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  /* 공간을 차지하도록 한다. */
  visibility: hidden;
}

#timer-wrapper.is-active {
  visibility: visible;
}

#timer-container {
  position: relative;
  width: 95%;
  height: 90%;
}

#timer-bar {
  /* 왼쪽으로 줄어들게 보이기 하기 위해서 position을 absolute로 한다. */
  position: absolute;
  top: 50%;
  left: 0;
  height: 70%;
  transform: translateY(-50%);
  width: 100%;
  border-radius: 15px;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .2);
  background: #fff134;
}

/* 게임 버튼을 클릭하면 시작한다. */
/* is-running 클래스를 추가한다. */
/* js에서 시간을 정한다. */
/* root.style.setProperty("--app-time", `${AppConfig.appTime}s`); */
#timer-bar.is-running {
  animation: timerProgress var(--app-time) linear forwards;
}

/* 문제를 맞추면 stop 클래스를 추가해서 애니메이션을 멈춘다. */
/* stop 클래스를 추가하지 않고 is-running 클래스를 삭제하는 방법을 사용한다. */
#timer-bar.stop {
  animation: none !important;
}

@keyframes timerProgress {
  to {
    width: 0%;
  }
}

#progress-indicator{
  padding: 5px;
  font-size: 20px;
  text-align: center;
}
#heart-container {
  width: 100%;
  padding: 20px;
  display: flex;
  /* 오른쪽 끝에 배치한다. */
  justify-content: center;
  gap: 5px;
  font-size: 20px;
}

.heart-shape {
  color: #fe347e;
  animation: heartbeat 0.7s infinite;
}

@keyframes heartbeat {
  50% {
    transform: scale(1.1);
  }
}

#img-wrapper {
  position: relative;
  --wrapper-size: 600px;
  width: var(--wrapper-size);
  height: var(--wrapper-size);
}

@media screen and (max-width: 880px) {
  #img-wrapper {
    --wrapper-size: 400px;    
  }
}

#app-intro {
  position: absolute;
  background: #ffffff;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
  z-index: 4;
  font-size: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
#app-notice{
  padding: 10px;
  min-width: 300px;
}
#app-notice ul{
  margin-left: 10px;
}
#app-notice ul li{
  list-style: disc;
  word-break: keep-all;
  padding: 5px;
}
#start-button {
  font-size: 25px;
  border-radius: 15px;
  border: 2px solid var(--site-color-1);
  padding: 20px;
  background: none;
  animation: heartbeatHeart 1s infinite;
}

/* 사진이 나오는 곳이다. */
#img-piece-wrapper {
  /* #img-piece-wrapper의 기준이 된다. */
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
  border-radius: 5px;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}



/* 전체 이미지다. */
/* #img-piece-wrapper와 크기가 같다. */
/* 전체사진 버튼을 클릭하면 display가 토글되면서 보인다. */
#img-full {
  /* #img-piece-wrapper와 같은 값으로 정한다. */
  border-radius: 5px;
  position: absolute;
  /* top:0; right:0; bottom:0; left:0; 와 동일 */
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  /* 조각 위에 올라가도록 한다. */
  z-index: 3;
}

#img-full.solved {
  /* 1초다 heartbeat를 하는데 3번 반복한다. */ 
  animation: heartbeat 1s 3;
}

@keyframes heartbeat {
  50% {
    transform: scale(1.05);
  }
}

/* 사진 조각이다. */
/* absolute로 배치하고 left/top으로 위치를 정한다. */
/* 동일한 이미지를 background로 쓰고, background-position만 바꿔서 조각을 만든다. */
.img-piece {
  position: absolute;
  left: 0;
  top: 0;
  background-repeat: no-repeat;
  cursor: pointer;
  z-index: 1;
  /* 위치 교환 시 부드럽게 보이도록 */
  transition: left 180ms ease, top 180ms ease, transform 120ms ease;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.8);
  /* 4방향을 설정할 수도 있다. */
  /* box-shadow: inset -2px 0px 0px #ff0000, inset 2px 0px 0px #ff0000, inset 0px -2px 0px #ff0000, inset 0px 2px 0px #ff0000; */
}

/* 조각을 클릭했을 때다. */
.img-piece.is-selected {
  transform: scale(1.02);
  outline: 3px solid rgba(255, 0, 166, 0.9);
  outline-offset: -3px;
}

/* 클릭하지 못하도록 한다. */
.img-piece.is-disabled {
  pointer-events: none;
}

/* 조각이 잠긴 상태다. */
/* 움직이지 못한다. */
.img-piece.is-locked {
  /* 이벤트를 받지 못하도록 한다. */
  pointer-events: none;
  box-shadow: none;
}

#message-container{
    position: absolute;
    /* 가운데 정렬한다. */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    border: 5px solid #000;
    box-shadow: 0px 0px 2px rgba(0, 0, 0, .2);
    background: #fff;
    z-index: 6;
    visibility: hidden;
    pointer-events: none;
}
#message-container.is-active{
    visibility: visible;
}
#app-message{
    padding: 20px;
    font-size: 24px;
    font-weight: bold;
}
#mesasge-confirm{
    padding: 20px;
    font-size: var(--fontsize-h2);
    border-radius: 20px;
    border: 3px solid var(--site-color-1);
}


#show-full-image-button {
  margin-top: 25px;
  font-size: 22px;
  padding: 10px 12px;
  border-radius: 20px;
  background: var(--site-color-2);
}

/* mo.js 관련이다. */
[data-name="mojs-shape"] {
  /* 위에 있도록 한다. */
  z-index: 5 !important;
  /* 클릭할 수 없도록 한다. */
  /* 게임을 할 때 위에 있어서 아래 있는 블록을 클릭하지 못하는 경우가 있다. */
  pointer-events: none;
}

/* lottie.js 효과가 나온다. */
#confetti-wrapper {
  /* #app-wrapper가 기준이다. */
  position: absolute;
  /* 부모의 공간을 다 사용한다. */
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  /* 클릭하지 못하도록 한다. */
  pointer-events: none;
  /* is-active 클래스를 추가하면 보인다. */
  display: none;
  display: flex;
  justify-content: center;
  align-items: center;
  /* 조각, mo.js 객체보다 위에 있도록 한다. */
  z-index: 7;
}

#confetti-wrapper.is-active {
  display: block;
}

#confetti-container {
  /* 부모의 공간을 다 사용한다. */
  width: 100%;
  height: 100%;
  /* 클릭하지 못하도록 한다. */
  pointer-events: none;
}