/* ==========================================================================
   1. 基本スタイル & 全体レイアウト
   ========================================================================== */
body {
  font-family:
    "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
    Meiryo, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f5f5f5;
  color: #333;
}

.container {
  margin: 0 auto;
  max-width: 800px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  box-sizing: border-box; /* （横揺れ防止） */
  margin-top: 40px;
  margin-bottom: 20px;
}

h1 {
  color: #333;
  margin-top: 0;
}

h3 {
  margin-top: 6px;
  margin-bottom: 6px;
  text-shadow:
    1px 1px 4px rgba(255, 255, 255, 0.8),
    -1px 1px 4px rgba(255, 255, 255, 0.8),
    1px -1px 4px rgba(255, 255, 255, 0.8),
    -1px -1px 4px rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   2. フォームまわり
   ========================================================================== */
.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  text-shadow:
    1px 1px 4px rgba(255, 255, 255, 0.8),
    -1px 1px 4px rgba(255, 255, 255, 0.8),
    1px -1px 4px rgba(255, 255, 255, 0.8),
    -1px -1px 4px rgba(255, 255, 255, 0.8);
}

/* Djangoが生成する入力フォームへの汎用スタイル */
input[type="number"],
select,
input[type="text"] {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px; /* スマホでタップした時に画面がズームするのを防ぐ */
}

/* エラーメッセージ */
.error-list {
  color: #dc3545;
  margin-bottom: 15px;
}

.field-error {
  color: #dc3545;
  font-size: 14px;
  display: block;
  margin-top: 5px;
}

/* ==========================================================================
   3. ボタンエリア（フレックスボックス）
   ========================================================================== */
.btn-group {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.btn-group button {
  flex: 1;
  padding: 12px;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease; /* ホバー時のアニメーションを滑らかに */
}

/* 各ボタン固有のカラー */
.btn-all {
  background-color: #ff7f0e;
}
.btn-all:hover {
  background-color: #e06d0b;
}

.btn-cherry {
  background-color: #e377c2;
}
.btn-cherry:hover {
  background-color: #ca5fa9;
}

.btn-watermelon {
  background-color: #2ca02c;
}
.btn-watermelon:hover {
  background-color: #228422;
}

/* ==========================================================================
   4. 結果表示エリア
   ========================================================================== */
.results-container {
  margin-top: 20px;
}

.result-box {
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

/* モード別カスタムカラー（枠線と背景） */
.result-box.cherry-mode {
  border: 2px solid #e377c2;
  background-color: #fffafc;
}
.result-box.cherry-mode span {
  color: #e377c2;
}

.result-box.watermelon-mode {
  border: 2px solid #2ca02c;
  background-color: #f5fbf5;
}
.result-box.watermelon-mode span {
  color: #2ca02c;
}

.result-box.all-mode {
  border: 2px solid #ff7f0e;
  background-color: #fffaf5;
}
.result-box.all-mode span {
  color: #ff7f0e;
}

/* 確率テキストの並び */
.prob-list {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.prob-item {
  font-size: 16px;
  margin: 0;
}

.prob-item span {
  font-size: 18px;
  font-weight: bold;
}

/* グラフ・分析エリア */
.chart-section {
  margin-top: 35px;
  text-align: center;
}

.chart-section p {
  margin-top: 6px;
  margin-bottom: 6px;
  font-size: 0.76rem;
}

.chart-section img {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

.chart-border {
  border: 1px solid #ddd;
  border-radius: 6px;
}

/* ==========================================================================
   6. ヘッダーエリア（画像配置用の枠）
   ========================================================================== */
.app-header {
  width: 100%;
  height: 350px; /* スマホ・PC共通のベースの高さ */
  background-color: #ffdeea; /* マギレコっぽい淡いピンクを仮色に設定 */
  margin-bottom: 0;
  overflow: hidden;
  position: relative;
  background-image: url("../images/magireco_header.fa53b02e25ab.jpg");
  background-repeat: no-repeat no-repeat;
  background-size: cover;
  background-position: center 18%;

  /* 画像が入った時に中央に綺麗に収める設定 */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ヘッダー内のタイトル文字 */
.app-header h1 {
  position: relative;
  z-index: 2; /* 画像より前面に表示 */
  color: #f47bac; /* 濃いめのピンク・赤系 */
  text-shadow:
    1px 1px 4px rgba(255, 255, 255, 0.8),
    -1px 1px 4px rgba(255, 255, 255, 0.8),
    1px -1px 4px rgba(255, 255, 255, 0.8),
    -1px -1px 4px rgba(255, 255, 255, 0.8);
  margin: 0;
  padding: 0 10px;
  text-align: center;
  font-size: 3.6vw;
}

/* ==========================================================================
   8. フッターエリア
   ========================================================================== */
.app-footer {
  width: 100%;
  background-color: #ffdeea;
  color: #333;
  padding: 15px 0;
  margin-top: 40px;
  font-size: 14px;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.app-footer p {
  margin: 0;
  color: #333; /* コピーライトの地文を少し落ち着いたグレーに */
}

/* コピーライト内のX（旧Twitter）リンクの装飾 */
.footer-x-link {
  color: #333; /* 通常時は文字と同じ白（または薄いグレー）に見せる */
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s ease;
  margin-left: 5px;
}

.footer-x-link:hover {
  color: #ffb6c1;
  text-decoration: underline;
  text-shadow:
    1px 1px 2px rgba(80, 80, 80, 0.5),
    -1px 1px 2px rgba(80, 80, 80, 0.5),
    1px -1px 2px rgba(80, 80, 80, 0.5),
    -1px -1px 2px rgba(80, 80, 80, 0.5);
}

/* ==========================================================================
   📱 レスポンシブ対応（画面幅が600px以下のスマホサイズ）
   ========================================================================== */
@media (max-width: 600px) {
  body {
    padding: 0; /* スマホ時は余白を狭くして画面を広く使う */
  }
  .app-header {
    height: 188px; /* スマホ画面に合わせて高さを低く */
    background-position: top 18%;
  }
  .app-header h1 {
    font-size: 4.6vw;
    opacity: 0.88;
    top: 3%;
  }
  .container {
    padding: 15px;
    margin-top: 20px;
    background: none;
    box-shadow: none;
  }
  .btn-group {
    flex-direction: column;
    gap: 24px;
  }
  .btn-group button {
    width: 100%;
  }
  .prob-list {
    flex-direction: column;
    gap: 5px;
  }
  .chart-display-flex {
    flex-direction: column;
    gap: 10px;
  }
  .chara-mini-side {
    right: 0;
    width: 80px; /* スマホ時はさらに小さく */
  }
  body::before {
    background-position: 40% center;
  }
  .chart-section > p {
    text-shadow:
      1px 1px 1px rgba(255, 255, 255, 0.8),
      -1px 1px 1px rgba(255, 255, 255, 0.8),
      1px -1px 1px rgba(255, 255, 255, 0.8),
      -1px -1px 1px rgba(255, 255, 255, 0.8);
  }
}

/* ==========================================================================
   📱 レスポンシブ対応（画面幅が601px~920px以下のタブレット）
   ========================================================================== */

@media (601px <= width <= 920px) {
  .container {
    max-width: 80%;
  }
}
/* ==========================================================================
   7. キャラクター・背景演出の追加設定
   ========================================================================== */

/* 1. ページ全体の背景に街の画像をうっすら敷く */
body {
  position: relative;
  background-color: #f5f5f5;
  z-index: 1;
}

/* 擬似要素を使って背景画像だけを薄く透過 */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 【作業メモ】街の画像を用意したら下のコメントアウトを解除 */
  background-image: url("../images/bg_pc.388442bf8934.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.25;
  z-index: -1;
  pointer-events: none; /* 背景画像がクリックの邪魔をしないようにガード */
}

.chart-section {
  position: relative;
}

/* 3. グラフの横に表示するキャラ画像の設定 */
.chara-mini-side {
  position: absolute;
  right: 20px;
  bottom: 10%;
  width: 120px; /* 小さく表示するための固定幅 */
  height: auto;
  object-fit: contain;
  /* ぷるぷる浮いているような可愛いアニメーション（お好みで） */
  animation: floatChara 3s ease-in-out infinite;
}

@keyframes floatChara {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* 📱 スマホ時は画面が狭いので、横並びを解除して縦並びにする（レスポンシブ） */
@media (max-width: 600px) {
}

/* ==========================================================================
   8. インジケーターの表示
   ========================================================================== */

/* 1行分のレイアウトを横並び（揃える）にする */
.prob-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px; /* 各設定ごとの隙間 */
  width: 100%;
  box-sizing: border-box;
}

/* 「設定 1」などの文字の幅を固定して縦のラインを揃える */
.setting-label {
  width: 70px;
  font-size: 14px;
  flex-shrink: 0;
}

/* グラフの土台（グレーの背景） */
.gauge-container {
  flex-grow: 1; /* 画面幅に合わせて伸縮させる */
  height: 16px; /* バーの太さ */
  background-color: #eee; /* 未満部分のグレー */
  border-radius: 8px; /* 角丸にしてマイルドに */
  margin: 0 15px; /* 左右の文字との隙間 */
  overflow: hidden; /* はみ出たバーを角丸の中に収める */
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1); /* 少し立体感 */
  min-width: 100px;
}

/* 実際に％に応じて伸びるカラーバー */
.gauge-bar {
  height: 100%;
  background: linear-gradient(
    90deg,
    #ff9f43,
    #ff7f0e
  ); /* 🌟 ネオン風のグラデーション */
  border-radius: 8px 0 0 8px;
  transition: width 0.5s ease-out; /* 🌟 画面表示時にニュッと伸びるアニメーション効果！ */
}

/* モードごとにバーの色を変えたい場合のカスタム（お好みで） */
.cherry-mode .gauge-bar {
  background: linear-gradient(90deg, #f3a683, #e377c2); /* チェリー用ピンク */
}
.watermelon-mode .gauge-bar {
  background: linear-gradient(90deg, #55efc4, #2ca02c); /* スイカ用グリーン */
}

/* ％の数値の幅を固定 */
.prob-value {
  width: 60px;
  text-align: right;
  font-size: 16px;
  font-weight: bold;
  flex-shrink: 0;
}

/* 
======================================================
  ロード画面用処理
======================================================
*/
/* 画面全体を覆う半透明の背景 */
#loading-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 240, 245, 0.85); /* 薄いラベンダーピンク */
  z-index: 9999; /* 一番手前に表示 */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ローディングを囲むボックス */
.loading-box {
  text-align: center;
}

/* 🌟マギレコ風マジックスピナー */
.magic-spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  position: relative;

  /* 1. 円錐グラデーションで「光の筋」と「光沢の明暗」を作る */
  background: conic-gradient(
    from 0deg,

    /* 設定1 */
    /* #d91980 0%,
    #ff69b4 25%,
    #ffb6c1 50%,
    #ff69b4 75%,
    #d91980 100% */
    /* 設定2 */ #f9208d 0%,
    #ff1493 12%,
    #ff1493 15%,
    #ff69b4 30%,
    #ffd1dc 45%,
    #ffffff 55%,
    #ffb6c1 60%,
    #ff1493 75%,
    #ff1493 90%,
    #f9208d 100%
  );

  /* 魔法の輝き（外側へのグローエフェクト） */
  box-shadow:
    0 0 20px rgba(255, 20, 147, 0.6),
    inset 0 0 10px rgba(255, 255, 255, 0.5); /* 内側にもハイライト */

  animation: magic-rotate 1.6s linear infinite; /* 無限に回転 */
}

/* 2. 疑似要素を使って、真ん中をくり抜いて「リング状」に見せる */
.magic-spinner::after {
  content: "";
  position: absolute;
  /* 枠線の太さを「6px」に合わせるため、上下左右から6px狭める */
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: 50%;

  /* 背景色（ラベンダーピンク）と同じ色でくり抜く、あるいは少しグラデを入れるとより綺麗です */
  background: radial-gradient(
    circle,
    rgba(255, 245, 250, 1) 0%,
    rgba(255, 240, 245, 0.85) 100%
  );

  /* くり抜いた内側のエッジに薄い影をつけ、立体感を出す */
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.15);
}
/* 文字のデザイン */
.loading-text {
  color: #ff1493;
  font-weight: bold;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  animation: magic-blink 1.5s ease-in-out infinite; /* 文字もじんわり点滅 */
  position: relative;
}

.loading-text::after {
  content: "";
  position: absolute;
  animation: dot-animation 2.5s steps(1, end) infinite;
}

@keyframes dot-animation {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75% {
    content: "...";
  }
  100% {
    content: "";
  }
}

/* 🔄 回転のアニメーション定義 */
@keyframes magic-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ✨ 点滅のアニメーション定義 */
@keyframes magic-blink {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.disclaimer,
.result-notice {
  font-size: 0.78rem; /* 通常より一回り小さい文字 */
  color: #777777; /* 少し薄めのグレー */
  line-height: 1.5;
  text-align: center; /* 中央寄せにすると締まって見えます */
  margin-top: 15px;
  padding: 0 10px;
  text-shadow:
    1px 1px 4px rgba(255, 255, 255, 0.8),
    -1px 1px 4px rgba(255, 255, 255, 0.8),
    1px -1px 4px rgba(255, 255, 255, 0.8),
    -1px -1px 4px rgba(255, 255, 255, 0.8);
}
