/* ===== ベース設定 ===== */
:root {
  --red: #e63946;
  --red-dark: #c1121f;
  --navy: #1d3557;
  --navy-soft: #457b9d;
  --bg: #f1f3f5;
  --card: #ffffff;
  --text: #1d3557;
  --shadow: 0 12px 30px rgba(29, 53, 87, 0.15);
  --shadow-strong: 0 18px 40px rgba(230, 57, 70, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Segoe UI", Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  overflow-x: hidden;
}

/* ===== アプリ全体（モバイルファースト：1カラム） ===== */
.app {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 0 32px;
}

/* ===== 画像プレビュー（最上部） ===== */
.preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 22px;
  background: linear-gradient(135deg, #e9ecef, #dee2e6);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 3px dashed #ced4da;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--navy-soft);
  text-align: center;
  padding: 20px;
}

.preview-icon {
  font-size: 54px;
  filter: grayscale(20%);
}

.preview-text {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

#previewImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== ヘッダー ===== */
.header {
  text-align: center;
  padding: 4px 0;
}

.title {
  font-size: 34px;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-soft);
}

/* ===== カード ===== */
.card {
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 24px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== アップロードボタン ===== */
.upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  border: 2px solid var(--navy);
  border-radius: 16px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
  background: #f8f9fa;
}

.upload:active {
  transform: scale(0.97);
  background: var(--navy);
  color: #fff;
}

.upload-icon {
  font-size: 22px;
}

/* ===== 運命のボタン ===== */
.verdict-btn {
  width: 100%;
  padding: 22px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-strong);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  animation: breathe 2.6s ease-in-out infinite;
}

.verdict-btn:active {
  transform: scale(0.96);
  box-shadow: 0 8px 20px rgba(230, 57, 70, 0.3);
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* ===== お説教表示エリア ===== */
.sermon {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  border-radius: 18px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.55;
  color: var(--red-dark);
  background: #fff5f5;
  border: 2px solid #ffc9c9;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sermon.show {
  opacity: 1;
}

.sermon.empty {
  color: var(--navy-soft);
  background: #f8f9fa;
  border-color: #e9ecef;
  font-size: 15px;
  font-weight: 600;
}

/* ===== アニメーション：ポップイン ＋ シェイク ===== */
@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  80% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.pop-in {
  animation: popIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-10px) rotate(-1deg); }
  30% { transform: translateX(10px) rotate(1deg); }
  45% { transform: translateX(-8px) rotate(-0.6deg); }
  60% { transform: translateX(8px) rotate(0.6deg); }
  75% { transform: translateX(-4px); }
}

.shake {
  animation: shake 0.5s ease;
}

/* ===== フッター ===== */
.footer {
  text-align: center;
  font-size: 11px;
  color: #adb5bd;
  line-height: 1.6;
  padding: 0 10px;
}
