.dd-tsumugi {
	position: fixed;
	right: 20px;
	bottom: max(20px, env(safe-area-inset-bottom));
	z-index: 1000;
	font-family: "Noto Sans JP", system-ui, sans-serif;
}

.dd-tsumugi__launcher {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 16px 6px 6px;
	border: 1px solid rgba(20, 56, 75, 0.12);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	box-shadow: 0 16px 40px rgba(20, 56, 75, 0.18);
	color: #173b58;
	cursor: pointer;
	text-align: left;
	max-width: calc(100vw - 28px);
}

.dd-tsumugi__launcher img,
.dd-tsumugi__header img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	object-position: 50% 14%;
	border-radius: 50%;
	background: #edf3f1;
	flex-shrink: 0;
}

.dd-tsumugi__launcher strong,
.dd-tsumugi__launcher small {
	display: block;
}

.dd-tsumugi__launcher strong {
	font-size: 0.85rem;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.dd-tsumugi__launcher small {
	margin-top: 2px;
	color: #617987;
	font-size: 0.65rem;
	white-space: nowrap;
}

.dd-tsumugi__panel {
	width: min(390px, calc(100vw - 28px));
	margin-bottom: 10px;
	padding: 16px;
	border: 1px solid #dbe6e5;
	border-radius: 22px;
	background: rgba(255, 255, 255, 0.98);
	box-shadow: 0 26px 65px rgba(20, 56, 75, 0.22);
}

.dd-tsumugi__panel[hidden] {
	display: none;
}

.dd-tsumugi__header {
	display: flex;
	align-items: center;
	gap: 10px;
}

.dd-tsumugi__header img {
	width: 44px;
	height: 44px;
}

.dd-tsumugi__header p {
	margin: 0;
	color: #758d99;
	font-size: 0.57rem;
	font-weight: 700;
	letter-spacing: 0.1em;
}

.dd-tsumugi__header h2 {
	margin: 2px 0 0;
	color: #173b58;
	font-size: 1.1rem;
}

.dd-tsumugi__header button {
	margin-left: auto;
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 50%;
	background: #edf4f2;
	color: #34566b;
	font-size: 1.3rem;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
}

.dd-tsumugi__messages {
	display: flex;
	max-height: 260px;
	min-height: 94px;
	margin: 14px 0;
	flex-direction: column;
	gap: 8px;
	overflow: auto;
	padding-right: 3px;
}

.dd-tsumugi__message {
	max-width: 90%;
	margin: 0;
	padding: 10px 12px;
	border-radius: 14px;
	font-size: 0.78rem;
	line-height: 1.72;
	white-space: pre-wrap;
	word-break: break-word;
}

.dd-tsumugi__message--assistant {
	align-self: flex-start;
	background: #eff6f4;
	color: #294d5c;
	border-bottom-left-radius: 4px;
}

.dd-tsumugi__message--pending.is-status .dd-tsumugi__status {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: #4d7283;
}

.dd-tsumugi__message--pending.is-status .dd-tsumugi__status::before {
	content: '';
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #1d6970;
	animation: dd-tsumugi-pulse 1s ease-in-out infinite;
}

.dd-tsumugi__reply {
	display: block;
	white-space: pre-wrap;
	word-break: break-word;
}

@keyframes dd-tsumugi-pulse {
	0%, 100% { opacity: 0.35; transform: scale(0.9); }
	50% { opacity: 1; transform: scale(1); }
}

.dd-tsumugi__message--visitor {
	align-self: flex-end;
	background: #173b58;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.dd-tsumugi__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 10px;
}

.dd-tsumugi__chips button {
	border: 1px solid #d7e5e1;
	border-radius: 999px;
	background: #fff;
	color: #386273;
	padding: 7px 9px;
	font-size: 0.68rem;
	cursor: pointer;
	white-space: nowrap;
}

.dd-tsumugi__form {
	display: flex;
	gap: 7px;
}

.dd-tsumugi__form input {
	min-width: 0;
	flex: 1;
	border: 1px solid #cddddb;
	border-radius: 10px;
	padding: 10px;
	color: #1d4054;
	font: inherit;
	font-size: 0.78rem;
}

.dd-tsumugi__form button {
	border: 0;
	border-radius: 10px;
	background: #1d6970;
	color: #fff;
	padding: 0 14px;
	font: inherit;
	font-size: 0.76rem;
	font-weight: 700;
	cursor: pointer;
	flex-shrink: 0;
}

.dd-tsumugi__notice {
	margin: 10px 1px 0;
	color: #7b8e98;
	font-size: 0.62rem;
	line-height: 1.55;
}

.dd-tsumugi__line {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
	padding: 10px;
	border: 1px solid #d7ebe4;
	border-radius: 12px;
	background: #f7fbf9;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dd-tsumugi__line.is-highlighted {
	border-color: #06c755;
	box-shadow: 0 0 0 2px rgba(6, 199, 85, 0.15);
}

.dd-tsumugi__line img {
	width: 72px;
	height: 72px;
	border-radius: 8px;
	flex-shrink: 0;
}

.dd-tsumugi__line p {
	margin: 0 0 4px;
	color: #3d5f6e;
	font-size: 0.68rem;
	line-height: 1.5;
}

.dd-tsumugi__line a {
	color: #06a54a;
	font-size: 0.72rem;
	font-weight: 700;
	text-decoration: none;
}

.dd-tsumugi__line a:hover,
.dd-tsumugi__line a:focus {
	text-decoration: underline;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 767px) {
	.dd-tsumugi {
		right: 14px;
		bottom: max(
			74px,
			calc(var(--bottom-share-height, 0px) + env(safe-area-inset-bottom) + 64px)
		);
	}

	.dd-tsumugi__launcher {
		padding-right: 13px;
	}

	.dd-tsumugi__launcher img {
		width: 48px;
		height: 48px;
	}

	.dd-tsumugi__panel {
		padding: 14px;
		border-radius: 18px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.dd-tsumugi * {
		scroll-behavior: auto;
	}
}
