/* BBTM Mentor widget. Scoped to #bbtm-mentor-root so it cannot touch the site
   or the game canvas. */

#bbtm-mentor-root {
	--bbtm-accent: #03a84e;
	--bbtm-ink: #16202a;
	--bbtm-muted: #5d6b78;
	--bbtm-line: #e3e8ee;
	position: fixed;
	right: 18px;
	bottom: 18px;
	z-index: 2147483000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--bbtm-ink);
}

#bbtm-mentor-root * {
	box-sizing: border-box;
}

/* Launcher */
.bbtm-launcher {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 0;
	border-radius: 999px;
	padding: 11px 18px 11px 14px;
	background: var(--bbtm-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bbtm-launcher:hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 26px rgba(0, 0, 0, 0.26);
}

.bbtm-launcher:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 2px;
}

.bbtm-launcher svg {
	width: 20px;
	height: 20px;
	flex: 0 0 auto;
}

.bbtm-launcher.bbtm-hidden,
.bbtm-nudge.bbtm-hidden,
.bbtm-panel.bbtm-hidden {
	display: none;
}

/* One-time nudge. Small, dismissible, never covers the middle of the page. */
.bbtm-nudge {
	position: absolute;
	right: 0;
	bottom: 60px;
	width: 254px;
	background: #fff;
	border: 1px solid var(--bbtm-line);
	border-radius: 14px;
	padding: 13px 30px 13px 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
	font-size: 14px;
	cursor: pointer;
	animation: bbtm-in 0.25s ease;
}

.bbtm-nudge-close {
	position: absolute;
	top: 4px;
	right: 4px;
	border: 0;
	background: transparent;
	color: var(--bbtm-muted);
	font-size: 18px;
	line-height: 1;
	padding: 4px 7px;
	cursor: pointer;
	border-radius: 8px;
}

.bbtm-nudge-close:hover {
	background: #f1f4f7;
}

/* Panel */
.bbtm-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 374px;
	max-width: calc(100vw - 24px);
	height: 560px;
	max-height: calc(100vh - 40px);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: bbtm-in 0.2s ease;
}

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

.bbtm-head {
	background: var(--bbtm-accent);
	color: #fff;
	padding: 13px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

.bbtm-head-title {
	font-weight: 700;
	font-size: 15px;
}

.bbtm-head-sub {
	font-size: 12px;
	opacity: 0.92;
}

.bbtm-head-actions {
	margin-left: auto;
	display: flex;
	gap: 2px;
}

.bbtm-head button {
	border: 0;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	width: 30px;
	height: 30px;
	border-radius: 9px;
	cursor: pointer;
	font-size: 17px;
	line-height: 1;
}

.bbtm-head button:hover {
	background: rgba(255, 255, 255, 0.3);
}

.bbtm-log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 14px;
	background: #f7f9fb;
	-webkit-overflow-scrolling: touch;
}

.bbtm-msg {
	max-width: 88%;
	margin-bottom: 10px;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.bbtm-msg a {
	color: #0b6bcb;
	overflow-wrap: anywhere;
}

.bbtm-bot {
	background: #fff;
	border: 1px solid var(--bbtm-line);
	border-bottom-left-radius: 5px;
}

.bbtm-me {
	background: var(--bbtm-accent);
	color: #fff;
	margin-left: auto;
	border-bottom-right-radius: 5px;
}

.bbtm-me a {
	color: #fff;
	text-decoration: underline;
}

.bbtm-crisis {
	background: #fff8f2;
	border-color: #f0c9a5;
}

.bbtm-typing {
	display: inline-flex;
	gap: 4px;
	padding: 12px 14px;
}

.bbtm-typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #b9c4ce;
	animation: bbtm-blink 1.2s infinite;
}

.bbtm-typing i:nth-child(2) {
	animation-delay: 0.18s;
}

.bbtm-typing i:nth-child(3) {
	animation-delay: 0.36s;
}

@keyframes bbtm-blink {
	0%, 60%, 100% {
		opacity: 0.3;
	}
	30% {
		opacity: 1;
	}
}

.bbtm-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 12px;
	background: #f7f9fb;
}

.bbtm-chip {
	border: 1px solid var(--bbtm-line);
	background: #fff;
	color: var(--bbtm-ink);
	border-radius: 999px;
	padding: 7px 12px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

.bbtm-chip:hover {
	border-color: var(--bbtm-accent);
	color: var(--bbtm-accent);
}

.bbtm-form {
	border-top: 1px solid var(--bbtm-line);
	padding: 10px;
	display: flex;
	gap: 8px;
	align-items: flex-end;
	background: #fff;
}

.bbtm-form textarea {
	flex: 1 1 auto;
	resize: none;
	border: 1px solid var(--bbtm-line);
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	font-size: 15px; /* 16px-ish stops iOS zooming on focus */
	max-height: 110px;
	color: var(--bbtm-ink);
	background: #fff;
}

.bbtm-form textarea:focus {
	outline: 2px solid var(--bbtm-accent);
	outline-offset: -1px;
}

.bbtm-send {
	border: 0;
	background: var(--bbtm-accent);
	color: #fff;
	border-radius: 12px;
	width: 42px;
	height: 42px;
	cursor: pointer;
	flex: 0 0 auto;
	font-size: 18px;
}

.bbtm-send[disabled] {
	opacity: 0.5;
	cursor: default;
}

.bbtm-foot {
	padding: 7px 12px 10px;
	font-size: 11px;
	color: var(--bbtm-muted);
	text-align: center;
	background: #fff;
}

.bbtm-foot button {
	border: 0;
	background: transparent;
	color: var(--bbtm-accent);
	font: inherit;
	font-size: 11px;
	text-decoration: underline;
	cursor: pointer;
	padding: 0 2px;
}

/* Handoff form */
.bbtm-handoff {
	padding: 12px 14px;
	background: #fff;
	border-top: 1px solid var(--bbtm-line);
}

.bbtm-handoff label {
	display: block;
	font-size: 12px;
	color: var(--bbtm-muted);
	margin: 8px 0 3px;
}

.bbtm-handoff input,
.bbtm-handoff textarea {
	width: 100%;
	border: 1px solid var(--bbtm-line);
	border-radius: 10px;
	padding: 9px 11px;
	font: inherit;
	font-size: 15px;
}

.bbtm-handoff-actions {
	display: flex;
	gap: 8px;
	margin-top: 11px;
}

.bbtm-btn {
	border: 0;
	border-radius: 10px;
	padding: 10px 14px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	background: var(--bbtm-accent);
	color: #fff;
}

.bbtm-btn-ghost {
	background: #eef2f6;
	color: var(--bbtm-ink);
}

@media (max-width: 480px) {
	#bbtm-mentor-root {
		right: 12px;
		bottom: 12px;
	}

	.bbtm-panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 90px);
	}

	.bbtm-launcher span {
		display: none; /* icon only on small screens so the game is not covered */
	}

	.bbtm-launcher {
		padding: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bbtm-panel,
	.bbtm-nudge {
		animation: none;
	}

	.bbtm-launcher {
		transition: none;
	}
}
