/* =========================
   全体設定
========================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  background-color: #f8fafc;
  color: #1f2937;
}

img {
  max-width: 100%;
  display: block;
}

/* =========================
   レイアウト
========================= */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.sub-text {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* =========================
   カード共通
========================= */
.card {
  background-color: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* =========================
   ボタンエリア
========================= */
.draw-section {
  text-align: center;
}

.draw-button {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background-color: #f59e0b;
  color: #ffffff;
  cursor: pointer;
}

.draw-button:hover {
  opacity: 0.9;
}

.draw-button:active {
  transform: scale(0.98);
}

/* =========================
   結果表示
========================= */
.result-section h2,
.history-section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 20px;
}

.result-text {
  margin: 0 0 16px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  min-height: 36px;
}

.image-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.result-image {
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

/* =========================
   履歴表示
========================= */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.reset-button {
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  background-color: #ef4444;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
}

.reset-button:hover {
  opacity: 0.9;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background-color: #f9fafb;
}

.history-list li {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  line-height: 1.5;
}

.history-list li:last-child {
  border-bottom: none;
}

.empty-message {
  text-align: center;
  color: #6b7280;
}

/* =========================
   大吉演出用の土台
   JSで body に lucky-mode を付ける想定
========================= */
body.lucky-mode {
  background-color: #fff7d6;
}

/* =========================
   スマホ向け微調整
========================= */
@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .app-header h1 {
    font-size: 24px;
  }

  .result-text {
    font-size: 22px;
  }

  .history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .reset-button {
    width: 100%;
  }
}
.theme-daikichi { background:#fff7d6; }
.theme-chukichi { background:#fff3e0; }
.theme-kichi { background:#e8f5e9; }
.theme-suekichi { background:#e3f2fd; }
.theme-kyo { background:#ede7f6; }

/* =========================
   大吉演出
========================= */
.celebration-effect {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 9999;
  overflow: hidden;
}

.celebration-effect.show {
  display: flex;
}

.celebration-text {
  margin-top: 80px;
  padding: 16px 24px;
  border-radius: 999px;
  background-color: rgba(245, 158, 11, 0.95);
  color: #ffffff;
  font-size: 28px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  animation: popIn 0.4s ease-out;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  opacity: 0.9;
  animation: fall linear forwards;
}

/* 紙吹雪の色 */
.confetti.color1 { background-color: #f59e0b; }
.confetti.color2 { background-color: #ef4444; }
.confetti.color3 { background-color: #22c55e; }
.confetti.color4 { background-color: #3b82f6; }
.confetti.color5 { background-color: #a855f7; }
.confetti.color6 { background-color: #facc15; }

@keyframes popIn {
  0% {
    transform: scale(0.7) translateY(-10px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.9;
  }
}

@media (max-width: 480px) {
  .celebration-text {
    margin-top: 60px;
    font-size: 22px;
    padding: 14px 18px;
  }

  .confetti {
    width: 10px;
    height: 14px;
  }
}

.draw-button:active {
  transform: scale(0.96);
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.2);
}
.draw-button:disabled {
  background-color: #fcd34d;
  cursor: not-allowed;
  opacity: 0.8;
}