/* ===== CSS変数の定義 ===== */
:root {
    /* New Palette based on Taiwan Flag Colors - All Red Tone */
    --header-bg-color: #FE0000; /* Taiwan Flag Red */
    --header-text-color: #FFFFFF; /* White for contrast */
    --side-menu-bg-color: var(--header-bg-color); /* Matches header */
    --side-menu-text-color: var(--header-text-color); /* Matches header text */
    --chat-bg-color: #FFE4E1; /* MistyRose - Light Reddish for chat background */
    --self-bubble-bg-color: #FFB6C1; /* LightPink - Darker reddish for self bubble */
    --other-bubble-bg-color: #FFFFFF; /* White */
    --main-text-color: #333333; /* Dark Gray for neutrality (on light reddish bg) */
    --link-color: #FF1493; /* DeepPink for links */
    --link-hover-color: #FF69B4; /* HotPink for link hover */
    --button-bg-color: #FE0000; /* Taiwan Flag Red for buttons */
    --button-text-color: #FFFFFF; /* White for button text */
    --border-color: #FE0000; /* Taiwan Flag Red for borders */
    --date-header-bg-color: rgba(200, 0, 0, 0.7); /* Transparent Red */

    --font-family-montserrat: "Montserrat", sans-serif;
    --font-family-noto-sans-jp: "Noto Sans JP", sans-serif;
}
  
  /* ===== ページ全体のベース設定 ===== */
  body {
    margin: 0;
    padding: 0;
    background-color: var(--chat-bg-color); /* ★ Use updated variable */
    font-family: var(--font-family-noto-sans-jp);
  }
  
  /* ===== ヘッダー ===== */
  #main-header {
    background-color: var(--header-bg-color);
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0; /* Remove padding */
    position: relative; /* Set as positioning context */
  }
  
  #main-header .logo {
    display: flex;
    align-items: center;
    padding-left: 10px; /* Add left padding to align with chat icon */
  }
  
  #main-header .header-image {
    width: 35px;
    height: 35px;
  }
  
  #main-header .title {
    font-family: 'Montserrat', sans-serif;
    color: var(--header-text-color);
    margin-left: 10px;
    font-size: 1.3rem;
  }
  
  #main-header .header-controls {
    display: flex;
    align-items: center;
    padding-right: 10px; /* Set right padding to 10px */
  }
  
  #main-header select {
    background-color: transparent; /* Match header */
    color: var(--header-text-color);
    border: none;
    outline: none;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 0.9rem;
    padding: 2px 5px; /* 見た目の調整 */
    border-radius: 4px; /* 角丸 */
    cursor: pointer;
  }
  
  /* 既存アイコン (i タグ) と天気ボタン (button タグ) の共通スタイル */
  #main-header .header-controls .new-chat,
  #main-header .header-controls .hamburger,
  #main-header .header-controls #weather-btn {
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--header-text-color);
    vertical-align: middle; /* 縦位置合わせ */
  }
  
  /* 天気ボタン固有のスタイル調整 */
  #main-header .header-controls #weather-btn {
    background: none; /* 背景なし */
    border: none; /* 境界線なし */
    padding: 0; /* パディングなし */
    margin: 0; /* マージンなし */
    line-height: 1; /* アイコンの縦位置調整 */
  }
  
  #main-header .header-controls #weather-btn:hover,
  #main-header .header-controls .new-chat:hover,
  #main-header .header-controls .hamburger:hover {
    opacity: 0.8; /* ホバー効果 */
  }
  
  .dropdown-toggle {
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--header-text-color);
  }
  
  /* ===== サイドメニュー（メニュー） ===== */
  #side-menu {
    position: fixed;
    top: 0;
    right: -66.66%;  /* 画面幅の2/3 */
    width: 66.66%;
    height: 100%;
    background-color: var(--side-menu-bg-color);
    color: var(--side-menu-text-color); /* Ensure base color is brown */
    /* box-shadow: -2px 0 5px rgba(0,0,0,0.3); */ /* この行を削除またはコメントアウト */
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
  }
  
  #side-menu.open {
    right: 0;
  }
  
  #side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--header-bg-color); /* ★ Ensure background matches header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.3); /* Darker border */
  }
  
  #side-menu-header span {
    font-family: var(--font-family-montserrat);
    font-size: 1.1rem;
    color: var(--side-menu-text-color); /* Explicitly set brown */
  }
  
  #side-menu-header button {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--side-menu-text-color); /* Explicitly set brown */
    cursor: pointer;
  }
  
  /* セッション一覧 */
  #conversation-history {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
  }
  
  /* メニューのメイン領域: position: relative; で下部メニューをabsolute配置 */
  #menu-content {
    position: relative;
    flex: 1;
    overflow: hidden; /* 全体のオーバーフローを隠す */
  }
  
  /* 会話リスト部分をスクロール領域に */
  #conversation-history {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 50px; /* 下部メニューの高さ分空ける */
    padding: 10px;
    overflow-y: auto;
  }
  
  /* 下部メニュー */
  #menu-footer {
    position: absolute; /* menu-contentの中でabsolute配置 */
    bottom: 0;
    left: 0;
    right: 0;
    height: 25px; /* 適度な高さ */
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3); /* Darker border */
    background-color: var(--header-bg-color); /* ★ Ensure background matches header */
    z-index: 1001; /* リストより上に表示 */
    display: flex; /* 追加 */
    justify-content: space-between; /* 追加 */
    align-items: center; /* 追加 */
  }
  
  /* 追加: ユーザーメール表示スタイル */
  .user-email {
    font-size: 0.75rem;
    color: var(--side-menu-text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px; /* 必要に応じて調整 */
    margin-right: 10px; /* 3点メニューとの間隔 */
  }
  
  /* 3点リーダーメニュー */
  #menu-footer .dropdown {
    position: relative;
    font-size: 0.9rem; /* 一回り小さく */
    display: inline-block; /* 右寄せに合わせる */
  }
  
  #menu-footer .dropdown i {
    cursor: pointer;
  }
  
  #dropdown-content {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    text-align: left;
    background-color: var(--header-bg-color); /* ★ Ensure background matches header */
    min-width: 180px;
    box-shadow: 0px -2px 5px rgba(0,0,0,0.3);
    z-index: 1002;
    border-radius: 4px; /* Add rounding */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Add subtle border */
  }
  
  #dropdown-content a {
    color: var(--side-menu-text-color); /* Ensure dropdown link color is brown */
    padding: 8px 10px;
    text-decoration: none;
    display: block;
    font-family: var(--font-family-montserrat);
  }
  
  #dropdown-content a:hover {
    background-color: rgba(255, 255, 255, 0.1); /* ★ Darker hover */
  }
  
  #menu-footer .dropdown.open #dropdown-content {
    display: block;
  }
  
  /* ===== チャットUI ===== */
  .chat-container {
    max-width: 375px;
    width: 100%;
    height: calc(var(--app-height, 100vh) - 50px); /* JSで動的に設定した高さからヘッダー分を引く */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg-color); /* ★ Use updated variable */
  }
  
  /* ===== メッセージ一覧 ===== */
  .chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    background-color: var(--chat-bg-color); /* ★ Use updated variable */
  }
  
  .chat-footer {
    display: flex;
    align-items: flex-end; /* Vertically align items to the bottom */
    padding: 8px 10px 8px 10px; /* T:8, R:10, B:8, L:10 (Right padding updated) */
    background-color: var(--header-bg-color);
    border-top: 1px solid var(--border-color);
    gap: 0; /* アイコン間のスペースを0に戻す */
  }
  
  .chat-footer textarea {
    flex-grow: 1;
    border-radius: 8px; /* Reduced from 18px */
    border: 1px solid var(--border-color);
    padding: 7px 12px; /* Adjust padding for vertical centering */
    font-size: 0.9rem;
    line-height: 1.4;
    height: 36px; /* Match button height */
    box-sizing: border-box; /* Include padding and border in height */
    resize: none;
    overflow-y: hidden; /* Hide scrollbar initially */
    max-height: 100px; /* Limit max height */
    background-color: #fff;
    color: var(--main-text-color);
    margin: 0; /* Remove margin */
  }
  
  .chat-footer .icon-btn {
    background: none;
    border: none;
    color: var(--button-text-color); /* アイコンが背景に溶け込まないように修正 */
    cursor: pointer;
    padding: 5px;
    font-size: 1.2rem; /* Reduced from 1.3rem */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  
  .chat-footer .icon-btn:hover {
    opacity: 0.7;
  }
  
  .chat-footer .icon-btn i {
    vertical-align: middle;
  }
  
  /* テキストエリアの直後にあるアイコンボタンに左マージンを追加 */
  .chat-footer textarea + .icon-btn {
    margin-left: 10px;
  }
  
  /* テキストエリアと最初のアイコンの間にスペースを追加 */
  #image-upload-btn {
    margin-left: 12px;
  }
  
  /* ===== メッセージ行 ===== */
  .message-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 20px;
    position: relative;
  }
  .message-row.other .icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 6px;
    align-self: flex-start;
  }
  .message-row.other {
    justify-content: flex-start;
  }
  .message-row.self {
    justify-content: flex-end;
    margin-left: auto;
  }
  
  /* ===== 吹き出し本体 ===== */
  .bubble {
    max-width: 60%;
    padding: 12px;
    position: relative;
    border-radius: 10px;
    background-color: var(--other-bubble-bg-color); /* Default for other */
    color: var(--main-text-color);
    border: 1px solid #e8e8e8; /* ★ Add subtle border */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); /* ★ Add subtle shadow */
  }
  .message-row.self .bubble {
    background-color: var(--self-bubble-bg-color);
    color: var(--main-text-color); /* Ensure contrast */
  }
  .message-row.other .bubble {
    margin-left: 10px;
  }
  .message-row.self .bubble {
    margin-right: 10px;
  }
  
  /* ===== 吹き出しの三角形 ===== */
  /* ===== 吹き出しの三角形 (LINE風) ===== */
  .message-row.other .bubble::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -10px;
    width: 20px;
    height: 30px;
    border-radius: 0 0 0 15px;
    /* ★ 1. 背景色(Fill) -> 2. 境界線色(Border) の順で指定 */
    /* 境界線シャドウの広がりを -6px に戻す */
    box-shadow: -3px -15px 0 -7px var(--other-bubble-bg-color) inset, /* Fill (BG Color) - Smaller */
                -2px -14px 0 -6px #e8e8e8 inset; /* Border (Gray) - Original */
  }
  
  .message-row.self .bubble::before {
    content: "";
    position: absolute;
    top: -5px;
    right: -10px;
    width: 20px;
    height: 30px;
    border-radius: 0 0 15px 0;
    /* ★ 1. 背景色(Fill) -> 2. 境界線色(Border) の順で指定 */
    /* 境界線シャドウの広がりを -6px に戻す */
    box-shadow: 3px -15px 0 -7px var(--self-bubble-bg-color) inset, /* Fill (BG Color) - Smaller */
                2px -14px 0 -6px #e8e8e8 inset; /* Border (Gray) - Original */
  }
  
  /* ===== 吹き出し内テキスト ===== */
  .bubble-text {
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: pre-wrap;
    margin-bottom: 4px; /* Base margin for the container */
    overflow-wrap: break-word;
  }
  
  /* Default Paragraph Margin */
  .bubble-text p {
    margin-top: 0;
    margin-bottom: 0.6em; /* Space between paragraphs */
  }
  
  /* Title Paragraph Styling */
  .bubble-text p.chat-title {
    margin-bottom: 0.3em; /* Reduced space after title */
  }
  
  .bubble-text p.chat-title strong {
    font-weight: bold;
    line-height: 1.2; /* Keep title line-height adjusted */
  }
  
  /* List Styling */
  .bubble-text ul {
    margin-top: 0.3em; /* Space before list */
    margin-bottom: 0.6em; /* Space after list */
    padding-left: 1.5em; /* Indentation for list */
  }
  
  .bubble-text li {
    list-style: none;
    position: relative;
    /* padding-left: 1.2em; */ /* Use ul padding instead */
    margin-bottom: 0.3em;
  }
  
  .bubble-text li::before {
    content: '•';
    position: absolute;
    left: -1.1em; /* Position marker relative to li */
    top: 0.1em;
    color: var(--main-text-color);
    font-size: 1em;
  }
  
  /* ===== 時刻表示（吹き出し外、bubble基準） ===== */
  .bubble-time { /* ★ 基本スタイル */
    position: absolute;
    bottom: 3px; /* 垂直位置調整 */
    font-size: 0.7rem;
    color: #666; /* Slightly lighter gray for less emphasis */
    white-space: nowrap; /* 時刻が折り返さないように */
  }
  
  .message-row.other .bubble-time { /* ★ 相手の吹き出し: 右外側6px */
    left: 100%;
    margin-left: 10px;
  }
  
  .message-row.self .bubble-time { /* ★ 自分の吹き出し: 左外側6px */
    right: 100%;
    margin-right: 10px;
  }
  
  /* ===== 発言内容の区切り（日付表示） ===== */
  .date-header {
    display: table;           /* インラインブロックではなく、内容に合わせたテーブル表示 */
    margin: 10px auto;        /* 自動左右マージンで中央配置 */
    text-align: center;
    font-size: 0.7rem;
    font-family: var(--font-family-noto-sans-jp);
    color: #FFFFFF;
    background-color: var(--date-header-bg-color);
    padding: 4px 8px;
    border-radius: 12px;
  }
  
  .blinking-text {
    animation: blink 1.5s ease-in-out infinite;
  }
  @keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
  }
  
  /* ===== ここから追加 ===== */
  
  /* 吹き出し内リンク */
  .bubble-text a {
    color: var(--link-color);
    text-decoration: underline;
  }
  .bubble-text a:hover {
    color: var(--link-hover-color);
  }
  
  /* メッセージコピーボタン (吹き出し内) */
  .copy-msg-btn {
    position: absolute;
    bottom: 5px;
    right: 8px;
    background: none;
    border: none;
    color: #666; /* Match timestamp color */
    cursor: pointer;
    padding: 2px; /* 少しパディングを追加 */
    font-size: 0.9em;
    opacity: 0; /* ★ 通常は非表示 */
    transition: opacity 0.2s ease;
    z-index: 1; /* テキストより手前に */
  }
  .bubble:hover .copy-msg-btn {
    opacity: 0.6; /* ★ 吹き出しホバーで表示 */
  }
  .copy-msg-btn:hover {
    opacity: 1;
  }
  .copy-msg-btn i {
    pointer-events: none;
    vertical-align: middle; /* アイコンの垂直位置調整 */
  }
  
  /* 1行のみの場合にコピーボタンがテキストと重なるのを防ぐ */
  /* (より確実にはJSで高さを判定する必要があるが、簡易的な対策) */
  .bubble-text:only-child {
    /* padding-bottom: 20px; */ /* ボタン分の余白を確保する案 (見た目次第) */
  }
  
  #conversation-history a {
      color: var(--side-menu-text-color) !important; /* ★ Ensure brown color */
      display: block;
      margin-bottom: 5px;
      padding: 5px;
      text-decoration: none;
      border-radius: 4px;
      transition: background-color 0.2s ease;
  }
  #conversation-history a:hover {
      background-color: rgba(255, 255, 255, 0.1);
  }
  #conversation-history a[style*="bold"] { /* Style for active session */
      background-color: rgba(255, 255, 255, 0.2);
  }
  
  /* ===== 象の吹き出しスタイル ===== */
  .speech-bubble {
    position: absolute;
    left: 56px; /* Position it after the elephant image + 20px */
    top: 7px; /* Small offset from the header top */
    transform: none; /* Remove previous transform */
    background-color: #fff; /* 背景は白のまま */
    color: #324454;
    border-radius: 10px;
    padding: 5px 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  
    opacity: 0;
    visibility: hidden;
  
    z-index: 10;  /* 吹き出し本体全体の z-index */
    white-space: nowrap;
    pointer-events: none;
    max-width: calc(100% - 100px); /* ヘッダー内に収めるための最大幅を調整 */
    overflow: visible; /* はみ出した部分を表示 */
    text-overflow: ellipsis; /* はみ出した部分を省略記号で表示 */
  }
  
  /* 通常時のフォントサイズ */
  .speech-bubble {
    font-size: 0.9rem;  /* フォントサイズを少し大きく調整 */
  }
  
  /* 文字数が多い場合用のクラス */
  .speech-bubble.long {
    font-size: 0.75rem;  /* フォントサイズを少し大きく調整 */
  }
  
  .speech-bubble.visible {
    opacity: 1;
    visibility: visible;
    border: 1px solid var(--header-bg-color); /* ヘッダーの背景色に合わせる */
  }
  
  /* LINE風の三角形 */
  .speech-bubble::before {
    content: "";
    position: absolute;
    top: 25%;
    left: -10px;
    transform: translateY(-50%);
    width: 20px;
    height: 30px;
    border-radius: 0 0 0 15px;
    box-shadow: -3px -15px 0 -7px #fff inset; /* 背景は白のまま */
    z-index: 11;
  }
  
  /* 三角形の影 */
  .speech-bubble::after {
    content: "";
    position: absolute;
    top: 25%;
    left: -11px;
    transform: translateY(-50%);
    width: 20px;
    height: 30px;
    border-radius: 0 0 0 15px;
    box-shadow: -3px -15px 0 -7px var(--header-bg-color) inset; /* ヘッダーの背景色に近づける */
    z-index: 9;
  }
  
  /* ===== コードブロック関連スタイル (再追加) ===== */
  /* コードブロックコンテナ */
  .code-block-container {
    position: relative;
    border-radius: 4px;
    margin: 10px 0;
    /* padding-top: 30px; */ /* FIX: Remove padding-top, button is inside <pre> now */
  }
  
  /* コードブロック本体 (Prismが<pre><code>を使う) */
  /* 基本スタイルはPrismテーマ(Okaidia)に任せる */
  .code-block-container pre {
    margin: 0 !important;
    padding: 1em !important;
    overflow-x: auto;
    border-radius: 4px !important; /* FIX: Apply border-radius to pre */
    position: relative; /* FIX: Add relative positioning for the button */
  }
  
  .code-block-container pre[class*="language-"] {
    padding: 1em !important;
    margin: 0 !important;
    /* border-radius: 0 0 4px 4px !important; */ /* FIX: Remove specific border-radius */
  }
  
  .code-block-container code[class*="language-"] {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap !important; /* 折り返しを強制 */
    overflow-wrap: break-word;
    background: none !important; /* 親の<pre>の背景を使う */
    color: #abb2bf; /* Okaidiaテーマのデフォルトに近い色 */
  }
  
  /* Prismのコメント色 (Okaidiaテーマの場合) */
  .token.comment,
  .token.prolog,
  .token.doctype,
  .token.cdata {
      color: slategray;
  }
  
  /* コードブロック用コピーボタン */
  .copy-code-btn {
    position: absolute;
    top: 0.5em; /* FIX: Adjust positioning relative to <pre> padding */
    right: 0.5em; /* FIX: Adjust positioning relative to <pre> padding */
    background-color: #444c56;
    color: #c9d1d9;
    border: 1px solid #586069;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background-color 0.2s ease;
    opacity: 0.6; /* Slightly visible by default inside code block */
  }
  .code-block-container pre:hover .copy-code-btn { /* Show on pre hover */
      opacity: 1;
  }
  /* Remove general hover rule for button itself if always visible on pre hover */
  /*
  .copy-code-btn:hover {
    background-color: #586069;
  }
  */
  .copy-code-btn i {
    pointer-events: none;
  }
  /* ===== コードブロック関連スタイルここまで ===== */
  
  /* ===== スレッド削除用ゴミ箱アイコン ===== */
  .delete-thread-icon {
    display: none; /* 通常は非表示 */
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--side-menu-text-color);
    font-size: 0.9rem; /* 少し小さめに */
    opacity: 0.7;
    transition: opacity 0.2s ease;
  }
  
  #conversation-history a:hover .delete-thread-icon {
    opacity: 1; /* ホバー時に少し濃く */
  }
  
  .delete-mode .delete-thread-icon {
    display: inline-block; /* 削除モード時に表示 */
  }
  
  /* 音声入力ボタン */
  .chat-input #micBtn {
    /* 元のコメントアウト状態に戻すか、必要なら個別スタイルを設定 */
    /* margin-left: 8px; */
    /* width: 55px; */
    /* height: 55px; */
    /* border-radius: 4px; */
    /* border: none; */
    background-color: #ccc; /* 通常時の色 (例: グレー) */
    /* color: var(--button-bg-color); */
    /* padding: 0; */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    /* cursor: pointer; */
    transition: background-color 0.2s ease;
  }
  
  .chat-input #micBtn.recording {
    background-color: #ff6961; /* 録音中の色 (例: 赤系) */
    color: #FFFFFF; /* 録音中のアイコンの色 (Override general rule) */
  }
  
  /* マイクアイコン固有のサイズ指定があれば復活させる (今回は不要) */
  /* General icon size is set above */
  /* .chat-input #micBtn i {
    font-size: 1.0rem;
  } */
  
  /* Style for the new chat button */
  .header-controls button.new-chat {
      background-color: transparent;
      border: none;
      color: #fff;
      margin: 0 4px 0 0; /* 右側に4pxの余白を設定 */
      cursor: pointer;
      display: inline-flex; /* Align icon vertically */
      align-items: center;
      justify-content: center;
      width: 36px; /* フッターのアイコンと幅を合わせる */
      height: 36px; /* フッターのアイコンと高さを合わせる */
      padding: 0; /* 中央揃えのためパディングをリセット */
  }
  
  .header-controls button.new-chat i {
      font-size: 1.3rem; /* サイズを微調整 */
      /* vertical-align: middle; is less effective with flex */
  }
  
  /* Hamburger icon style */
  .header-controls i.hamburger {
      font-size: 1.5rem; /* Adjust size */
      color: #fff; /* Ensure color */
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px; /* フッターのアイコンと幅を合わせる */
      height: 36px; /* フッターのアイコンと高さを合わせる */
      padding: 0; /* パディングをリセット */
  }
  
  /* Side Menu Styles */
  #side-menu {
      position: fixed;
      /* ... (他のサイドメニュースタイル) ... */
  }
  
  /* css/style.css に追加するスタイル例 */
  .load-more-btn {
    display: block;
    width: calc(100% - 20px); /* 左右のパディングを考慮 */
    padding: 8px 10px;
    margin: 10px auto 5px auto; /* 上下にマージン、左右は自動で中央揃え */
    background-color: var(--header-bg-color); /* ★ ヘッダー背景色に合わせる */
    color: var(--header-text-color); /* ★ ヘッダーテキスト色に合わせる */
    border: 1px solid var(--header-text-color); /* ★ ヘッダーテキスト色に合わせる */
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s; /* ホバー時のトランジション */
  }
  
  .load-more-btn:hover {
    background-color: var(--header-text-color); /* ★ ホバー時はヘッダーテキスト色（茶色）を背景に */
    color: var(--header-bg-color); /* ★ ホバー時はヘッダー背景色（黄色）を文字色に */
    border-color: var(--header-text-color); /* ★ 枠線はそのままヘッダーテキスト色（茶色） */
  }
  
  .no-more-history {
    color: #a0aec0; /* Tailwindのgray.500に近い色 */
    text-align: center;
    padding: 10px;
    font-size: 0.9em;
  }
  
  /* ===== Image Upload and Preview Styles ===== */
  #image-preview-container {
      position: relative;
      width: 80px;
      height: 80px;
      margin: 0 10px 10px 10px; /* Margin below and on sides */
      border: 1px solid var(--border-color);
      border-radius: 4px;
      background-color: #fff;
      padding: 4px;
  }
  
  #image-preview {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 2px;
  }
  
  #remove-image-btn {
      position: absolute;
      top: -10px;
      right: -10px;
      background-color: black;
      color: white;
      border: 1px solid white;
      border-radius: 50%;
      width: 24px;
      height: 24px;
      font-size: 14px;
      line-height: 22px;
      text-align: center;
      cursor: pointer;
      z-index: 10;
  }