/* ============================================
   ハイラジまとめAI - AIチャットUI
   サイトの既存テーマ（緑）を軸にしたモダンAI風デザイン
   ライトテーマは :root、ダークテーマは dark.css の :root で上書き
   ============================================ */

:root {
	--ai-bg: #eef3ee;
	--ai-surface: #ffffff;
	--ai-sidebar-bg: #e7efe7;
	--ai-header-bg: rgba(255, 255, 255, 0.85);
	--ai-border: #d8e2d8;
	--ai-accent: #006432;
	--ai-accent-2: #00a050;
	--ai-accent-soft: #d9ecdb;
	--ai-accent-glow: rgba(0, 100, 50, 0.18);
	--ai-text: #1c2a1e;
	--ai-muted: #6b7a6e;
	--ai-user-bubble: linear-gradient(135deg, #006432, #008a42);
	--ai-user-text: #ffffff;
	--ai-assistant-bubble: #ffffff;
	--ai-tool-bg: #eef6ee;
	--ai-tool-border: #cfe6d2;
	--ai-tool-text: #2f6b3a;
	--ai-code-bg: #0f1a12;
	--ai-inline-code: rgba(0, 100, 50, 0.08);
	--ai-shadow: 0 4px 24px rgba(0, 60, 30, 0.08);
	--ai-danger: #d32f2f;
}

/* ========== レイアウト ========== */
.ai-wrap {
	display: flex;
	gap: 14px;
	max-width: 1600px;
	margin: 0 auto;
	height: calc(100vh - 140px);
	min-height: 480px;
}

/* ========== サイドバー ========== */
.ai-sidebar {
	width: 280px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	background: var(--ai-sidebar-bg);
	border: 1px solid var(--ai-border);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: var(--ai-shadow);
	animation: ai-slide-in-left 0.35s ease;
}

.ai-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px;
	border-bottom: 1px solid var(--ai-border);
}

.ai-brand {
	display: flex;
	align-items: center;
	gap: 10px;
}

.ai-brand-icon {
	width: 38px;
	height: 38px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.05rem;
	box-shadow: 0 2px 10px var(--ai-accent-glow);
}

.ai-brand-name {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--ai-text);
}

.ai-brand-sub {
	font-size: 0.65rem;
	color: var(--ai-muted);
	letter-spacing: 0.08em;
}

.ai-sidebar-close {
	display: none;
	background: none;
	border: none;
	color: var(--ai-muted);
	font-size: 1.1rem;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
}

.ai-sidebar-close:hover {
	background: var(--ai-accent-soft);
	color: var(--ai-accent);
}

.ai-new-chat {
	margin: 12px;
	padding: 11px;
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	border: none;
	border-radius: 14px;
	color: #fff;
	font-weight: 700;
	font-size: 0.85rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 3px 12px var(--ai-accent-glow);
}

.ai-new-chat:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 18px var(--ai-accent-glow);
}

.ai-conversation-list {
	flex: 1;
	overflow-y: auto;
	padding: 4px 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ai-conversation-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px;
	border-radius: 12px;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ai-conversation-item:hover {
	background: var(--ai-surface);
}

.ai-conversation-item.active {
	background: var(--ai-surface);
	border-color: var(--ai-accent-soft);
	box-shadow: 0 1px 6px rgba(0, 100, 50, 0.08);
}

.ai-conversation-icon {
	width: 30px;
	height: 30px;
	border-radius: 9px;
	background: var(--ai-accent-soft);
	color: var(--ai-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 0.8rem;
}

.ai-conversation-item.active .ai-conversation-icon {
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	color: #fff;
}

.ai-conversation-info {
	flex: 1;
	min-width: 0;
}

.ai-conversation-title {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--ai-text);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ai-conversation-date {
	font-size: 0.62rem;
	color: var(--ai-muted);
}

.ai-conversation-delete {
	opacity: 0;
	background: none;
	border: none;
	color: var(--ai-muted);
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	font-size: 0.8rem;
	transition: opacity 0.15s ease, color 0.15s ease;
}

.ai-conversation-item:hover .ai-conversation-delete {
	opacity: 1;
}

.ai-conversation-delete:hover {
	color: var(--ai-danger);
	background: rgba(211, 47, 47, 0.08);
}

.ai-sidebar-footer {
	padding: 10px;
	border-top: 1px solid var(--ai-border);
}

.ai-clear-chat {
	width: 100%;
	padding: 9px;
	background: none;
	border: 1px solid var(--ai-border);
	border-radius: 12px;
	color: var(--ai-muted);
	font-size: 0.75rem;
	cursor: pointer;
	transition: all 0.15s ease;
}

.ai-clear-chat:hover {
	color: var(--ai-danger);
	border-color: var(--ai-danger);
	background: rgba(211, 47, 47, 0.06);
}

.ai-sidebar-backdrop {
	display: none;
}

/* ========== メインチャット ========== */
.ai-chat {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: var(--ai-shadow);
	animation: ai-fade-in 0.4s ease;
}

/* ヘッダー */
.ai-chat-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 6px 9px;
	background: var(--ai-header-bg);
	backdrop-filter: blur(8px);
	flex-wrap: nowrap;
	border-radius: 15px;
}

.ai-chat-header-left {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.ai-chat-header h2 {
	margin: 0;
	font-size: 0.95rem;
	color: var(--ai-accent);
	white-space: nowrap;
}

.ai-chat-header h2 i {
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.ai-sidebar-toggle {
	display: none;
	background: none;
	border: 1px solid var(--ai-border);
	color: var(--ai-accent);
	border-radius: 10px;
	padding: 7px 10px;
	cursor: pointer;
	font-size: 0.9rem;
}

.ai-chat-controls {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: nowrap;
	flex-shrink: 0;
	max-width: 100%;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ai-chat-controls::-webkit-scrollbar {
	display: none;
}

.ai-ctrl-btn {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 10px;
	color: var(--ai-muted);
	cursor: pointer;
	font-size: 0.75rem;
	transition: all 0.15s ease;
}

.ai-ctrl-btn:hover {
	color: var(--ai-accent);
	border-color: var(--ai-accent);
}

/* ========== メッセージエリア ========== */
.ai-messages {
	flex: 1;
	position: relative;
	overflow-y: auto;
	padding: 20px 18px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	background:
		radial-gradient(ellipse at 20% 0%, var(--ai-accent-glow), transparent 45%),
		radial-gradient(ellipse at 80% 100%, var(--ai-accent-glow), transparent 40%),
		var(--ai-surface);
}

/* 最下部へスクロールボタン（上にスクロール中のみ表示） */
.ai-scroll-bottom {
	position: absolute;
	bottom: 14px;
	right: 14px;
	z-index: 10;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid var(--ai-border);
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	color: #fff;
	font-size: 0.85rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px var(--ai-accent-glow);
	animation: ai-fade-in-up 0.25s ease;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ai-scroll-bottom:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px var(--ai-accent-glow);
}

.ai-scroll-bottom[hidden] {
	display: none;
}

/* ウェルカム画面 */
.ai-welcome {
	margin: auto;
	text-align: center;
	max-width: 520px;
	padding: 30px 20px;
	animation: ai-fade-in-up 0.5s ease;
}

.ai-welcome-logo {
	width: 84px;
	height: 84px;
	margin: 0 auto 18px;
	border-radius: 26px;
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2.2rem;
	box-shadow: 0 8px 32px var(--ai-accent-glow);
	animation: ai-glow-pulse 3s ease-in-out infinite;
}

.ai-welcome h2 {
	margin: 0 0 8px;
	font-size: 1.5rem;
	color: var(--ai-text);
}

.ai-welcome p {
	margin: 0 0 22px;
	font-size: 0.85rem;
	color: var(--ai-muted);
	line-height: 1.7;
}

.ai-suggestions {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	justify-content: center;
	max-width: 460px;
	margin: 0 auto;
}

.ai-suggestion {
	padding: 10px 14px;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 14px;
	color: var(--ai-accent);
	font-size: 0.75rem;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	transition: all 0.18s ease;
}

.ai-suggestion:hover {
	border-color: var(--ai-accent);
	background: var(--ai-accent-soft);
	transform: translateY(-2px);
	box-shadow: 0 4px 14px var(--ai-accent-glow);
}

/* メッセージ */
.ai-message {
	display: flex;
	gap: 10px;
	animation: ai-message-in 0.3s ease;
	max-width: 100%;
}

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

.ai-avatar {
	width: 34px;
	height: 34px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 0.9rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ai-message.user .ai-avatar {
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	color: #fff;
}

.ai-message.assistant .ai-avatar {
	background: linear-gradient(135deg, #274a33, #1d3a26);
	color: #9fe8b0;
}

.ai-message-content {
	flex: 1;
	min-width: 0;
	max-width: 78%;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ai-message.user .ai-message-content {
	align-items: flex-end;
}

.ai-bubble {
	padding: 8px 12px;
	border-radius: 16px;
	line-height: 1.45;
	font-size: 0.85rem;
	word-break: break-word;
}

.ai-message.user .ai-bubble {
	background: var(--ai-user-bubble);
	color: var(--ai-user-text);
	border-bottom-right-radius: 5px;
	box-shadow: 0 3px 12px var(--ai-accent-glow);
}

.ai-message.assistant .ai-bubble {
	background: var(--ai-assistant-bubble);
	color: var(--ai-text);
	border: 1px solid var(--ai-border);
	border-bottom-left-radius: 5px;
}

/* Markdown 内スタイル */
.ai-bubble pre {
	margin: 8px 0;
	padding: 10px 12px;
	background: var(--ai-code-bg);
	border-radius: 10px;
	overflow-x: auto;
	font-size: 0.75rem;
	line-height: 1.5;
}

.ai-bubble code {
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.85em;
	padding: 2px 5px;
	background: var(--ai-inline-code);
	border-radius: 5px;
}

.ai-bubble pre code {
	background: none;
	padding: 0;
	color: #e6edf3;
}

.ai-bubble a {
	color: var(--ai-accent-2);
}

.ai-message.user .ai-bubble a {
	color: #b8f0c8;
}

.ai-bubble table {
	border-collapse: collapse;
	margin: 8px 0;
}

.ai-bubble th,
.ai-bubble td {
	border: 1px solid var(--ai-border);
	padding: 5px 9px;
	font-size: 0.78rem;
}

.ai-bubble blockquote {
	margin: 8px 0;
	padding: 6px 12px;
	border-left: 3px solid var(--ai-accent-2);
	background: var(--ai-accent-soft);
	border-radius: 0 8px 8px 0;
	color: var(--ai-muted);
}

.ai-message-image {
	display: block;
	max-width: 250px;
	max-height: 250px;
	border-radius: 12px;
	cursor: pointer;
	border: 1px solid var(--ai-border);
	transition: transform 0.2s ease;
}

.ai-message-image:hover {
	transform: scale(1.02);
}

/* ツール実行チップ */
.ai-tool-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 12px;
	background: var(--ai-tool-bg);
	border: 1px solid var(--ai-tool-border);
	border-radius: 999px;
	font-size: 0.7rem;
	color: var(--ai-tool-text);
	font-weight: 600;
	animation: ai-chip-in 0.25s ease;
	align-self: flex-start;
}

.ai-tool-chip.running i {
	animation: ai-spin 1s linear infinite;
}

.ai-tool-chip.done {
	opacity: 0.85;
}

.ai-tool-chip.done i {
	color: var(--ai-accent);
}

.ai-tool-chip .ai-tool-detail {
	font-weight: 400;
	color: var(--ai-muted);
	max-width: 260px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* 思考中表示 */
.ai-thinking {
	border: 1px solid var(--ai-border);
	border-radius: 12px;
	background: var(--ai-tool-bg);
	overflow: hidden;
	align-self: flex-start;
}

.ai-thinking summary {
	padding: 6px 12px;
	font-size: 0.72rem;
	font-weight: 600;
	cursor: pointer;
	color: var(--ai-muted);
	display: flex;
	align-items: center;
	list-style: none;
	user-select: none;
}

.ai-thinking summary::-webkit-details-marker {
	display: none;
}

.ai-thinking summary::before {
	content: "\f013";
	font-family: "Font Awesome 7 Free";
	font-weight: 900;
	font-size: 0.65rem;
	color: var(--ai-accent);
	transition: transform 0.2s ease;
}

.ai-thinking[open] summary::before {
	transform: rotate(90deg);
}

.ai-thinking-content {
	padding: 4px 12px 10px;
	font-size: 0.75rem;
	color: var(--ai-muted);
	font-style: italic;
	line-height: 1.6;
	border-top: 1px dashed var(--ai-border);
}

/* 参照元リンク */
.ai-sources {
	margin-top: 2px;
	padding: 7px 12px;
	font-size: 0.7rem;
	background: var(--ai-tool-bg);
	border: 1px solid var(--ai-tool-border);
	border-radius: 10px;
	color: var(--ai-muted);
	align-self: flex-start;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 10px;
	align-items: center;
}

.ai-sources strong {
	color: var(--ai-text);
	font-size: 0.68rem;
}

.ai-sources a {
	color: var(--ai-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* タイピングインジケータ */
.ai-typing {
	display: flex;
	gap: 4px;
	align-items: center;
	padding: 4px 2px;
}

.ai-typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--ai-accent-2);
	animation: ai-typing-bounce 1.2s infinite ease-in-out;
}

.ai-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.ai-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

/* ========== 入力エリア ========== */
.ai-input-area {
	padding: 12px 16px 10px;
	border-top: 1px solid var(--ai-border);
	background: var(--ai-header-bg);
	backdrop-filter: blur(8px);
}

.ai-input-row {
	display: flex;
	gap: 4px;
	align-items: baseline;
}

.ai-input-row textarea {
	flex: 1;
	min-height: 40px;
	max-height: 150px;
	margin-top: 0;
	resize: vertical;
	padding: 10px 14px;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 14px;
	color: var(--ai-text);
	font-size: 0.85rem;
	font-family: inherit;
	line-height: 1.5;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-input-row textarea:focus {
	outline: none;
	border-color: var(--ai-accent-2);
	box-shadow: 0 0 0 3px var(--ai-accent-glow);
}

.ai-input-row textarea::placeholder {
	color: var(--ai-muted);
}

.ai-send-btn {
	width: 40px;
	height: 40px;
	border-radius: 14px;
	background: linear-gradient(135deg, var(--ai-accent), var(--ai-accent-2));
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 0.9rem;
	transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
	box-shadow: 0 3px 10px var(--ai-accent-glow);
}

.ai-send-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 5px 16px var(--ai-accent-glow);
}

.ai-send-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ========== 入力エリア: +ボタン・モデル・思考レベル・メニュー ========== */
.ai-plus-btn {
	width: 40px;
	height: 40px;
	border-radius: 14px;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	color: var(--ai-accent);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	font-size: 1rem;
	transition: all 0.15s ease;
}

.ai-plus-btn:hover {
	border-color: var(--ai-accent);
	background: var(--ai-accent-soft);
}

.ai-model-btn,
.ai-think-btn {
	height: 40px;
	padding: 0 12px;
	border-radius: 14px;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	color: var(--ai-text);
	cursor: pointer;
	font-size: 0.72rem;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	white-space: nowrap;
	transition: all 0.15s ease;
	font-family: inherit;
}

.ai-model-btn:hover,
.ai-think-btn:hover {
	border-color: var(--ai-accent);
	color: var(--ai-accent);
}

/* 思考レベルボタンは灰色 */
.ai-think-btn {
	background: var(--ai-think-bg, #eef1ee);
	border-color: var(--ai-think-border, #d8ded8);
	color: var(--ai-think-text, #6b7a6e);
}

.ai-think-btn:hover {
	background: var(--ai-think-bg, #eef1ee);
	border-color: var(--ai-accent);
	color: var(--ai-accent);
}

/* ========== ポップアップメニュー ========== */
.ai-menu-anchor {
	position: relative;
}

.ai-menu {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	z-index: 100;
	min-width: 210px;
	max-width: calc(100vw - 24px);
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 14px;
	box-shadow: 0 10px 34px rgba(0, 60, 30, 0.18);
	padding: 0 6px;
	animation: ai-fade-in-up 0.18s ease;
}

/* 右端のメニューは右揃えで開く */
.ai-menu-right {
	left: auto;
	right: 0;
}

.ai-menu[hidden] {
	display: none;
}

.ai-menu-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 9px;
	background: none;
	border: none;
	border-radius: 9px;
	color: var(--ai-text);
	font-size: 0.78rem;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	transition: background 0.12s ease;
	width: stretch;
}

.ai-menu-item:hover {
	background: var(--ai-accent-soft);
	color: var(--ai-accent);
}

.ai-menu-item > i {
	width: 18px;
	text-align: center;
	color: var(--ai-muted);
}

.ai-menu-item:hover > i {
	color: var(--ai-accent);
}

.ai-menu-parent {
	position: relative;
}

.ai-menu-label {
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
}

.ai-menu-arrow {
	margin-left: auto;
	font-size: 0.6rem;
	color: var(--ai-muted);
}

/* サブメニュー（横に展開） */
.ai-menu-sub {
	position: absolute;
	left: calc(100% + 4px);
	top: -183px;
	z-index: 101;
	min-width: 180px;
	max-width: min(240px, calc(100vw - 24px));
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 12px;
	box-shadow: 0 10px 34px rgba(0, 60, 30, 0.18);
	padding: 0 6px;
	animation: ai-fade-in-up 0.15s ease;
}

.ai-menu-sub[hidden] {
	display: none;
}

.ai-menu-option {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 6px 9px;
	background: none;
	border: none;
	border-radius: 8px;
	color: var(--ai-text);
	font-size: 0.75rem;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	white-space: nowrap;
	transition: background 0.12s ease;
}

.ai-menu-option:hover {
	background: var(--ai-accent-soft);
	color: var(--ai-accent);
}

.ai-opt-check {
	width: 22px;
	flex-shrink: 0;
	font-family: 'JetBrains Mono', monospace;
	font-size: 0.72rem;
	color: var(--ai-accent);
}

.ai-status-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 6px;
	padding: 0 4px;
	font-size: 0.65rem;
	color: var(--ai-muted);
}

.ai-status-bar .busy {
	color: var(--ai-accent);
}

/* 画像プレビュー */
.ai-image-preview {
	position: relative;
	display: inline-block;
	margin-bottom: 8px;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid var(--ai-border);
	max-width: 180px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ai-image-preview[hidden] {
	display: none;
}

.ai-image-preview img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 130px;
	object-fit: cover;
}

.ai-remove-image {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.65);
	border: none;
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.65rem;
	transition: background 0.15s ease;
}

.ai-remove-image:hover {
	background: var(--ai-danger);
}

/* ドラッグ&ドロップオーバーレイ */
.ai-drag-overlay {
	display: none;
	position: absolute;
	inset: 0;
	background: rgba(0, 100, 50, 0.22);
	backdrop-filter: blur(2px);
	z-index: 9999;
	justify-content: center;
	align-items: center;
	border-radius: 18px;
	pointer-events: none;
}

.ai-drag-overlay.show {
	display: flex;
}

.ai-drag-overlay-content {
	text-align: center;
	color: #fff;
	font-size: 1.1rem;
	font-weight: 700;
	text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.ai-drag-overlay-content i {
	font-size: 3rem;
	margin-bottom: 12px;
	display: block;
	animation: ai-glow-pulse 1.5s ease-in-out infinite;
}

/* ========== アニメーション ========== */
@keyframes ai-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes ai-fade-in-up {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-slide-in-left {
	from { opacity: 0; transform: translateX(-16px); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes ai-message-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-chip-in {
	from { opacity: 0; transform: scale(0.9); }
	to { opacity: 1; transform: scale(1); }
}

@keyframes ai-glow-pulse {
	0%, 100% { box-shadow: 0 8px 32px var(--ai-accent-glow); }
	50% { box-shadow: 0 8px 44px var(--ai-accent-glow), 0 0 60px var(--ai-accent-glow); }
}

@keyframes ai-typing-bounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
	30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes ai-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ========== スクロールバー ========== */
.ai-messages::-webkit-scrollbar,
.ai-conversation-list::-webkit-scrollbar {
	width: 8px;
}

.ai-messages::-webkit-scrollbar-thumb,
.ai-conversation-list::-webkit-scrollbar-thumb {
	background: var(--ai-border);
	border-radius: 4px;
}

.ai-messages::-webkit-scrollbar-thumb:hover,
.ai-conversation-list::-webkit-scrollbar-thumb:hover {
	background: var(--ai-accent-soft);
}

/* ========== フルスクリーン ========== */
.ai-wrap:fullscreen {
	height: 100vh;
	border-radius: 0;
	gap: 14px;
	padding: 10px;
	background: var(--ai-bg);
}

.ai-wrap:fullscreen .ai-sidebar,
.ai-wrap:fullscreen .ai-chat {
	border-radius: 16px;
}

/* ========== レスポンシブ ========== */
@media (max-width: 900px) {
	.ai-wrap {
		height: calc(100vh - 120px);
	}

	.ai-sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 1000;
		width: 280px;
		border-radius: 0 18px 18px 0;
		transform: translateX(-105%);
		transition: transform 0.25s ease;
	}

	.ai-sidebar.open {
		transform: translateX(0);
	}

	.ai-sidebar-close,
	.ai-sidebar-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.ai-sidebar-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.4);
		z-index: 999;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
	}

	.ai-sidebar-backdrop.show {
		opacity: 1;
		pointer-events: auto;
	}

	.ai-message-content {
		max-width: 88%;
	}

	.ai-chat-header h2 {
		font-size: 0.85rem;
	}

	.ai-suggestion {
		font-size: 0.7rem;
		padding: 8px 12px;
	}

	/* iOS 自動ズーム防止 */
	.ai-input-row textarea {
		font-size: 16px;
	}
}
