body { margin: 0; font-family: 'Noto Sans JP', sans-serif; display: flex; flex-direction: column; height: 100vh; background-color: #ffffff; overflow: hidden; }

#operator-banner { display: none; background-color: #d32f2f; color: white; text-align: center; padding: 6px; font-size: 14px; font-weight: bold; z-index: 100; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; position: sticky; top: 0; }
#linkle-banner { display: none; background-color: #0f9d58; color: white; text-align: center; padding: 6px; font-size: 14px; font-weight: bold; z-index: 100; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0; position: sticky; top: 0; }

#main-layout { display: flex; flex: 1; width: 100%; overflow: hidden; }

#sidebar { width: 280px; background-color: #f8fafd; border-right: 1px solid #e0e0e0; padding: 20px; display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; overflow-y: auto; z-index: 5; flex-shrink: 0; }
.sidebar-section { display: flex; flex-direction: column; gap: 10px; }
.sidebar-title { font-weight: bold; font-size: 12px; color: #5f6368; padding-bottom: 2px; margin-left: 4px; display: flex; align-items: center; gap: 5px; }
.id-display-box { display: flex; align-items: center; justify-content: space-between; background: #ffffff; padding: 8px 12px; border-radius: 8px; border: 1px solid #e8eaed; }
#saved-id-display { font-family: monospace; font-size: 15px; color: #0b57d0; font-weight: bold; }
#copy-id-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; color: #5f6368; }
#copy-id-btn:hover { background-color: #e8eaed; color: #0b57d0; }
.tool-btn { background-color: #ffffff; border: 1px solid #dadce0; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: bold; color: #3c4043; transition: 0.2s; width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tool-btn:hover { background-color: #f1f3f4; }
.new-chat-btn { background-color: #c2e7ff; border: none; color: #001d35; border-radius: 16px; padding: 12px;}
.new-chat-btn:hover { background-color: #a8d5ff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.text-input-box { padding: 10px; border: 1px solid #dadce0; border-radius: 8px; font-size: 14px; width: 100%; box-sizing: border-box; font-family: inherit; background: #ffffff;}
.paste-restore-btn { background-color: #ffffff; border: 1px solid #dadce0; color: #0b57d0; padding: 10px; border-radius: 8px; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: 0.2s; }
.paste-restore-btn:hover { background-color: #f1f3f4; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.toggle-switch input:checked + .toggle-slider { background-color: #0b57d0; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* 右側のメインエリア全体（画面幅いっぱい） */
#chat-area { flex: 1; display: flex; flex-direction: column; background-color: #ffffff; min-width: 0; }

/* 🌟ここがスクロールを担当する枠。幅100%なので右端にスクロールバーが出る */
#chat-container { flex: 1; width: 100%; overflow-y: auto; padding: 40px 0 20px 0; display: flex; flex-direction: column; align-items: center; scroll-behavior: smooth; box-sizing: border-box; }

/* 中身のメッセージは最大800pxに制限して中央に置く */
.user-message-row { display: flex; align-items: flex-end; justify-content: flex-end; width: 100%; max-width: 800px; padding: 0 20px; box-sizing: border-box; gap: 8px; margin-bottom: 20px; }
.ai-msg { width: 100%; max-width: 800px; padding: 0 20px; box-sizing: border-box; color: #1f1f1f; margin-bottom: 20px; }

/* 🌟入力エリアのコンテナ。スクロール枠の下に固定され、幅は100% */
#input-wrapper { flex-shrink: 0; width: 100%; padding: 10px 20px 30px 20px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; background-color: #ffffff; border-top: 1px solid #f1f3f4; }
#image-preview-container { display: none; width: 100%; max-width: 800px; padding: 10px 20px; background-color: #e8f0fe; border-radius: 12px; margin-bottom: 10px; font-size: 14px; color: #0b57d0; font-weight: bold; align-items: center; justify-content: space-between; box-sizing: border-box; }
#input-area { width: 100%; max-width: 800px; background-color: #f0f4f9; padding: 8px 15px; border-radius: 24px; display: flex; gap: 8px; align-items: flex-end; box-sizing: border-box; transition: background-color 0.3s; cursor: text; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }

.msg-copy-btn { background: none; border: none; cursor: pointer; color: #9aa0a6; padding: 6px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.2s; flex-shrink: 0; margin-bottom: 4px; }
.msg-copy-btn:hover { background-color: #f1f3f4; color: #0b57d0; }

.message { line-height: 1.7; font-size: 16px; word-wrap: break-word; }
.user-msg { background-color: #f0f4f9; border-radius: 18px; border-bottom-right-radius: 4px; color: #1f1f1f; padding: 14px 18px; margin: 0; white-space: pre-wrap; max-width: 90%; }
.feedback-msg { background-color: #fff3e0; padding: 15px; border-radius: 8px; border-left: 4px solid #f57c00; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 8px; }

.ai-msg p { margin: 0 0 1.2em 0; }
.ai-msg p:last-child { margin: 0; }
.ai-msg h1, .ai-msg h2, .ai-msg h3 { color: #1f1f1f; font-weight: bold; margin: 1.5em 0 0.8em 0; line-height: 1.4; display: flex; align-items: center; gap: 8px;}
.ai-msg h1 { font-size: 1.6em; border-bottom: 1px solid #dadce0; padding-bottom: 0.3em; }
.ai-msg h2 { font-size: 1.3em; }
.ai-msg h3 { font-size: 1.1em; }
.ai-msg ul, .ai-msg ol { margin: 0 0 1.2em 0; padding-left: 24px; }
.ai-msg li { margin-bottom: 6px; }
.ai-msg a { color: #0b57d0; font-weight: 500; text-decoration: none; }
.ai-msg a:hover { text-decoration: underline; }
.ai-msg strong { font-weight: 700; color: #000; }

.ai-msg code { font-family: monospace; background-color: #f0f4f9; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; color: #d32f2f; }
.ai-msg pre { background-color: #f8fafd; border: 1px solid #e8eaed; border-radius: 8px; padding: 16px; overflow-x: auto; margin: 0 0 1.2em 0; }
.ai-msg pre code { background-color: transparent; padding: 0; color: #1f1f1f; border-radius: 0; font-size: 0.9em; }

.ai-msg table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em 0; font-size: 0.95em; }
.ai-msg th, .ai-msg td { border: 1px solid #dadce0; padding: 10px 12px; text-align: left; }
.ai-msg th { background-color: #f1f3f4; font-weight: bold; }

.ai-msg blockquote { margin: 0 0 1.2em 0; padding-left: 16px; border-left: 4px solid #dadce0; color: #5f6368; }

.ai-msg img:not(.spinning-himawari-img) { max-width: 100%; height: auto; display: block; margin: 16px 0; border-radius: 8px; cursor: zoom-in; transition: 0.2s; border: 1px solid #dadce0; }
.ai-msg img:not(.spinning-himawari-img):hover { opacity: 0.8; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

#image-modal { display: none; position: fixed; z-index: 1000; padding-top: 50px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.9); cursor: zoom-out; }
#modal-content { margin: auto; display: block; width: 80%; max-width: 1000px; border-radius: 8px; box-shadow: 0 4px 12px rgba(255,255,255,0.2); animation-name: zoom; animation-duration: 0.3s; }
@keyframes zoom { from {transform:scale(0)} to {transform:scale(1)} }

#remove-image-btn { background: none; border: none; cursor: pointer; color: red; font-size: 14px; font-weight: bold; display: flex; align-items: center; gap: 4px; }

.input-mode-feedback { background-color: #fff3e0 !important; border: 1px solid #ffcc80; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #444746; transition: 0.2s; margin-bottom: 4px; flex-shrink: 0; }
.icon-btn:hover { background-color: #e0e0e0; }
.plus-menu-container { position: relative; }
.action-menu { display: none; position: absolute; bottom: 50px; left: 0; background: white; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); flex-direction: column; overflow: hidden; z-index: 100; min-width: 240px; border: 1px solid #e8eaed; padding: 8px 0; }
.action-menu.show { display: flex; }
.action-menu-item { background: none; border: none; padding: 12px 20px; text-align: left; cursor: pointer; font-size: 14px; color: #3c4043; transition: 0.2s; display: flex; align-items: center; gap: 10px; }
.action-menu-item:hover { background-color: #f1f3f4; }
.menu-divider { height: 1px; background-color: #e8eaed; margin: 4px 0; }
#main-text-input { flex: 1; padding: 10px 0; border: none; background: transparent; outline: none; font-size: 16px; color: #1f1f1f; width: 100%; resize: none; overflow-y: auto; max-height: 150px; font-family: inherit; line-height: 1.5; box-sizing: border-box; margin-bottom: 2px; }
#send-btn { background-color: transparent; color: #0b57d0; border: none; padding: 8px; border-radius: 50%; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; flex-shrink: 0; }
#send-btn:hover { background-color: #e8eaed; }
#send-btn svg { fill: currentColor; width: 24px; height: 24px; }
#stop-btn { background-color: transparent; color: #444746; border: none; padding: 8px; border-radius: 50%; cursor: pointer; transition: 0.2s; display: none; align-items: center; justify-content: center; margin-bottom: 4px; flex-shrink: 0; }
#stop-btn:hover { background-color: #e8eaed; color: #1f1f1f; }
#stop-btn svg { fill: currentColor; width: 20px; height: 20px; }

@keyframes spin { 100% { transform: rotate(360deg); } }
.spinning-himawari-img { width: 35px; height: 35px; animation: spin 1.5s linear infinite; vertical-align: middle; margin-right: 8px; flex-shrink: 0; }

.hamburger-btn { display: none; }
#sidebar-overlay { display: none; }
@media screen and (max-width: 768px) {
    .hamburger-btn { display: flex; position: fixed; top: 15px; left: 15px; z-index: 1000; background-color: #ffffff; color: #3c4043; border: 1px solid #dadce0; padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: bold; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.1); align-items: center; gap: 5px; }
    #sidebar { position: fixed; top: 0; left: -300px; width: 280px; height: 100vh; z-index: 1001; transition: left 0.3s ease; box-shadow: 2px 0 10px rgba(0,0,0,0.2); }
    #sidebar.open { left: 0; }
    #sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0,0,0,0.5); z-index: 1000; }
    #sidebar-overlay.show { display: block; }
    
    #chat-container { padding: 80px 0 20px 0; }
}