/* リセット & 基本設定 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* フレックスレイアウトで全体を構成 */
body {
    display: flex;
    flex-direction: column;
    font-size: 1rem;
    font-family: Arial, sans-serif;
    background-color: var(--color-canvas-default);
    color: var(--color-fg-default, #000);
}

/* Light theme */
:root {
    --color-canvas-default: #ffffff;
    --color-canvas-subtle: #f6f8fa;
    --color-border-default: #d0d7de;
    --color-border-muted: hsla(210, 18%, 87%, 1);
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
    :root {
        --color-canvas-default: #0d1117;
        --color-canvas-subtle: #161b22;
        --color-border-default: #30363d;
        --color-border-muted: #21262d;
    }
}

/* チャット履歴は残りの領域を占有し、内部だけスクロール */
#chat-history {
    flex: 1;                     /* 残りの高さをすべて占有 */
    border: 1px solid var(--color-border-default);
    overflow-y: auto;            /* 内容が多いときはここだけスクロール */
    margin-bottom: 0;            /* フッターと余計な余白ができないように */
    padding: 10px;
    background-color: var(--color-canvas-subtle);
}

/* 入力エリアは常に画面下部に固定 */
#input-area {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    background-color: var(--color-canvas-default);
    border-top: 1px solid var(--color-border-muted);
    flex-shrink: 0;              /* 縮小しない */
}

/* テキストエリア（自動伸長） */
#message-input {
    flex: 1;
    /* 以前は height: 50px; だったが自動伸長に変更 */
    min-height: 50px;        /* 文字が少ないときの最低高さ */
    max-height: 300px;       /* 必要に応じて調整 */
    overflow: hidden;        /* スクロールバーが出ないように */
    resize: none;            /* 手動リサイズは不可 */
    padding: 8px;
    font-family: inherit;
    font-size: 1rem;
}

/* ボタン共通スタイル */
#input-area button {
    width: 70px;
    height: 52px;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    margin-left: 5px;
}

/* 送信ボタン */
#send-button {
    background-color: #007BFF;
}
#send-button:hover {
    background-color: #0056b3;
}

/* 画像ボタン */
#image-button {
    background-color: #4CAF50;
}
#image-button:hover {
    background-color: #45a049;
}

/* メッセージのスタイル */
.user {
    background-color: aquamarine;
    border-radius: 6px;
    padding: 5px 10px;
    margin: 5px 0;
    align-self: flex-end;
    word-break: break-word;
}
.assistant {
    background-color: whitesmoke;
    border-radius: 6px;
    padding: 5px 10px;
    margin: 5px 0;
    align-self: flex-start;
    word-break: break-word;
}

/* ハンバーガーボタン */
button.hamburger {
    background: none;
    border: none;
    color: black;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

/* オーバーレイ全体 */
#session-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    z-index: 1000;
}

/* 非表示用クラス（#session-overlay に確実に適用） */
#session-overlay.hidden,
.hidden {
    display: none !important;   /* 優先度を上げて非表示にする */
}

/* セッション一覧のコンテナ */
#session-list-container {
    background: #fff;
    width: 300px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1rem;
    box-shadow: 2px 0 8px rgba(0,0,0,.2);
}

/* セッション項目 */
#session-list li {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
#session-list li:hover {
    background: #f5f5f5;
}

.mjx-math {
  font-family: 'STIX Two Math', 'Latin Modern Math', 'TeX Gyre Pagella Math', serif;
}

.mjx-container {
  font-family: 'STIX Two Math', 'Latin Modern Math', 'TeX Gyre Pagella Math', serif;
  line-height: normal; /* 数式の潰れ防止 */
}
