/* --- ログイン・ユーティリティバー --- */
#auth-bar {
  background-color: #343a40; /* フッターと同じダークグレー、または濃い青(#004170)でもOK */
  color: #f8f9fa;
  padding: 8px 20px;
  font-size: 0.9em;
  border-bottom: 1px solid #444;
}
#auth-section {
  max-width: 1100px; /* メインコンテンツと幅を合わせる */
  margin: 0 auto;
  display: flex;
  justify-content: flex-end; /* 右寄せ */
  align-items: center;
  gap: 10px;
}

/* 入力フォーム */
.auth-input {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
  width: 120px;
}

/* ボタン共通 */
.auth-btn-login,
.auth-btn-register,
.auth-btn-logout {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  margin-left: 5px;
  transition: background-color 0.2s;
}

/* 各ボタンの色 */
.auth-btn-login {
  background-color: #007bff;
  color: white;
}
.auth-btn-login:hover {
  background-color: #0056b3;
}

.auth-btn-register {
  background-color: #28a745;
  color: white;
}
.auth-btn-register:hover {
  background-color: #218838;
}

.auth-btn-logout {
  background-color: #6c757d;
  color: white;
}
.auth-btn-logout:hover {
  background-color: #5a6268;
}

.auth-icon {
  margin-right: 5px;
}

/* スマホ対応: 画面が狭いときは折り返す */
@media (max-width: 600px) {
  #auth-section {
    justify-content: center;
    flex-wrap: wrap;
  }
  .auth-input {
    width: 100px;
    margin-bottom: 5px;
  }
}

/* --- 全体のスタイル --- */
body {
  font-family: "Helvetica Neue", "Arial", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Meiryo", sans-serif;
  margin: 0;
  background-color: #f4f7f9; /* 少し青みがかった背景色 */
  color: #333;
  line-height: 1.6;
}
/* --- ヘッダー --- */
.header {
  background-color: #ffffff;
  padding: 20px 40px;
  text-align: center;
  border-bottom: 3px solid #005a9c; /* 信頼性を感じさせるブルー */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.header h1 {
  margin: 0;
  color: #005a9c;
  font-size: 2.5em;
  font-weight: bold;
}
.header p {
  margin: 5px 0 0;
  color: #555;
  font-size: 1.1em;
}

/* --- ナビゲーション --- */
.navbar {
  background-color: #005a9c;
  padding: 10px 0;
  text-align: center;
  position: sticky; /* スクロールしても追従 */
  top: 0;
  z-index: 1000;
}
.navbar a {
  color: #ffffff;
  text-decoration: none;
  padding: 10px 20px;
  margin: 0 10px;
  border-radius: 5px;
  transition: background-color 0.3s;
}
.navbar a:hover {
  background-color: #004170;
}

/* --- メインコンテンツ --- */
.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}
.section {
  background-color: #ffffff;
  margin-bottom: 40px;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}
.section-title {
  font-size: 1.8em;
  color: #005a9c;
  margin-top: 0;
  margin-bottom: 25px;
  border-bottom: 2px solid #e0e0e0;
  padding-bottom: 10px;
}

/* --- AI医学助手コーナーのフォーム --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2列レイアウト */
  gap: 20px; /* 項目間のスペース */
}
.form-group {
  display: flex;
  flex-direction: column;
}
.form-group.full-width {
  grid-column: 1 / -1; /* 1列目から最後まで（横幅いっぱい） */
}
.form-group label {
  margin-bottom: 8px;
  font-weight: bold;
  color: #444;
}
.form-group input,
.form-group textarea {
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}
.form-group textarea {
  resize: vertical; /* 縦方向のみリサイズ可能 */
  min-height: 100px;
}
.diagnose-button {
  /*display: inline-block;*/
  /*background-color: #28a745;*/ /* 成功や実行をイメージさせるグリーン */
  background-color: hsl(134, 61%, 50%); /* 通常色 */
  color: white;
  /*padding: 12px 15px;*/
  border: none;
  border-radius: 5px;
  /*width: 20%;*/
  flex-grow: 1; /* ← 追加：親要素内で均等に伸びる */
  margin: 0; /* ← 追加：マージンをリセット */
  padding: 12px 15px;

  font-size: 1.1em;
  cursor: pointer;
  transition: background-color 0.3s;
  /*margin-top: 20px;*/
}
.diagnose-button:hover {
  /*background-color: #218838;*/
  background-color: hsl(134, 61%, 40%); /* 10%濃くした色 */
}
.diagnose-save-button {
  /*display: inline-block;*/
  /*background-color: #4169e1;*/ /* 保存のイメージカラー */
  background-color: hsl(225, 61%, 50%); /* 通常色 */
  color: white;
  /*padding: 12px 15px;*/ /* 12px 30px; */
  border: none;
  border-radius: 5px;
  /*width: 20%;*/
  flex-grow: 1;
  margin: 0;
  padding: 12px 15px;
  font-size: 1.1em;
  cursor: pointer;
  transition: background-color 0.3s;
  /*margin-top: 20px;*/
  /*margin-left: 60px;*/
}
.diagnose-save-button:hover {
  /*background-color: #0000cd;*/
  background-color: hsl(225, 61%, 40%); /* 10%濃くした色 */
}
.diagnose-clear-button {
  /*display: inline-block;*/
  /*background-color: #d3d3d3;*/ /* クリアのイメージカラー */
  background-color: hsl(0, 0%, 83%); /* 通常色 */
  color: white;
  /*padding: 12px 15px;*/
  border: none;
  border-radius: 5px;
  /*width: 20%;*/
  flex-grow: 1;
  margin: 0;
  padding: 12px 15px;
  font-size: 1.1em;
  cursor: pointer;
  transition: background-color 0.3s;
  /*margin-top: 20px;*/
  /*margin-left: 60px;*/
}
.diagnose-clear-button:hover {
  /*background-color: #a9a9a9;*/
  background-color: hsl(0, 0%, 73%); /* 10%濃くした色 */
}

/* --- 診断履歴ボタン --- */
.diagnose-history-button {
  background-color: #17a2b8; /* ティール（青緑） */
  color: white;
  border: none;
  border-radius: 5px;
  flex-grow: 1;
  margin: 0;
  padding: 12px 15px;
  font-size: 1.1em;
  cursor: pointer;
  transition: background-color 0.3s;
}
.diagnose-history-button:hover {
  background-color: #138496;
}

/* --- 診断履歴リストエリア --- */
#history-list-area {
  margin-top: 20px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  display: none; /* 初期状態は非表示 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#history-list-area h4 {
  margin-top: 0;
  color: #005a9c;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

/* スクロール可能なリストコンテナ */
.history-table-container {
  max-height: 300px; /* 高さ制限 */
  overflow-y: auto; /* 縦スクロール */
}

/* 履歴テーブルデザイン */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}
.history-table th,
.history-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
.history-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #555;
  position: sticky;
  top: 0;
}
.history-table tr:hover {
  background-color: #f0f8ff; /* ホバー時の色 */
  cursor: pointer;
}
/* 列幅の調整 */
.col-date {
  width: 15%;
  color: #888;
  font-size: 0.85em;
}
.col-title {
  width: 30%;
  font-weight: bold;
  color: #005a9c;
}
.col-age {
  width: 15%;
}
.col-complaint {
  width: 40%;
}

/* ▼▼▼ このCSSブロックを新しく追加 ▼▼▼ */
.button-container {
  display: flex;
  justify-content: space-between; /* ボタン間のスペースを均等に配置 */
  gap: 20px; /* ボタン間の隙間 */
  margin-top: 20px;
}
/* --- その他のコーナー（カードレイアウト） --- */
.card-container {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(280px, 1fr)
  ); /* レスポンシブなカード配置 */
  gap: 25px;
}
.card {
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  overflow: hidden; /* ▼▼▼ この行を追加 ▼▼▼ */
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
.card h3 {
  margin-top: 0;
  color: #004170;
}
.card p {
  font-size: 0.95em;
  color: #666;
}
.card a {
  text-decoration: none;
  color: #007bff;
  font-weight: bold;
}

/* --- フッター --- */
.footer {
  text-align: center;
  padding: 20px;
  background-color: #343a40;
  color: #f8f9fa;
  margin-top: 50px;
}

/* --- レスポンシブ対応 --- */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2em;
  }
  .form-grid {
    grid-template-columns: 1fr; /* スマホでは1列に */
  }
  .navbar a {
    display: block;
    margin: 5px 0;
  }
}
/* --- ▼▼▼ ここからAI診断結果エリアの新しいCSS 25.10.6 ▼▼▼ --- */
#result-area {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 25px;
  background-color: #fdfdfd;
  display: none; /* 最初は非表示 */
}
.result-summary {
  margin-bottom: 30px;
  border-bottom: 2px solid #eee;
  padding-bottom: 20px;
}
.summary-item {
  margin-bottom: 15px;
}
.summary-item strong {
  display: inline-block;
  width: 120px; /* ラベルの幅を揃える */
  color: #005a9c;
}
.summary-item pre {
  /* 鑑別診断の改行を維持 */
  display: inline;
  font-family: inherit;
  margin: 0;
  white-space: pre-wrap;
}
.tabs {
  display: flex;
  border-bottom: 1px solid #ccc;
  margin-bottom: 20px;
}
.tab-button {
  padding: 10px 20px;
  cursor: pointer;
  border: none;
  background-color: transparent;
  font-size: 1em;
  color: #555;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}
.tab-button.active {
  color: #005a9c;
  font-weight: bold;
  border-bottom: 3px solid #005a9c;
}
.tab-content {
  display: none; /* デフォルトで非表示 */
}
.tab-content.active {
  display: block; /* 選択されたタブのみ表示 */
}
.tab-content pre {
  /* 結果の整形済みテキスト */
  background-color: #f4f7f9;
  padding: 15px;
  border-radius: 5px;
  white-space: pre-wrap; /* 自動で折り返し */
  word-wrap: break-word;
  font-size: 0.95em;
  line-height: 1.7;
}
.loader {
  /* 診断中のスピナー */
  border: 5px solid #f3f3f3;
  border-top: 5px solid #005a9c;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* --- ▲▲▲ ここまでAI診断結果エリアの新しいCSS ▲▲▲ --- */


/* 25.12.22 --- 最新医療ニュースのスクロール表示エリア --- */
#news-results {
  /* ▼▼▼ 重要な設定 ▼▼▼ */
  max-height: 350px;      /* 250px 高さを制限 (この高さを超えるとスクロールが出る) */
  overflow-y: auto;       /* 縦スクロールを有効にする */
  
  /* ▼▼▼ 見た目の調整 ▼▼▼ */
  margin-top: 15px;       /* 上のボタンとの間隔 */
  padding-top: 10px;
  border-top: 1px dashed #ccc; /* 境界線を入れると見やすい */
  text-align: left;       /* ニュースのタイトルは左揃えが見やすい */
  
  /* スクロールバーの見た目を少しスマートに (Chrome/Safari/Edge用) */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

/* スクロールバーのカスタマイズ (Webkitブラウザ用) */
#news-results::-webkit-scrollbar {
  width: 6px;
}
#news-results::-webkit-scrollbar-track {
  background: transparent;
}
#news-results::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}
/* 25.12.22 --- 最新医療ニュースのスクロール表示エリア ここまで --- */

/* 10.17 ▼▼▼ 健康コラム用のCSSを刷新 ▼▼▼ */
.health-column-card {
  text-align: left;
}
.column-section {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}
.column-section h4 {
  margin-top: 0;
  color: #005a9c;
}
.column-section label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.column-section select,
.column-section input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box; /* paddingを含めてwidth 100%にする */
}
.ai-column-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.ai-column-actions button {
  flex-grow: 1;
  padding: 10px;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.2s;
}
#generate-column-btn {
  background-color: #007bff;
}
#generate-column-btn:hover {
  background-color: #0056b3;
}
#save-column-btn {
  background-color: #28a745;
}
#save-column-btn:hover {
  background-color: #218838;
}
#clear-column-btn {
  background-color: #6c757d;
}
#clear-column-btn:hover {
  background-color: #5a6268;
}

/* 健康コラム表示エリア (textarea用) */
#health-column-display {
  margin-top: 10px; /*20px*/
  padding: 15px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;

  /* エッセイエリアと同じ設定にする */
  width: 100%;
  height: 250px;
  box-sizing: border-box;

  overflow-y: auto;
  overflow-x: hidden;
  resize: none; /* サイズ変更つまみを消す */

  font-size: 0.9em;
  line-height: 1.6;
  font-family: inherit;
  color: #333;
}

#health-column-display pre {
  white-space: pre-wrap; /* 改行コードは維持しつつ、端で自動改行する */
  word-wrap: break-word; /* 長い英単語などが枠をはみ出す場合に強制改行する */
  font-size: 0.9em; /*0.95*/
  line-height: 1.6;
  font-family: inherit; /* フォントを親要素（ゴシック系）に合わせる */
  margin: 0; /* preタグ特有の余白を消す */
}
#health-column-display h2 {
  margin-top: 0;
}
#health-column-display strong {
  font-style: italic;
  color: #333;
}

/* 25.11.5 ▼▼▼ エッセイコーナー用のCSSを新しく追加 ▼▼▼ */
.essay-card {
  text-align: left;
}

/* 新しい縦積みコンテナ */
.essay-container {
  display: flex;
  flex-direction: column;
  gap: 10px; /* 各セクション間の隙間 15px */
  margin-top: 15px; /*20px;*/
}

.essay-section {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 10px 15px; /* 上下paddingを少し減らす */
  border-radius: 8px;
}
/* 見出しのマージンも少し詰める */
.essay-section h4 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #005a9c;
  display: flex; /* 丸数字とテキストを横並びにする */
  align-items: center;
  font-size: 1.1em;
}

/* --- 横スクロールボタンエリア（エッセイ・健康コラム共通） --- */
/* クラス名を併記して両方に適用します */
.essay-scroll-container,
.column-scroll-container {
  display: flex; /* 横並びにする */
  overflow-x: auto; /* 横にはみ出たらスクロールバーを出す */
  gap: 10px; /* ボタン間の隙間 */
  margin-top: 15px;
  padding-bottom: 5px; /* 10px スクロールバーとボタンの間隔 */

  /* スクロールバーを隠す設定（Shift+ホイール操作用） */
  scrollbar-width: none; /* Firefox用 */
  -ms-overflow-style: none; /* IE/Edge用 */
}
/* Chrome/Safari用 スクロールバー非表示 */
.essay-scroll-container::-webkit-scrollbar,
.column-scroll-container::-webkit-scrollbar {
  display: none;
}

/* 各ボタンの共通設定 */
.essay-scroll-container button,
.column-scroll-container button {
  /* 
         flex: 0 0 30%; 
         → 「伸び縮みさせず(0 0)」「幅は親の30%」にする設定です。
         3つで 30% x 3 = 90% + 隙間 なので、4つ目が隠れる計算になります。
      */
  flex: 0 0 30%; /* 3つ表示、残りは隠れる */

  /* ★重要: 幅が狭くなりすぎないように最低幅を確保する */
  min-width: 70px; /* 90px */
  height: 30px; /* 35px, 45px 高さを統一 */
  border: none;
  border-radius: 4px; /* 4px */
  color: white;
  font-size: 0.9em; /* 文字が入り切るように少し調整 */
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap; /* 文字の折り返し禁止 */
}

/* クリック時の動き */
.essay-scroll-container button:active,
.column-scroll-container button:active {
  transform: scale(0.98);
}

/* --- 各ボタンの色設定 --- */
#generate-essay-btn {
  background-color: #007bff;
} /* 青 */
#generate-essay-btn:hover {
  background-color: #0056b3;
}

#save-essay-btn {
  background-color: #28a745;
} /* 緑 */
#save-essay-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}
#save-essay-btn:hover {
  background-color: #218838;
}

#clear-essay-btn {
  background-color: #6c757d;
} /* グレー */
#clear-essay-btn:hover {
  background-color: #5a6268;
}

#edit-essay-btn {
  background-color: #ffc107;
  color: #000 !important;
} /* 黄 */
#edit-essay-btn:hover {
  background-color: #e0a800;
}

#delete-essay-btn {
  background-color: #dc3545;
} /* 赤 */
#delete-essay-btn:hover {
  background-color: #c82333;
}

/* --- ボタンの色設定（コラム用IDを追加） --- */
#generate-column-btn {
  background-color: #007bff;
}
#generate-column-btn:hover {
  background-color: #0056b3;
}

#save-column-btn {
  background-color: #28a745;
}
#save-column-btn:hover {
  background-color: #218838;
}
#save-column-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#clear-column-btn {
  background-color: #6c757d;
}
#clear-column-btn:hover {
  background-color: #5a6268;
}

/* 新規追加ボタンの色 */
#edit-column-btn {
  background-color: #ffc107;
  color: #000 !important;
}
#edit-column-btn:hover {
  background-color: #e0a800;
}

#delete-column-btn {
  background-color: #dc3545;
}
#delete-column-btn:hover {
  background-color: #c82333;
}

.essay-section label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.essay-section select,
.essay-section input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}

/* ▼▼▼ 追加: エッセイ選択リストボックスの幅と表示制限 ▼▼▼ */
#essay-select {
  /* 親要素からはみ出さないように強制 */
  width: 90%; /*100%;*/
  max-width: 90%; /*100%; リストボックス自体の幅がカード（親要素）の幅を超えない */
  box-sizing: border-box; /* paddingやborderを含めて幅を計算 */
  display: block; /* インライン要素だと幅指定が効きにくいので block に */
  margin: 0 auto; /* 中央寄せしたい場合 */

  /* 長いファイル名の対策（閉じた状態） */
  white-space: nowrap; /* 改行しない */
  overflow: hidden; /* はみ出た部分を隠す */
  text-overflow: ellipsis; /* 末尾を「...」にする */

  /* 既存のデザインを踏襲 */
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

/* 開いたときの選択肢の幅対策（ブラウザにより挙動は異なります） */
#essay-select option {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ステップ番号の丸数字スタイル */
.step-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: #005a9c;
  color: white;
  font-size: 0.9em;
  font-weight: bold;
  margin-right: 10px;
}

/* ① 横長の画像ドロップゾーン */
#image-drop-zone {
  border: 2px dashed #007bff;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  background-color: #f0f8ff;
  transition: background-color 0.2s;
}
#image-drop-zone.dragover {
  background-color: #e0f0ff;
}
#image-preview {
  max-width: 100%;
  max-height: 120px; /* プレビューの高さを少し抑える */
  margin-top: 10px;
  border-radius: 4px;
}

/* ② 表示切り替えタブのデザイン */
.view-toggle-container {
  display: flex;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 15px;
}
.view-toggle-btn {
  padding: 8px 15px;
  border: none;
  background: none;
  cursor: pointer;
  font-weight: bold;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}
.view-toggle-btn.active {
  color: #005a9c;
  border-bottom: 3px solid #005a9c;
}
.view-toggle-btn:hover {
  background-color: #f0f8ff;
}

/* ▼▼▼ サムネイルギャラリーのデザイン ▼▼▼ */
#thumbnail-gallery {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(100px, 1fr)
  ); /* 自動で折り返し */
  gap: 10px;
  max-height: 300px; /* 高すぎると邪魔なのでスクロール */
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #eee;
  background-color: #fff;
  border-radius: 4px;
}

.thumb-item {
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  background: #fff;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1; /* 正方形にする */
}
.thumb-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

.thumb-img {
  width: 100%;
  height: 70%;
  object-fit: cover; /* 枠に合わせてトリミング */
  background-color: #f0f0f0;
}
/* 画像がない場合のプレデフォアイコン */
.thumb-no-img {
  width: 100%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e9ecef;
  color: #adb5bd;
  font-size: 2em;
}

.thumb-title {
  height: 30%;
  padding: 4px;
  font-size: 0.75em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  background-color: #fdfdfd;
  border-top: 1px solid #eee;
  color: #333;
}

/* ③ AIエッセイのボタン */
.ai-essay-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.ai-essay-actions button {
  flex-grow: 1;
}
/* --- 各ボタンの色設定 --- */
/* 1段目 */
#generate-essay-btn {
  background-color: #007bff;
}
#generate-essay-btn:hover {
  background-color: #0056b3;
}

#edit-essay-btn {
  background-color: #ffc107;
}
#edit-essay-btn:hover {
  background-color: #e0a800;
}

#save-essay-btn {
  background-color: #28a745;
}
#save-essay-btn:hover {
  background-color: #218838;
}
#save-essay-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* 2段目 */
#clear-essay-btn {
  background-color: #6c757d;
}
#clear-essay-btn:hover {
  background-color: #5a6268;
}

#delete-essay-btn {
  background-color: #dc3545;
} /* 赤 (削除) */
#delete-essay-btn:hover {
  background-color: #c82333;
}

/* --- 共通ボタンクラス --- */

/* 生成・分析ボタン (青) */
.generate-btn {
  background-color: #007bff;
}
.generate-btn:hover {
  background-color: #0056b3;
}

/* 保存ボタン (緑) */
.save-btn {
  background-color: #28a745;
}
.save-btn:hover {
  background-color: #218838;
}
/* 保存ボタンが無効(disabled)の時のスタイル */
.save-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* クリアボタン (グレー) */
.clear-btn {
  background-color: #6c757d;
}
.clear-btn:hover {
  background-color: #5a6268;
}

/* 編集ボタン (黄色) */
.edit-btn {
  background-color: #ffc107;
  color: #000 !important;
}
.edit-btn:hover {
  background-color: #e0a800;
}

/* 削除ボタン (赤) */
.delete-btn {
  background-color: #dc3545;
}
.delete-btn:hover {
  background-color: #c82333;
}

/* エッセイ表示用のテキストエリア */
#essay-display-area {
  /* --- 箱のスタイル (#health-column-display と共通) --- */
  margin-top: 20px;
  padding: 15px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;

  /* --- サイズとスクロール設定 --- */
  width: 100%; /* 横幅いっぱい */
  height: 250px; /* 高さを固定 */
  box-sizing: border-box; /* paddingを含めたサイズ計算 */

  overflow-y: auto; /* 縦スクロールを表示 */
  overflow-x: hidden; /* 横スクロールを隠す */
  resize: none; /* 右下のサイズ変更ハンドルを消す（divと同じ見た目にするため） */

  /* --- 文字のスタイル (#health-column-display pre と共通) --- */
  white-space: pre-wrap; /* 改行を維持しつつ、右端で自動的に折り返す */
  word-wrap: break-word; /* 長い単語などが枠をはみ出す場合に強制改行する */

  font-size: 0.9em;
  line-height: 1.6;
  font-family: inherit; /* フォントを親要素に合わせる */
  color: #333; /* 文字色 */
}

/* ▼▼▼ 診察予約コーナー用のCSSを新しく追加 ▼▼▼ */
.reservation-card {
  text-align: left;
}
.calendar-container {
  margin-top: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  background-color: #fff;
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.calendar-header button {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 5px 10px;
}
#calendar-month-year {
  font-weight: bold;
  font-size: 1.2em;
  color: #005a9c;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}
.calendar-day,
.calendar-date {
  padding: 8px 0;
  border-radius: 4px;
}
.calendar-day {
  font-weight: bold;
  background-color: #f8f9fa;
}
.calendar-date {
  cursor: pointer;
  transition: background-color 0.2s;
}
.calendar-date:hover {
  background-color: #e0f0ff;
}
.calendar-date.today {
  background-color: #007bff;
  color: white;
}
.calendar-date.selected {
  background-color: #005a9c;
  color: white;
}
.calendar-date.disabled {
  color: #ccc;
  cursor: not-allowed;
}

.timetable-container {
  margin-top: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
}
.timetable-container h4 {
  margin-top: 0;
  margin-bottom: 0px; /* 10px ここを小さくしてください (0pxでもOK) */
  /*font-size: 1.0em;*/   /* 必要であれば文字サイズも少し調整するとバランスが良くなります */ 
}
.timetable-slots {
  max-height: 250px; /* 高さを固定 */
  overflow-y: auto; /* 高さを超えたら縦スクロールバー（スライダー）を表示 */
  border: 1px solid #f0f0f0;
  padding: 5px 10px; /* 上下5px、左右10px (元は padding: 10px; でした) */
}
/* 中の <p>タグが持っている余白も消す */
#timetable-slots p {
  margin-top: 0;
}
.time-slot {
  display: flex;
  justify-content: space-between;
  padding: 10px 5px;
  border-bottom: 1px solid #f0f0f0;
}
.time-slot:last-child {
  border-bottom: none;
}
.slot-status {
  font-weight: bold;
  color: #28a745; /* 予約可の色 */
}
.slot-status.reserved {
  color: #dc3545; /* 予約済の色 */
}
/* ▲▲▲ 予約コーナー用CSSここまで ▲▲▲ */

/* ▼▼▼ ボタンとして見せるためのスタイルを追加 ▼▼▼ */
.slot-status button {
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.slot-status button:hover {
  background-color: #218838;
}
.slot-status button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}
.slot-status.reserved {
  color: #dc3545;
}

/* --- 予約タイムテーブル (3枠対応) --- */
.timetable-slots {
  max-height: 400px; /* 少し高さを広げる */
  overflow-y: auto;
  border: 1px solid #f0f0f0;
  padding: 10px;
}
.time-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 8px 0;
}
.time-label {
  width: 60px;
  font-weight: bold;
  color: #555;
  text-align: center;
}
.slots-container {
  flex-grow: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3列 */
  gap: 5px;
}
.slot-btn {
  padding: 6px 2px;
  font-size: 0.85em;
  background-color: #e8f5e9; /* 薄い緑 */
  color: #2e7d32;
  border: 1px solid #c8e6c9;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.slot-btn:hover {
  background-color: #c8e6c9;
}
.slot-btn.reserved {
  background-color: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* --- 予約入力モーダル (修正版) --- */
#booking-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw; /* 100% -> 100vw にして画面幅いっぱいにする */
  height: 100vh; /* 100% -> 100vh にして画面高さいっぱいにする */
  background: rgba(0, 0, 0, 0.5);
  display: none; /* JSで display: flex に切り替える */
  justify-content: center;
  align-items: center;
  z-index: 9999; /* 最前面に */
}

.modal-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.modal-content h3 {
  margin-top: 0;
  color: #005a9c;
}
.modal-content label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
}
.modal-content input {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-actions button {
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#btn-modal-cancel {
  background: #6c757d;
  color: white;
}
#btn-modal-confirm {
  background: #007bff;
  color: white;
}


/* AI絵本 スタイル選択肢の見た目調整 */
.style-option {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9em;
  padding: 2px;
  transition: background-color 0.2s;
}
.style-option:hover {
  background-color: #f0f8ff;
  border-radius: 4px;
}
.style-option input {
  margin-right: 6px;
  cursor: pointer;
}


/* --- Suno AI リンクボタン --- */
.suno-link-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background-color: #242424; /* Sunoっぽいダークカラー */
  color: white !important; /* 文字色を強制的に白に */
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  border-radius: 6px;
  box-sizing: border-box;
  transition: background-color 0.3s;
}
.suno-link-btn:hover {
  background-color: #000; /* ホバー時は真っ黒に */
}

/* --- 歌詞表示のデザイン --- */
/*「現在の行」を大きく濃く、「次の行」を小さく薄く表示して、カラオケ風にセンス良く見せます。*/
#lyrics-container {
  transition: all 0.3s ease;
}

.lyric-line {
  margin: 0;
  padding: 0;
  transition: all 0.3s ease; /* ふわっと切り替わるアニメーション */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 今歌っている行 */
.lyric-line.current {
  color: #005a9c;     /* マサ先生のテーマカラー */
  font-weight: bold;
  font-size: 0.9em;     /*1.1em*/
  height: 25px;         /*30px 行の高さ*/
  line-height: 25px;    /*30px*/
}

/* 次の行（控えめに） */
.lyric-line.next {
  color: #888;
  font-size: 0.8em;   /*0.9em*/
  height: 20px;         /*25px 行の高さ*/
  line-height: 20px;    /*25px*/
}


/* ▼▼▼ モーダル表示中の背景制御（チカチカ防止） ▼▼▼ */
body.modal-open .container,
body.modal-open .navbar {
  /* 背景にある要素のマウス反応を完全に消す */
  pointer-events: none;
  /* オプション: 背景を少しぼかして「操作できない」ことを伝える */
  filter: blur(2px);
}

/* モーダル自体は操作できるようにする（必須） */
body.modal-open #booking-modal {
  pointer-events: auto;
  filter: none;
}

/* ドロップゾーンの共通スタイル */
.image-drop-zone-style {
  border: 2px dashed #007bff;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  background-color: #f0f8ff;
  transition: background-color 0.2s;
}
.image-drop-zone-style.dragover {
  background-color: #e0f0ff;
}

/* テキストエリアの共通スタイル */
#pb-json-input,
#pb-prompt-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: monospace; /* コードっぽく */
  resize: vertical;
}

/* --- タロット結果モーダル (全画面表示) --- */
#tarot-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  overflow: auto;
}

.tarot-modal-content {
  background-color: #1a1a2e;
  margin: 2% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 95%;
  max-width: 1000px;
  border-radius: 8px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  color: white;
  position: relative;
}

/* 閉じるボタン */
.tarot-close-btn {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.tarot-close-btn:hover {
  color: white;
}

/* 1. カード表示部と結果表示部の間隔 (⑥) */
#tarot-result-box {
  background: #fff;
  color: #333;
  border: 2px solid #d4af37;
  border-radius: 8px;
  padding: 20px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  margin-top: 20px; /* ★ここを追加 (20px空ける) */
}

/* タロットテーブル (漆黒の布) */
.tarot-table {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  /* ▼ 修正箇所 ▼ */
  gap: 20px; /* 50px -> 20px (十字と棒の間隔を詰める) */
  padding: 40px 15px; /* 左右の余白を 30px -> 15px に減らす */
  min-width: 480px; /* 最小幅を少し小さく */
  /* ▲ 修正ここまで ▲ */
  background-color: #1a1a2e;
  border-radius: 10px;
  color: white;
  border: 4px double #d4af37;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
  overflow-x: auto;
}
/* エリア定義 */
.cross-section {
  position: relative;
  width: 320px;
  height: 460px;
}
.staff-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-bottom: 20px;
}

/* カードスロット共通 (アニメーション設定を追加) */
.tarot-card-slot {
  width: 70px;
  height: 120px;
  background-color: transparent;
  border: 1px solid #b8860b;
  border-radius: 4px;
  position: relative;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);

  /* ★追加: 回転アニメーション用設定 */
  transition: transform 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* 少しバウンドするような動き */
  /* または単純に transition: transform 1.0s ease-in-out; でもOK */
}
.cross-section .tarot-card-slot {
  position: absolute;
}

.staff-section .tarot-card-slot {
  position: relative;
}

/* 画像スタイル */
.tarot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

/* --- 配置座標 --- */
.pos-1 {
  top: 175px;
  left: 125px;
  z-index: 5;
}
.pos-2 {
  top: 210px;
  left: 170px;
  z-index: 10;
} /* 障害 */
.pos-3 {
  top: 35px;
  left: 125px;
}
.pos-4 {
  top: 315px;
  left: 125px;
}
.pos-5 {
  top: 175px;
  left: 5px;
}
.pos-6 {
  top: 175px;
  left: 245px;
}

/* カード名などのオーバーレイ (②背景透明化、③フォント縮小) */
.card-overlay {
  position: absolute;
  left: 0;
  width: 100%;
  text-align: center;
  /* background-color: rgba(0,0,0,0.6);  ←削除: 背景色なし */
  color: #fff;
  padding: 2px 0;
  pointer-events: none;
  z-index: 2;

  /* ★追加: 背景がないので文字に影をつけて読みやすくする */
  /*text-shadow: 
          1px 1px 0 #000,
          -1px -1px 0 #000,
          -1px 1px 0 #000,
          1px -1px 0 #000;*/
}
/* ① 配置番号 (上部) 
     - 背景：透明
     - 文字：影付きで見やすく */
.overlay-num {
  top: -6px; /* 少し上に配置 */
  font-weight: bold;
  color: #ffd700; /* ゴールド */
  font-size: 0.8em;
  /* 背景がないため、強い影をつけて視認性を確保 */
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, -1px 1px 0 #000,
    1px -1px 0 #000;
}
/* ② カード名 (下部) 
     - 背景：不透明 (半透明の黒)
     - 配置：下縁ぎりぎり
     - 文字：さらに小さく */
.overlay-name {
  bottom: 0; /* 下縁にピッタリ合わせる */

  /* 背景色を復活 (文字が読みやすい濃さ) */
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;

  /* カードの角丸にはみ出さないように調整 */
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;

  /* 長い名前対策 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* フォントサイズと行間の調整 */
  font-size: 0.45em; /* ★前回の 0.55em からさらに縮小 */
  line-height: 1.4; /* 文字の上下に少し余白を持たせる */
  padding: 0 1px;

  /* 背景があるので影は不要（スッキリさせる） */
  text-shadow: none;
}

#tarot-reading-text {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 0.95em;
  /* スクロール設定 */
  height: 300px; /* 高さを固定 */
  overflow-y: auto;
  padding-right: 10px;
  border-top: 1px dashed #ddd;
  margin-top: 10px;
  padding-top: 10px;
}

/* --- スタート画面用の追加スタイル --- */

/* 裏面の画像 */
.tarot-back-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.9; /* 少し暗くして雰囲気を出す（お好みで調整） */
}

/* 初期のラベル (1.現状 などの文字) */
.initial-label {
  position: absolute;
  top: 5px; /* 上部に配置 */
  left: 0;
  width: 100%; /* 横幅いっぱいで中央揃えにする */
  text-align: center;
  font-size: 0.6em; /*0.7em;*/ /* 文字サイズを小さく */
  color: #ffd700; /* ゴールド */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* 背景が柄でも読めるように影をつける */
  z-index: 2;
  pointer-events: none;
}

/* --- 管理者用ボタンのスタイル --- */
.admin-link-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 20px; /* 丸みを持たせて優しい印象に */
  color: #888;
  font-size: 0.75em;
  padding: 2px 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.admin-link-btn:hover {
  background-color: #005a9c;
  color: white;
  border-color: #005a9c;
}
