/* ======================================
   Chat UI Stylesheet
   チャットインターフェースのスタイル定義
   ====================================== */

body {
	margin: 0;
	padding: 0;
	overflow: hidden;
}

* {
	font-family: "Noto Sans JP", sans-serif;
}

#map {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 100%;
}

.layer-create-title {
	font-size: 18px;
	font-weight: 500;
	color: #141415;
}

/* 市区町村名入力フィールド専用のプレースホルダー色 */
#city-box::placeholder {
	color: #ccc;
}

.input-style {
	width: 50px;
	height: 30px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.create-btn {
	padding: 8px 20px;
	background-color: #0969DA;
	color: #fff;
	border: none;
	padding: 8px;
	font-weight: 500;
	border-radius: 4px;
	min-width: 80px;
	font-size: 14px;
	cursor: pointer;
	height: 37px;
}


/* チャットローディングアニメーション */
@keyframes bounce {

	0%,
	80%,
	100% {
		transform: scale(0);
	}

	40% {
		transform: scale(1.0);
	}
}


/* 送信ボタンのスタイル */
#sendButton {
	background: #0D1B36 !important;
	color: #fff !important;
	border-radius: 50% !important;
	transition: background 0.2s !important;
}

#sendButton:hover {
	background: #1a2847 !important;
}

/* チャットメッセージモーダルの改善 */
#chatMessagesModal {
	position: fixed !important;
	top: 72px;
	left: 0;
	width: calc(100% - 320px) !important;
	max-width: 536px !important;
	height: calc(100vh - 88px) !important;
	background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1) !important;
	border: 1px solid rgba(255, 255, 255, 0.2) !important;
	backdrop-filter: blur(20px) !important;
	transition: all 0.3s ease !important;
	transform: translateY(0px);
	opacity: 1;
	padding-left: 16px !important;
	margin-left: 16px;
}

/* drawer-wrapperが表示されている場合 */
.drawer--left.active #chatMessagesModal {
	margin-left: 336px;
}


#chatMessagesModal.show {
	transform: translateY(0);
	opacity: 1;
}

/* 旧 #chatCloseBtn のスタイルは削除済み（llmChatCloseBtn に統合） */

/* チャットメッセージエリアの改善 */
#chatMessages {
	padding-top: 55px !important;
	padding-bottom: 120px !important;
	/* レイヤー管理UI用のスペースを拡大 */
	max-height: calc(100vh - 180px) !important;
	/* 最大高さを制限 */
	overflow-y: auto !important;
	overflow-anchor: none !important;
	/* スクロール位置の自動調整を無効化 */
}

/* レイヤー管理UIがチャットメッセージと重ならないよう確実に上に配置 */
.layer-management-ui {
	z-index: 1000 !important;
}

/* チャットメッセージのスクロール動作を上向きに調整 */
#chatMessages::-webkit-scrollbar {
	width: 6px;
}

#chatMessages::-webkit-scrollbar-thumb {
	background-color: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

/* レイヤー管理UI */
.layer-management-ui {
	position: absolute;
	bottom: 16px;
	left: 16px;
	right: 16px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 12px;
	padding: 12px;
	backdrop-filter: blur(10px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.layer-add-button {
	background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
	color: white;
	border: none;
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 8px;
}

.layer-add-button:hover {
	background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.active-layers-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.layer-tag {
	background: rgba(79, 70, 229, 0.1);
	color: #4f46e5;
	border: 1px solid rgba(79, 70, 229, 0.2);
	border-radius: 16px;
	padding: 4px 8px;
	font-size: 11px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.layer-tag .remove-btn {
	background: none;
	border: none;
	color: #6b7280;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	padding: 0;
	margin: 0;
}

.layer-tag .remove-btn:hover {
	color: #ef4444;
}

/* レイヤー警告メッセージ */
.layer-warning-message {
	background: rgba(251, 146, 60, 0.1);
	border: 1px solid rgba(251, 146, 60, 0.3);
	border-radius: 8px;
	padding: 12px;
	margin: 8px 0;
}

.layer-warning-message p {
	margin: 0 0 8px 0;
	color: #ea580c;
}

/* モーダル */
.layer-selection-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2000;
	display: none;
}

.layer-selection-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #ffffff;
	border-radius: 12px;
	padding: 24px;
	max-width: 500px;
	width: 90%;
	max-height: 70vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.layer-option {
	padding: 12px 16px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	margin: 8px 0;
	cursor: pointer;
	transition: all 0.2s ease;
	background: #f9fafb;
	word-wrap: break-word;
	word-break: break-word;
	white-space: normal;
	overflow-wrap: break-word;
}

.layer-option:hover {
	background: #eff6ff;
	border-color: #3b82f6;
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* レイヤーパネルの＋/－ボタン（廃止） */
.zoning_addToChatIcon,
[data-layer-name].show-zoning_deleteIcon,
i.show-zoning_deleteIcon[data-layer-name] {
	display: none !important;
}

/* チャットメッセージのスタイル */
.chat-message {
	display: flex;
	margin-bottom: 10px;
	opacity: 0;
	animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

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

.chat-message.ai {
	justify-content: flex-start;
}

.chat-message-content {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-line;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
	font-family: "Noto Sans JP", sans-serif;
}

.chat-message.user .chat-message-content {
	background: #e6eeff;
	color: #0D1B36;
	border: 1px solid #b8ccff;
	border-bottom-right-radius: 4px;
}

.chat-message.ai .chat-message-content {
	background: #f0f1f3;
	color: #0D1B36;
	border: 1px solid #d6d8db;
	border-bottom-left-radius: 4px;
}

/* Thinking dotsアニメーション */
.thinking-dots {
	display: flex;
	align-items: center;
}

.thinking-dots .thinking-text {
	margin-right: 8px;
}

.thinking-dots .dots-container {
	display: flex;
	gap: 2px;
}

.thinking-dots .dot {
	width: 4px;
	height: 4px;
	background-color: #666;
	border-radius: 50%;
	animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dots .dot:nth-child(1) {
	animation-delay: -0.32s;
}

.thinking-dots .dot:nth-child(2) {
	animation-delay: -0.16s;
}

.thinking-dots .dot:nth-child(3) {
	animation-delay: 0s;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
	#chatInputContainer {
		width: calc(100% - 40px) !important;
		max-width: 350px;
		left: 20px !important;
		transform: none !important;
	}

	#chatMessagesModal {
		width: calc(100% - 40px) !important;
		max-width: 350px !important;
		left: 20px !important;
		max-height: calc(100vh - 100px) !important;
	}

	#chatMessages {
		padding-top: 60px !important;
		padding-bottom: 20px !important;
		max-height: calc(100vh - 120px) !important;
	}



	/* 統合フォームのモバイル対応 */
	.unified-chat-form {
		border-radius: 16px !important;
	}

	.form-layers-section {
		padding: 8px 12px 6px 12px !important;
	}

	.layer-tag {
		padding: 3px 8px !important;
		font-size: 11px !important;
		border-radius: 12px !important;
	}

	.layer-tag-name {
		max-width: 60px !important;
	}

	.layer-remove-btn {
		width: 14px !important;
		height: 14px !important;
		font-size: 8px !important;
	}

	.unified-input {
		padding: 12px 16px !important;
	}

	.layer-add-btn {
		width: 28px !important;
		height: 28px !important;
	}

	.send-btn {
		width: 28px !important;
		height: 28px !important;
	}

	.input-actions {
		padding-right: 8px !important;
		gap: 6px !important;
	}

	.chat-layer-modal-content {
		width: 95% !important;
		margin: 20px !important;
		padding: 16px !important;
	}
}

/* プレースホルダーのスタイル */
#polygon-box::placeholder,
#CityPolygon-Layer-Box::placeholder {
	color: #ccc;
}

/* 統合フォームデザイン */
.unified-chat-form {
	background: #fff;
	border-radius: 24px;
	border: 2px solid #e0e0e0;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	position: relative;
}

.unified-chat-form:focus-within {
	border-color: #4A90E2;
	box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), 0 4px 20px rgba(0, 0, 0, 0.1);
}

.form-layers-section {
	padding: 12px 20px 4px 20px;
	background: transparent;
}

.form-input-section {
	display: flex;
	align-items: center;
	position: relative;
	padding: 8px 4px 4px 0;
}

.unified-input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 1em;
	padding: 16px 20px;
	background: transparent;
	color: #333;
	resize: none;
	min-height: 24px;
	align-self: center;
}

.unified-input::placeholder {
	color: #9ca3af;
}

.input-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-right: 12px;
}

.layer-add-btn {
	background: #f3f4f6;
	color: #6b7280;
	border: none;
	border-radius: 12px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.layer-add-btn:hover {
	background: #e5e7eb;
	color: #374151;
	transform: scale(1.05);
}

.send-btn {
	background: #0D1B36;
	color: #fff;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.send-btn:hover {
	background: #1a2332;
	transform: scale(1.05);
}

.active-layers-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.layer-tag {
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 14px;
	padding: 4px 10px;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #495057;
	transition: all 0.2s;
	font-weight: 500;
}

.layer-tag:hover {
	background: #e9ecef;
	transform: translateY(-1px);
	border-color: #dee2e6;
}

.layer-tag-name {
	max-width: 100px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.layer-remove-btn {
	background: #64748b;
	color: white;
	border: none;
	border-radius: 50%;
	width: 16px;
	height: 16px;
	cursor: pointer;
	font-size: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	padding: 0;
	line-height: 1;
}

.layer-remove-btn:hover {
	background: #ef4444;
	transform: scale(1.1);
}

/* ヘルプパネル */
.help-panel {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
}

.help-panel-header {
	background: #f0f4ff;
	padding: 12px 16px;
	font-weight: 600;
	font-size: 14px;
	color: #1a365d;
	border-bottom: 1px solid #e2e8f0;
}

.help-panel-body {
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.help-category {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.help-category-title {
	font-size: 12px;
	font-weight: 600;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.help-category-items {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.help-item {
	background: #f0f4ff;
	color: #2563eb;
	border: 1px solid #dbeafe;
	border-radius: 16px;
	padding: 4px 12px;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.2s;
	white-space: nowrap;
}

.help-item:hover {
	background: #2563eb;
	color: #fff;
	border-color: #2563eb;
}

.help-category-desc {
	font-size: 11px;
	color: #94a3b8;
}

.help-panel-footer {
	padding: 8px 16px;
	border-top: 1px solid #e2e8f0;
	background: #f8fafc;
	font-size: 11px;
	color: #94a3b8;
	text-align: center;
}

/* インポート統合設定フォーム */
.import-settings-form {
	background: #fff;
	border-radius: 12px;
	overflow: hidden;
}

.import-settings-header {
	background: #f0f4ff;
	padding: 12px 16px;
	font-weight: 600;
	font-size: 14px;
	color: #1a365d;
	border-bottom: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	gap: 6px;
}

.import-settings-body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.import-settings-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.import-settings-label {
	font-size: 12px;
	font-weight: 600;
	color: #64748b;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.import-settings-input {
	padding: 8px 12px;
	border: 1px solid #D2D5DA;
	border-radius: 6px;
	font-size: 14px;
	color: #141415;
	background: #fff;
	width: 100%;
	box-sizing: border-box;
	transition: border-color 0.2s;
}

.import-settings-input:focus {
	outline: none;
	border-color: #3388ff;
	box-shadow: 0 0 0 2px rgba(51, 136, 255, 0.15);
}

.import-settings-color {
	width: 48px;
	height: 36px;
	border: 1px solid #D2D5DA;
	border-radius: 6px;
	cursor: pointer;
	padding: 2px;
}

.import-settings-age-group {
	display: flex;
	gap: 8px;
}

.import-settings-age-btn {
	flex: 1;
	padding: 8px 16px;
	border: 1px solid #D2D5DA;
	border-radius: 6px;
	background: #fff;
	color: #5B5F66;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s;
}

.import-settings-age-btn:hover {
	border-color: #3388ff;
	color: #3388ff;
}

.import-settings-age-btn.selected {
	background: #3388ff;
	color: #fff;
	border-color: #3388ff;
}

.import-settings-type-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.import-settings-type-btn {
	width: 100%;
	padding: 10px 16px;
	border: 1px solid #D2D5DA;
	border-radius: 6px;
	background: #fff;
	color: #141415;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s;
	text-align: left;
}

.import-settings-type-btn:hover {
	border-color: #3388ff;
	background: #f0f4ff;
	color: #3388ff;
}

.import-settings-type-btn.selected {
	background: #3388ff;
	color: #fff;
	border-color: #3388ff;
}

.import-settings-footer {
	padding: 12px 16px;
	border-top: 1px solid #e2e8f0;
	background: #f8fafc;
}

.import-settings-submit {
	width: 100%;
	padding: 10px 20px;
	background: #3388ff;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s;
}

.import-settings-submit:hover {
	background: #2070e0;
}

/* 成長曲線レイヤー選択 */
.growth-curve-layer-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: 200px;
	overflow-y: auto;
	border: 1px solid #D2D5DA;
	border-radius: 6px;
	padding: 8px;
}

.growth-curve-layer-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 13px;
	color: #141415;
	transition: background 0.15s;
}

.growth-curve-layer-option:hover {
	background: #f0f4ff;
}

.growth-curve-layer-option input[type="checkbox"] {
	accent-color: #3388ff;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* 成長曲線メタ情報 */
.growth-meta-info {
	padding: 10px 16px 14px;
	border-top: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.growth-meta-row {
	font-size: 14px;
	color: #475569;
	display: flex;
	align-items: center;
	gap: 6px;
}

/* モデル一覧 */
.model-list-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f0;
	gap: 8px;
}

.model-list-item:last-child {
	border-bottom: none;
}

.model-list-item-name {
	font-size: 13px;
	color: #141415;
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.model-list-item-btns {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.model-list-edit-btn {
	background: #6b7280;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 4px 10px;
	font-size: 11px;
	cursor: pointer;
}

.model-list-edit-btn:hover {
	background: #4b5563;
}

.model-list-delete-btn {
	background: #E53E3E;
	color: #fff;
	border: none;
	border-radius: 4px;
	padding: 4px 10px;
	font-size: 11px;
	cursor: pointer;
}

.model-list-delete-btn:hover {
	background: #c53030;
}

.growth-meta-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
	display: inline-block;
}

/* チャットレイヤーモーダル */
.chat-layer-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	z-index: 3000;
	justify-content: center;
	align-items: center;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	padding: 0;
	margin: 0;
}

.chat-layer-modal.show {
	visibility: visible;
	opacity: 1;
}

.chat-layer-modal-content {
	background: #ffffff;
	border-radius: 16px;
	padding: 0;
	width: 80%;
	max-width: 600px;
	height: auto;
	max-height: 80vh;
	min-height: 400px;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.2);
	margin: auto;
	transform: scale(0.9);
	transition: transform 0.3s ease;
}

.chat-layer-modal.show .chat-layer-modal-content {
	transform: scale(1);
}
.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 24px 0 24px;
	margin-bottom: 16px;
	border-bottom: 1px solid #f1f5f9;
	padding-bottom: 16px;
}

.modal-title {
	font-size: 20px;
	font-weight: 700;
	color: #1f2937;
	margin: 0;
}

.modal-close {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	color: #64748b;
	cursor: pointer;
	transition: all 0.2s ease;
}

.modal-close:hover {
	background: #f1f5f9;
	color: #475569;
	border-color: #cbd5e1;
}

.available-layers {
	padding: 0 24px 24px 24px;
	max-height: calc(75vh - 120px);
	overflow-y: auto;
}

.available-layers::-webkit-scrollbar {
	width: 6px;
}

.available-layers::-webkit-scrollbar-track {
	background: #f8fafc;
	border-radius: 3px;
}

.available-layers::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

.available-layers::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

.modal-close:hover {
	color: #374151;
}

.available-layers {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.layer-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s;
	gap: 12px;
	min-height: 48px;
}

.layer-option:hover {
	border-color: #4A90E2;
	background: rgba(74, 144, 226, 0.05);
}

.layer-option-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.layer-option-name {
	font-weight: 500;
	color: #111827;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-height: 1.4;
	max-height: 2.8em;
}

.layer-option-type {
	font-size: 12px;
	color: #6b7280;
}

.layer-add-button {
	background: #10b981;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 8px 16px;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	min-width: 60px;
	transition: all 0.2s;
}

.layer-add-button:hover {
	background: #059669;
}

/* ======================================
	LLMチャット 上部パネル
   ====================================== */

/* 入力フォームを包むパネル（画面上部・中央に固定）
※ transform を使わず calc で中央揃えにすることで、
子要素の position:fixed が viewport 基準になる */
#llmChatPanel {
	width: 500px;
	max-width: calc(100vw - 40px);
	pointer-events: auto;
	order: 0;
}

#llmChatPanel.project-mode-style {
  position: relative;
  top: auto;
  left: auto !important;
}

@media (max-width: 1280px) {
  #llmChatPanel {
    width: 480px;
		pointer-events: auto;
  }
}

@media (max-width: 1120px) {
  #llmChatPanel {
    width: 350px;
		pointer-events: auto;
  }
}

/* 入力フォーム行 */
#llmChatForm {
  display: flex;
  align-items: center;
  height: 48px;           
  box-sizing: border-box; 
  background: #fafbfd;
  border-radius: 24px;    
  border: 2px solid #E1E3E7;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 0 8px 0 20px;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#llmChatForm:focus-within {
	border-color: #4A90E2;
	box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), 0 4px 20px rgba(0, 0, 0, 0.12);
}

#llmChatInput {
	flex: 1;
	border: none;
	outline: none;
	font-size: 14px;
	background: transparent;
	color: #141415;
	line-height: 1;
}

#llmChatInput::placeholder {
	color: #B0B3B8;
}

#llmChatSendBtn {
	background: #0D1B36;
	color: #fff;
	border: none;
	border-radius: 50%;
	width: 34px;
	height: 34px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.2s, transform 0.2s;
}

#llmChatSendBtn:hover {
	background: #1a2847;
	transform: scale(1.05);
}

/* メッセージ履歴パネル（左側に独立固定） */
#llmChatHistory {
	position: fixed;
	left: 16px;
	top: 72px;
	cursor: grab;
	width: 500px;
	max-width: calc(100vw - 32px);
	display: none;
	flex-direction: column;
	gap: 8px;
	background: #fafbfd;
	border-radius: 16px;
	border: 1px solid #E1E3E7;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
	padding: 12px;
	max-height: 60vh;
	overflow-y: auto;
	z-index: 2099;
}

#llmChatHistory::-webkit-scrollbar {
	width: 6px;
}

#llmChatHistory::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

/* 右上ボタン行（スクロールしても常に右上に固定） */
#llmChatTopBtns {
	position: sticky;
	top: 0;
	align-self: flex-end;
	flex-shrink: 0;
	display: flex;
	gap: 4px;
	z-index: 10;
}

#llmChatCloseBtn {
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	cursor: pointer;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #666;
	transition: background 0.2s;
}

#llmChatCloseBtn:hover {
	background: #e8e8e8;
	color: #333;
}

/* 中止ボタン: 処理中のみ表示 */
#llmChatAbortBtn {
	display: none;
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 50%;
	width: 26px;
	height: 26px;
	cursor: pointer;
	align-items: center;
	justify-content: center;
	color: #d32f2f;
	transition: background 0.2s;
}
#llmChatAbortBtn.is-active {
	display: flex;
}
#llmChatAbortBtn:hover {
	background: #ffebee;
	color: #b71c1c;
}

/* メッセージバブル */
.llm-chat-message {
	display: flex;
}

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

.llm-chat-message.ai {
	justify-content: flex-start;
}

.llm-chat-bubble {
	max-width: 80%;
	padding: 8px 14px;
	border-radius: 16px;
	font-size: 13px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-wrap;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.llm-chat-message.user .llm-chat-bubble {
	background: #e6eeff;
	color: #0D1B36;
	border: 1px solid #b8ccff;
	border-bottom-right-radius: 4px;
}

.llm-chat-message.ai .llm-chat-bubble {
	background: #f0f1f3;
	color: #0D1B36;
	border: 1px solid #d6d8db;
	border-bottom-left-radius: 4px;
}

.llm-chat-bubble.llm-chat-bubble-wide {
	max-width: 100%;
}

/* 考え中アニメーション */
.llm-thinking {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 16px;
}

.llm-thinking span {
	width: 6px;
	height: 6px;
	background: #999;
	border-radius: 50%;
	display: inline-block;
	animation: llmBounce 1.2s infinite ease-in-out both;
}

.llm-thinking span:nth-child(1) { animation-delay: -0.32s; }
.llm-thinking span:nth-child(2) { animation-delay: -0.16s; }
.llm-thinking span:nth-child(3) { animation-delay: 0s; }

@keyframes llmBounce {
	0%, 80%, 100% { transform: scale(0); }
	40%           { transform: scale(1); }
}

/* ポリゴン選択中の操作 UI */
#llmDrawUI {
	position: fixed;
	bottom: 32px;
	left: 50%;
	transform: translateX(-50%);
	display: none;
	align-items: center;
	gap: 12px;
	background: #fff;
	border-radius: 24px;
	border: 2px solid #4A90E2;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	padding: 10px 20px;
	z-index: 2200;
	font-size: 14px;
}

#llmDrawCount {
	color: #4A90E2;
	font-weight: 600;
	min-width: 70px;
}

#llmDrawFinish {
	background: #0D1B36;
	color: #fff;
	border: none;
	border-radius: 16px;
	padding: 6px 18px;
	cursor: pointer;
	font-size: 13px;
	transition: background 0.2s;
}

#llmDrawFinish:disabled {
	background: #aaa;
	cursor: not-allowed;
}

#llmDrawFinish:not(:disabled):hover {
	background: #1a2847;
}

#llmDrawCancel {
	background: transparent;
	color: #888;
	border: 1px solid #ccc;
	border-radius: 16px;
	padding: 6px 18px;
	cursor: pointer;
	font-size: 13px;
	transition: border-color 0.2s, color 0.2s;
}

#llmDrawCancel:hover {
	border-color: #999;
	color: #333;
}

/* ======================================
   生物種予測結果パネル（フォールバック表示）
   ====================================== */

#llmSpeciesPanel {
	display: none;
	flex-direction: column;
	position: fixed;
	left: 16px;
	top: 130px;
	width: 300px;
	max-height: 60vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	z-index: 2099;
	overflow: hidden;
}

.llm-species-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background: #2d5a27;
	color: #fff;
	flex-shrink: 0;
}

.llm-species-title {
	font-size: 14px;
	font-weight: 600;
}

.llm-species-close {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
}

.llm-species-content {
	overflow-y: auto;
	padding: 12px;
	flex: 1;
}

.llm-species-summary {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
}

.llm-species-count {
	background: #2d5a27;
	color: #fff;
	border-radius: 12px;
	padding: 2px 10px;
	font-size: 12px;
	font-weight: 600;
}

.llm-species-layer {
	font-size: 12px;
	color: #666;
}

.llm-species-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.llm-species-item {
	font-size: 13px;
	padding: 5px 0;
	border-bottom: 1px solid #f0f0f0;
	color: #333;
}

.llm-species-item:last-child {
	border-bottom: none;
}

.llm-species-empty {
	font-size: 13px;
	color: #999;
	text-align: center;
	margin: 16px 0;
}
