/* =========================
   ここを変えると全体の見た目を調整できます
   ========================= */
:root {
  --page-bg: #FFF3E0;
  --main-color: #7B2D8E;
  --accent-color: #FF9F1C;
  --text-color: #30213D;
  --paper-bg: #FFFCF5;
  --box-color: #F07818;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text-color);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

.omikuji-app {
  width: min(100% - 32px, 680px);
  margin: 0 auto;
  padding: 44px 0 32px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--main-color);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .22em;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: .08em;
}

.intro { margin: 12px 0 28px; line-height: 1.8; }

.game {
  overflow: hidden;
  padding: 20px 18px 24px;
  border: 1px solid #ead9bd;
  border-radius: 24px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 12px 30px rgba(91, 54, 27, .08);
}

.paper-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 0;
  perspective: 700px;
  transition: height 0.3s ease;
}
.paper-stage.show {
  height: 550px;
}

.fortune-paper {
  position: absolute;
  z-index: 2;
  bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(650px, 98%);
  min-height: 170px;
  padding: 18px 16px;
  border: 1px solid #e5d4b5;
  background: var(--paper-bg);
  box-shadow: 0 8px 18px rgba(64, 42, 24, .14);
  opacity: 0;
  transform: translateY(95px) rotate(5deg) scale(.86);
  pointer-events: none;
}

.fortune-paper.is-visible {
  animation: paper-pop .85s cubic-bezier(.2,.8,.2,1) forwards;
}

.result-image {
  display: block;
  width: 250px;
  height: 250px;
  margin-bottom: 8px;
  object-fit: contain;
}
.result-image[hidden] { display: none; }

.result-label {
  margin: 0;
  color: var(--main-color);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .1em;
}
.result-message { margin: 8px 0 0; font-size: 13px; line-height: 1.65; }
.lucky-item { margin: 8px 0 0; font-size: 12px; color: #80654b; }
.lucky-action { margin: 8px 0 0; font-size: 12px; color: #80654b; }

.box-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 175px;
  margin-top: -2px;
}

/*箱のサイズ*/
.omikuji-box {
  display: block;
  width: 180px;       /* 箱の横幅。ここを変えると大きさを調整 */
  height: 150px;      /* 箱の高さ */
  object-fit: contain;
  transform-origin: 50% 85%;
  /* 透過PNG推奨。画像の余白が大きい場合は画像側でトリミング */
}


  /*箱全体のサイズ*/
.omikuji-box.is-shaking { animation: box-shake .75s ease-in-out; }

button {
  margin-top: 22px;
  padding: 14px 34px;
  border: 0;
  border-radius: 999px;
  background: var(--main-color);
  color: white;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 #7e2026;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #7e2026; }
button:active { transform: translateY(3px); box-shadow: 0 2px 0 #7e2026; }
button:disabled { cursor: wait; opacity: .65; }

.status { min-height: 1.5em; margin: 18px 0 0; color: #80654b; font-size: 13px; }
.note { margin-top: 18px; color: #80654b; font-size: 12px; }

@keyframes box-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-8deg) translateX(-3px); }
  30% { transform: rotate(8deg) translateX(3px); }
  45% { transform: rotate(-7deg) translateX(-2px); }
  60% { transform: rotate(6deg) translateX(2px); }
  75% { transform: rotate(-3deg); }
}
@keyframes paper-pop {
  0% { opacity: 0; transform: translateY(95px) rotate(5deg) scale(.86); }
  55% { opacity: 1; transform: translateY(-22px) rotate(-4deg) scale(1.03); }
  75% { transform: translateY(5px) rotate(2deg) scale(.99); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

@media (max-width: 480px) {
  .omikuji-app { padding-top: 28px; }
  .game { padding-inline: 12px; }

  .paper-stage {
    height: 0;
    transition: height 0.3s ease;
  }
  .paper-stage.show {
    height: 500px;
  }
}


/* =========================
   紙吹雪
   ========================= */

/* 紙吹雪を表示するエリア */
.confetti-container {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 999;
}

/* 紙吹雪ひとつ分 */
.confetti {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  opacity: 0;
  animation: confetti-fall 1.8s ease-out forwards;
}

/* 落ちながら回転する */
@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -20px, 0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translate3d(var(--drift), 100vh, 0)
      rotate(var(--spin));
    opacity: 0;
  }
}