/* CSS変数でブランドカラーを定義 */
:root {
    --brand-green: #30e852;       /* メインの緑色 */
    --brand-green-hover: #2bd847; /* ホバー時の緑色 */
    --brand-green-dark: #25c83e;  /* アクティブ時の緑色 */
    --brand-green-light: #a7f5b8; /* 薄い緑色（背景など用） */
    --brand-green-alpha: rgba(48, 232, 82, 0.2); /* 透明度付き緑色 */
    --brand-green-text: #1ab436;  /* テキスト用の濃い緑色 */
    --neutral-gray: #6e7278;      /* メニュー用の濃いグレー */
    --light-gray: #e0e0e0;        /* リロードボタンなどの薄いグレー */
    --hover-gray: #cccccc;        /* ホバー時のグレー */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #7494c0;
    position: fixed;
    width: 100%;
}

#chat-container {
    max-width: 800px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    position: relative;
}

#chat-header {
    background-color: #273246;
    color: white;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    position: relative;
    z-index: 1000;
}

#chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #dedbd2;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

#chat-box::before {
    content: '';
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    height: calc(100% - 120px);
    background-image: url('image-preview.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% auto;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

#settings-panel {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: white;
    padding: 20px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    width: 300px;
    max-width: 100%;
}

#settings-panel.active {
    display: block;
}

.settings-group {
    margin: 15px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.settings-group:last-child {
    border-bottom: none;
}

.settings-button {
    width: 100%;
    padding: 12px 15px;
    background-color: var(--brand-green);
    color: black; /* 黒文字に変更 */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    margin: 10px 0;
    height: auto;
}

.settings-button:hover {
    background-color: var(--brand-green-hover);
    color: black; /* ホバー時も黒を維持 */
}

.settings-button:active {
    background-color: var(--brand-green-dark);
}

.shortcut-instruction {
    font-size: 13px;
    color: #666;
    margin-top: 10px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 6px;
    line-height: 1.6;
}

.ios-share-button {
    color: #007AFF;
    font-size: 20px;
    vertical-align: middle;
    margin: 0 2px;
}

.copyright {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

.message.user {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
}

.bot .message-content {
    background-color: white;
    margin-left: 12px;
}

.user .message-content {
    background-color: var(--brand-green);
    color: #000;
    margin-right: 12px;
}

/* 入力中のメッセージスタイル */
.message-content.typing {
    background-color: white;
    opacity: 0.8;
}

.typing-text {
    color: #666;
    font-style: italic;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.message-controls {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    justify-content: flex-start;
}

.user .message-controls {
    justify-content: flex-end;
}

/* メニューボタン（ハンバーガーアイコン）*/
.menu-button {
    background: none !important; /* !important を追加して優先度を上げる */
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.menu-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important; /* !important を追加して優先度を上げる */
    color: white !important;
}

.menu-button:active,
.menu-button:focus {
    background-color: var(--neutral-gray) !important; /* !important を追加して優先度を上げる */
    color: white !important;
}

/* アイコンボタン（リロードなど）をグレーに */
.icon-button {
    background: var(--light-gray);
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background-color 0.2s, transform 0.5s ease;
}

.icon-button:hover {
    background-color: var(--hover-gray);
    color: #333;
}

.icon-button.rotating {
    animation: rotate 1s infinite linear;
    background-color: var(--light-gray);
    color: #333;
    pointer-events: none; /* クリック不可にして連打防止 */
}

/* テスト音声ボタン - スピーカーとテキストのシンプルなデザイン */
.test-voice-button {
    background-color: #f5f5f5;
    color: #444;
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s ease;
    margin-top: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.test-voice-button:hover {
    background-color: #eaeaea;
}

.test-voice-button.active {
    background-color: #eaeaea;
    color: #333;
    font-weight: bold;
}

/* メッセージの音声ボタン - グレーのまま */
.control-button {
    background: none !important; /* !important で他のスタイルを上書き */
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    outline: none !important; /* アウトラインも削除 */
}

.control-button:hover, 
.control-button:active,
.control-button:focus {
    color: #333; /* ホバー時は濃いグレー */
    background-color: transparent !important; /* 背景色を完全に透明に */
    box-shadow: none !important; /* ボックスシャドウも削除 */
    transform: scale(1.1); /* 少し拡大するだけ */
}

.control-button.speak-button.speaking {
    color: #333; /* 音声再生中も濃いグレー */
}

/* スピーカーボタン特有のホバースタイル上書き */
.control-button.speak-button {
    box-shadow: none !important;
}

.speak-button:hover,
.speak-button:active,
.speak-button:focus {
    transform: scale(1.1); /* 少し拡大 */
    color: #333; /* 濃いグレーに変更 */
    background: transparent !important; /* 背景透明 */
    box-shadow: none !important; /* 影なし */
    outline: none !important; /* アウトラインなし */
}

.control-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-button:hover {
    color: #007bff;
}

#user-input {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #f5f5f5;
    position: relative;
    z-index: 1000;
}

#user-message {
    flex-grow: 1;
    padding: 12px;
    border: none;
    border-radius: 20px;
    background-color: white;
    font-size: 16px;
}

#user-message:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-green-alpha);
}

.control-buttons {
    display: flex;
    gap: 10px;
} /* 同じ緑色 (#30e852) が使われています */

/* Only apply circular style to control buttons (send/voice), not quick-action buttons */
#send-button,
#voice-button {
    padding: 10px;
    background-color: var(--brand-green);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button:disabled,
#voice-button:disabled {
    background-color: #cccccc;
}

#send-button:hover:not(:disabled),
#voice-button:hover:not(:disabled) {
    background-color: var(--brand-green-hover);
}

#send-button:active:not(:disabled),
#voice-button:active:not(:disabled) {
    background-color: var(--brand-green-dark);
}

#send-button:focus,
#voice-button:focus,
.settings-button:focus,
#user-message:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--brand-green-alpha);
}

#voice-button {
    background-color: var(--brand-green);
}

#voice-button.recording {
    background-color: #ff4444;
    animation: pulse 1.5s infinite;
}

#voice-button:hover:not(.recording) {
    background-color: var(--brand-green-hover);
}

.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-bottom: 10px;
}

.rate-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#rate {
    flex: 1;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@media screen and (max-width: 480px) {
    /* ...existing code... */
    
    /* モバイル特有のタップスタイル上書き */
    .menu-button:active,
    .menu-button:focus,
    .control-button:active,
    .control-button:focus,
    .speak-button:active,
    .speak-button:focus {
        background-color: transparent !important;
        color: var(--neutral-gray);
        box-shadow: none !important;
        outline: none !important;
    }

    /* モバイルでのハンバーガーメニュー調整 */
    button#menu-button,
    button#menu-button:hover,
    button#menu-button:active,
    button#menu-button:focus {
        background-color: transparent !important;
        color: white !important;
        -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    }
}

/* Safari特有のフォーカススタイルを上書き */
@media not all and (min-resolution:.001dpcm) { 
    @supports (-webkit-appearance:none) {
        .menu-button, .control-button, .speak-button {
            -webkit-tap-highlight-color: rgba(0,0,0,0);
        }
    }
}

/* ボタンのリセットとオーバーライド（特別なメニューボタン用） */
button#menu-button {
    background-color: transparent !important;
    color: white !important;
    border: none !important;
    box-shadow: none !important;
}

button#menu-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

button#menu-button:active,
button#menu-button:focus {
    background-color: var(--neutral-gray) !important;
    color: white !important;
}































































}    color: var(--brand-green);.success-message {/* リロード成功通知の色 */}    color: var(--brand-green);    transform: scale(1.2);.speak-button:hover {/* 再生/停止ボタンのホバー色 */}    font-weight: bold;    color: var(--brand-green-dark);.result-value {/* 結果値の色 */}    background-color: var(--brand-green-hover);.calc-button:hover {}    background-color: var(--brand-green);.calc-button {/* 計算機関連の色 */}    color: black; /* 白から黒に変更 */.test-voice-button.active {/* テスト音声ボタン - アクティブ時 */}    --brand-green-alpha: rgba(48, 232, 82, 0.2); /* 透明度付き緑色 */    --brand-green-light: #a7f5b8; /* 薄い緑色（背景など用） */    --brand-green-dark: #25c83e;  /* アクティブ時の緑色 */    --brand-green-hover: #2bd847; /* ホバー時の緑色 */    --brand-green: #30e852;       /* メインの緑色 */:root {/* CSS変数でブランドカラーを定義し、すべての緑色を統一 */}    }        padding-bottom: 100px;    #chat-box {@supports (-webkit-touch-callout: none) {}    }        margin: 10px 0;    .shortcut-instruction {        }        border-radius: 0;        width: 100%;    #settings-panel {        }        max-width: 85%;    .message-content {@media screen and (max-width: 480px) {/* 結果値の色 - カロリー計算機 */
.result-value {
    color: var(--brand-green-text); /* より濃いグリーン */
    font-weight: bold;
    font-size: 1.2em; /* 文字サイズ拡大 */
}

/* クイックアクションボタンエリア */
#quick-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

#quick-actions .quick-action-button {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 20px !important;
    background-color: #f8f8f8 !important;
    border: none !important;
    border-top: 1px solid #ddd !important;
    border-radius: 0 !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: #333 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

#quick-actions .quick-action-button:hover {
    background-color: #e8e8e8 !important;
}

#quick-actions .quick-action-button:active {
    background-color: #d8d8d8 !important;
}

#quick-actions .quick-action-button.active {
    background-color: var(--brand-green) !important;
    color: white !important;
}

#quick-actions .quick-action-button .icon {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor !important;
}
