/* omikuji.css */

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  color: #fff;
  background-color: #ea5504;
}

/* hidden 属性の display:none を壊さないため、section には display を指定しない */
#stage-start,
#stage-result {
  width: 100%;
  text-align: center;
}

/* -------- Stage 1 -------- */
.omikuji {
  display: block;
  margin: -10vh auto 0;
  padding: 0;
  width: fit-content;
  background: transparent;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.omikuji img {
  display: block;
  margin: 0 auto 50px;
  height: 50vh;
  max-height: 50svh;
  transform-origin: 50% 100%;
  backface-visibility: hidden;
  will-change: transform;
}

.explanation {
  margin-bottom: 30px;
}

.explanation.is-hidden {
  visibility: hidden;
}

/* click animation */
.omikuji img.is-shaking {
  animation: omikujiShake 0.9s linear both;
}

@keyframes omikujiShake {
  0%   { transform: rotate(0deg); }
  10%  { transform: rotate(10deg); }
  25%  { transform: rotate(-10deg); }
  40%  { transform: rotate(10deg); }
  55%  { transform: rotate(-10deg); }
  70%  { transform: rotate(10deg); }
  85%  { transform: rotate(-10deg); }
  100% { transform: rotate(0deg); }
}

/* -------- Stage 2 -------- */
.paper {
  margin-top: -5vh;
}

.paper img {
  display: block;
  margin: 0 auto 50px;
  height: 70vh;
  max-height: 70svh;
  will-change: transform, opacity;
}

/* ふわっと上から降る（ゆっくり） */
.paper img.is-dropping {
  animation: paperDrop 2.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes paperDrop {
  0% {
    opacity: 0;
    transform: translateY(-30vh) rotate(-2deg) scale(0.98);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

/* ボタンは常に場所だけ確保して、表示切り替えで .paper が動かないようにする */
.retry-btn {
  min-height: 44px;
}

.retry-btn.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.retry-btn button {
  display: inline-block;
  padding: 0.5rem 1rem;
  font: inherit;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.4);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.retry-btn button:hover {
  background-color: rgba(0, 0, 0, 0.6);
}

.retry-btn button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* musubi を右上に縦積み（gapなし） */
.musubi-stack {
  display: flex;
  position: fixed;
  right: 10px;
  top: 10px;
  z-index: 10;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  width: 50px;
  line-height: 0;
  pointer-events: none;
}

.musubi-stack img {
  display: block;
  width: 50px;
  height: auto;
}
