/* 記事内AI相談ボタン */

.aicb {
	--aicb-fg: #16181d;
	--aicb-muted: #6b7280;
	--aicb-bg: #ffffff;
	--aicb-line: #e3e6ea;
	--aicb-accent: #10a37f;
	--aicb-accent-fg: #ffffff;
	--aicb-radius: 12px;
	margin: 0 0 1.75em;
	font-size: 16px;
	line-height: 1.7;
}

@media (prefers-color-scheme: dark) {
	.aicb {
		--aicb-fg: #e8eaed;
		--aicb-muted: #9aa3af;
		--aicb-bg: #1b1e24;
		--aicb-line: #333941;
		--aicb-accent: #19c39c;
	}
}

/* ---- トリガーボタン ---- */
.aicb__btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	box-sizing: border-box;
	padding: 15px 18px;
	border: 1px solid var(--aicb-accent);
	border-radius: var(--aicb-radius);
	background: var(--aicb-accent);
	color: var(--aicb-accent-fg);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.4;
	text-align: left;
	cursor: pointer;
	transition: filter .15s ease, transform .05s ease;
	-webkit-appearance: none;
	appearance: none;
}

.aicb__btn:hover { filter: brightness(1.08); }
.aicb__btn:active { transform: translateY(1px); }
.aicb__btn:focus-visible { outline: 3px solid var(--aicb-accent); outline-offset: 2px; }

.aicb__btn-icon { display: inline-flex; flex: 0 0 auto; }
.aicb__btn-text { flex: 1 1 auto; }
.aicb__btn-caret { display: inline-flex; flex: 0 0 auto; opacity: .85; transition: transform .2s ease; }
.aicb__btn[aria-expanded="true"] .aicb__btn-caret { transform: rotate(180deg); }

/* ---- ボタン右端のAIロゴ ---- */
.aicb__btn-logos {
	display: flex;
	align-items: center;
	gap: 5px;
	flex: 0 0 auto;
}

.aicb__btn-logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	border: 1.5px solid rgba(255, 255, 255, .9);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
}

.aicb__btn-more {
	font-size: .75rem;
	opacity: .9;
	margin-left: 2px;
}

/* 狭い画面ではロゴを隠す（文言が折り返して崩れるため） */
@media (max-width: 480px) {
	.aicb__btn-logos { display: none; }
}

/* ---- モーダル ---- */
.aicb__overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(10, 12, 16, .55);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	animation: aicb-fade .16s ease-out;
}

.aicb__overlay[hidden] { display: none; }

@keyframes aicb-fade { from { opacity: 0; } to { opacity: 1; } }

.aicb__panel {
	position: relative;
	width: 100%;
	max-width: 420px;
	max-height: 85vh;
	overflow-y: auto;
	box-sizing: border-box;
	padding: 26px 22px 20px;
	border-radius: 16px;
	background: var(--aicb-bg);
	color: var(--aicb-fg);
	box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
	animation: aicb-rise .18s cubic-bezier(.2, .8, .3, 1);
}

@keyframes aicb-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.aicb__close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--aicb-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.aicb__close:hover { background: rgba(128, 128, 128, .14); }

.aicb__lead {
	margin: 0 0 16px;
	padding-right: 28px;
	font-size: .95rem;
	font-weight: 600;
}

.aicb__list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 8px;
}

.aicb__list li { margin: 0; padding: 0; }

.aicb__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
	border: 1px solid var(--aicb-line);
	border-radius: 10px;
	color: var(--aicb-fg);
	text-decoration: none;
	transition: border-color .15s ease, background .15s ease;
}

.aicb__item:hover {
	border-color: var(--aicb-accent);
	background: rgba(128, 128, 128, .07);
	text-decoration: none;
}

.aicb__item:focus-visible { outline: 3px solid var(--aicb-accent); outline-offset: 2px; }

.aicb__mark {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	color: #fff;
	font-size: .95rem;
	font-weight: 700;
}

.aicb__name { flex: 1 1 auto; font-size: .95rem; font-weight: 600; }
.aicb__arrow { flex: 0 0 auto; color: var(--aicb-muted); }

.aicb__note {
	margin: 16px 0 0;
	color: var(--aicb-muted);
	font-size: .78rem;
	line-height: 1.6;
}

/* ---- アプリ／ブラウザの選択 ---- */
.aicb__view[hidden] { display: none; }

.aicb__choice-title { margin-bottom: 10px; }

.aicb__send-note {
	margin: 0 0 16px;
	padding: 10px 12px;
	border-radius: 8px;
	background: rgba(128, 128, 128, .1);
	color: var(--aicb-fg);
	font-size: .82rem;
	line-height: 1.65;
}

.aicb__choice-actions {
	display: grid;
	gap: 10px;
}

.aicb__choice-btn {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 14px 16px;
	border: 1px solid var(--aicb-line);
	border-radius: 10px;
	background: transparent;
	color: var(--aicb-fg);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.aicb__choice-btn:hover { border-color: var(--aicb-accent); }
.aicb__choice-btn:focus-visible { outline: 3px solid var(--aicb-accent); outline-offset: 2px; }

.aicb__choice-btn--primary {
	border-color: var(--aicb-accent);
	background: var(--aicb-accent);
	color: var(--aicb-accent-fg);
}

.aicb__choice-btn--primary:hover { filter: brightness(1.08); }

.aicb__choice-main { display: block; font-size: 1rem; font-weight: 700; }
.aicb__choice-sub { display: block; margin-top: 3px; font-size: .78rem; opacity: .75; }

.aicb__back {
	display: block;
	margin: 16px auto 0;
	padding: 6px 10px;
	border: 0;
	background: transparent;
	color: var(--aicb-muted);
	font-family: inherit;
	font-size: .85rem;
	cursor: pointer;
}

.aicb__back:hover { color: var(--aicb-fg); }

/* ---- トースト ---- */
.aicb__toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	z-index: 100000;
	padding: 11px 18px;
	border-radius: 999px;
	background: #16181d;
	color: #fff;
	font-size: .85rem;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
	animation: aicb-toast .2s ease-out;
}

@keyframes aicb-toast { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

body.aicb-locked { overflow: hidden; }
