.at-widget {
	position: fixed;
	z-index: 999999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--at-offset-x: 24px;
	--at-offset-y: 24px;
}
.at-pos-bottom-right { bottom: var(--at-offset-y); right: var(--at-offset-x); }
.at-pos-bottom-left  { bottom: var(--at-offset-y); left: var(--at-offset-x); }
.at-pos-top-right    { top: var(--at-offset-y); right: var(--at-offset-x); }
.at-pos-top-left     { top: var(--at-offset-y); left: var(--at-offset-x); }

.at-avatar {
	width: 76px;
	height: 76px;
	border-radius: 50%;
	overflow: hidden;
	box-shadow: 0 4px 16px rgba(0,0,0,0.25);
	cursor: pointer;
	background: #fff;
	border: 3px solid #4f46e5;
	transition: transform .15s ease;
}
.at-avatar:hover { transform: scale(1.06); }
.at-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.at-avatar.at-speaking {
	border-color: #22c55e;
	animation: at-pulse 1.1s ease-in-out infinite;
}
@keyframes at-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
	70%  { box-shadow: 0 0 0 12px rgba(34,197,94,0); }
	100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.at-panel {
	position: absolute;
	width: 300px;
	max-width: 82vw;
	background: #fff;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.2);
	overflow: hidden;
	border: 1px solid #e5e7eb;
}
/* Avatar is ~76px tall; panel docks on the opposite vertical side so it
   never gets clipped off the top or bottom of the viewport. */
.at-pos-bottom-right .at-panel, .at-pos-bottom-left .at-panel { bottom: 88px; }
.at-pos-top-right .at-panel, .at-pos-top-left .at-panel { top: 88px; }
.at-pos-bottom-right .at-panel, .at-pos-top-right .at-panel { right: 0; }
.at-pos-bottom-left .at-panel, .at-pos-top-left .at-panel { left: 0; }

.at-panel-header {
	background: #4f46e5;
	color: #fff;
	padding: 10px 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
}
.at-icon-btn {
	background: transparent;
	border: none;
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.at-caption {
	padding: 12px;
	font-size: 13.5px;
	line-height: 1.5;
	color: #1f2937;
	max-height: 220px;
	overflow-y: auto;
	min-height: 40px;
}
.at-panel-actions {
	padding: 0 12px 12px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.at-icon-ctrl {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 1px solid #d1d5db;
	background: #f9fafb;
	color: #6b7280;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}
/* Idle-but-ready and paused both show the Play icon — green, "ready to go". */
.at-icon-ctrl[data-state="paused"],
.at-icon-ctrl[data-state="idle"]:not(:disabled) {
	background: #22c55e;
	border-color: #22c55e;
	color: #fff;
}
.at-icon-ctrl[data-state="paused"]:hover,
.at-icon-ctrl[data-state="idle"]:not(:disabled):hover {
	background: #16a34a;
	border-color: #16a34a;
}
/* Playing shows the Pause icon — amber, "in progress". */
.at-icon-ctrl[data-state="playing"] {
	background: #f59e0b;
	border-color: #f59e0b;
	color: #fff;
}
.at-icon-ctrl[data-state="playing"]:hover {
	background: #d97706;
	border-color: #d97706;
}
.at-icon-ctrl:disabled {
	opacity: .5;
	background: #e5e7eb;
	border-color: #d1d5db;
	color: #9ca3af;
	cursor: default;
}
.at-btn {
	flex: 1;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid #d1d5db;
	background: #f9fafb;
	cursor: pointer;
	font-size: 13.5px;
}
.at-btn-primary {
	background: #4f46e5;
	border-color: #4f46e5;
	color: #fff;
	font-weight: 600;
}
.at-btn-primary:hover { background: #4338ca; }
.at-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 480px) {
	.at-avatar { width: 62px; height: 62px; }
	.at-panel { width: 250px; }
	.at-pos-bottom-right .at-panel, .at-pos-bottom-left .at-panel { bottom: 74px; }
	.at-pos-top-right .at-panel, .at-pos-top-left .at-panel { top: 74px; }
}
