.tdh-root {
	--tdh-gold: #c39f65;
	--tdh-gold-lt: #e1bc7e;
	--tdh-gold-dk: #a8854e;
	--tdh-ink: #1a1a1a;
	--tdh-dim: #6b6b6b;
	--tdh-bg: #f8f8f8;
	--tdh-line: rgba(195, 159, 101, 0.28);
	--tdh-radius: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
		"Hiragino Sans", "Microsoft JhengHei", sans-serif;
}

.tdh-root *,
.tdh-root *::before,
.tdh-root *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------- launcher */

.tdh-launcher {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--tdh-gold-lt) 0%, var(--tdh-gold) 58%, var(--tdh-gold-dk) 100%);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
	color: #fff;
	cursor: pointer;
	transition: transform 0.22s ease, box-shadow 0.22s ease;
	-webkit-tap-highlight-color: transparent;
}

.tdh-launcher::after {
	content: "";
	position: absolute;
	inset: 4px;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.35);
	pointer-events: none;
}

.tdh-launcher:hover,
.tdh-launcher:focus-visible {
	transform: translateY(-3px);
	box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26), 0 3px 8px rgba(0, 0, 0, 0.14);
	outline: none;
}

.tdh-launcher:focus-visible {
	box-shadow: 0 0 0 3px rgba(195, 159, 101, 0.45), 0 16px 34px rgba(0, 0, 0, 0.26);
}

.tdh-launcher svg {
	width: 30px;
	height: 30px;
	display: block;
}

.tdh-launcher .tdh-ico-close {
	display: none;
}

.tdh-root.is-open .tdh-launcher .tdh-ico-door {
	display: none;
}

.tdh-root.is-open .tdh-launcher .tdh-ico-close {
	display: block;
}

/* A single slow halo, so the button reads as live without nagging. */
.tdh-halo {
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: 2px solid var(--tdh-gold);
	animation: tdh-halo 2.6s ease-out 1.1s 2;
	pointer-events: none;
}

@keyframes tdh-halo {
	0% {
		opacity: 0.55;
		transform: scale(1);
	}
	100% {
		opacity: 0;
		transform: scale(1.6);
	}
}

.tdh-root.is-open .tdh-halo,
.tdh-root.is-touched .tdh-halo {
	display: none;
}

/* ------------------------------------------------------------- panel */

.tdh-panel {
	position: fixed;
	right: 24px;
	bottom: 100px;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	width: 384px;
	max-width: calc(100vw - 32px);
	height: min(624px, calc(100vh - 140px));
	overflow: hidden;
	border: 1px solid var(--tdh-line);
	border-radius: var(--tdh-radius);
	background: #fff;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
	opacity: 0;
	transform: translateY(12px) scale(0.97);
	transform-origin: 100% 100%;
	visibility: hidden;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.tdh-root.is-open .tdh-panel {
	opacity: 1;
	transform: none;
	visibility: visible;
}

.tdh-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(120deg, var(--tdh-gold-lt) 0%, var(--tdh-gold) 62%, var(--tdh-gold-dk) 100%);
	color: #fff;
}

.tdh-head-mark {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 11px;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.3);
}

.tdh-head-mark svg {
	width: 22px;
	height: 22px;
}

.tdh-head-text {
	min-width: 0;
	flex: 1 1 auto;
}

.tdh-head-title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1.3;
}

.tdh-head-sub {
	margin: 2px 0 0;
	font-size: 11.5px;
	line-height: 1.4;
	opacity: 0.88;
}

.tdh-x {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	transition: background 0.18s ease;
}

.tdh-x:hover,
.tdh-x:focus-visible {
	background: rgba(255, 255, 255, 0.32);
	outline: none;
}

.tdh-x svg {
	width: 16px;
	height: 16px;
}

/* ------------------------------------------------------------- log */

.tdh-log {
	flex: 1 1 auto;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 16px;
	background: var(--tdh-bg);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.tdh-log::-webkit-scrollbar {
	width: 8px;
}

.tdh-log::-webkit-scrollbar-thumb {
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.14);
}

.tdh-row {
	display: flex;
	max-width: 100%;
}

.tdh-row.is-user {
	justify-content: flex-end;
}

.tdh-bubble {
	max-width: 88%;
	padding: 11px 14px;
	border-radius: 15px 15px 15px 5px;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.06);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	color: var(--tdh-ink);
	font-size: 14px;
	line-height: 1.78;
	word-break: break-word;
}

.tdh-row.is-user .tdh-bubble {
	border-radius: 15px 15px 5px 15px;
	border-color: transparent;
	background: linear-gradient(125deg, var(--tdh-gold-lt), var(--tdh-gold));
	color: #fff;
	box-shadow: 0 2px 8px rgba(195, 159, 101, 0.3);
}

.tdh-bubble p {
	margin: 0 0 0.6em;
}

.tdh-bubble p:last-child,
.tdh-bubble ul:last-child,
.tdh-bubble ol:last-child {
	margin-bottom: 0;
}

.tdh-bubble ul,
.tdh-bubble ol {
	margin: 0 0 0.6em;
	padding-left: 1.25em;
}

.tdh-bubble li {
	margin: 0 0 0.25em;
}

.tdh-bubble strong {
	font-weight: 600;
	color: var(--tdh-gold-dk);
}

.tdh-row.is-user .tdh-bubble strong {
	color: #fff;
}

.tdh-bubble a {
	color: var(--tdh-gold-dk);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.tdh-note {
	margin: 0 0 8px;
	padding: 0 0 8px;
	border-bottom: 1px dashed var(--tdh-line);
	color: var(--tdh-dim);
	font-size: 12.5px;
	line-height: 1.6;
}

.tdh-q {
	margin: 0 0 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--tdh-gold-dk);
	line-height: 1.5;
}

/* ------------------------------------------------------------- chips */

.tdh-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.tdh-chips-label {
	width: 100%;
	margin: 2px 0 2px;
	color: var(--tdh-dim);
	font-size: 12px;
}

.tdh-chip {
	max-width: 100%;
	padding: 7px 12px;
	border: 1px solid var(--tdh-line);
	border-radius: 999px;
	background: #fff;
	color: var(--tdh-gold-dk);
	font-family: inherit;
	font-size: 12.5px;
	line-height: 1.4;
	text-align: left;
	cursor: pointer;
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.tdh-chip:hover,
.tdh-chip:focus-visible {
	background: var(--tdh-gold);
	border-color: var(--tdh-gold);
	color: #fff;
	outline: none;
}

.tdh-links {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 10px;
}

.tdh-link {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 12px;
	border: 1px solid var(--tdh-line);
	border-radius: 10px;
	background: rgba(195, 159, 101, 0.08);
	color: var(--tdh-gold-dk);
	font-size: 12.5px;
	font-weight: 500;
	text-decoration: none;
	transition: background 0.16s ease;
}

.tdh-link:hover {
	background: rgba(195, 159, 101, 0.2);
	color: var(--tdh-gold-dk);
	text-decoration: none;
}

.tdh-link::after {
	content: "›";
	font-size: 15px;
	line-height: 1;
}

.tdh-contact {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 10px;
}

.tdh-contact .tdh-link {
	justify-content: center;
	padding: 10px 12px;
	background: var(--tdh-gold);
	border-color: var(--tdh-gold);
	color: #fff;
	font-size: 13px;
}

.tdh-contact .tdh-link:hover {
	background: var(--tdh-gold-dk);
	color: #fff;
}

/* ------------------------------------------------------------- feedback */

.tdh-rate {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 12px;
	padding-top: 10px;
	border-top: 1px dashed var(--tdh-line);
	color: var(--tdh-dim);
	font-size: 12px;
}

.tdh-rate-btn {
	padding: 5px 11px;
	border: 1px solid var(--tdh-line);
	border-radius: 999px;
	background: #fff;
	color: var(--tdh-dim);
	font-family: inherit;
	font-size: 12px;
	cursor: pointer;
}

.tdh-rate-btn:hover,
.tdh-rate-btn:focus-visible {
	border-color: var(--tdh-gold);
	color: var(--tdh-gold-dk);
	outline: none;
}

.tdh-thanks {
	margin-top: 10px;
	color: var(--tdh-dim);
	font-size: 12px;
}

/* ------------------------------------------------------------- typing */

.tdh-typing {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--tdh-dim);
	font-size: 12.5px;
}

.tdh-dots {
	display: inline-flex;
	gap: 3px;
}

.tdh-dots i {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--tdh-gold);
	animation: tdh-bounce 1.1s infinite ease-in-out;
}

.tdh-dots i:nth-child(2) {
	animation-delay: 0.16s;
}

.tdh-dots i:nth-child(3) {
	animation-delay: 0.32s;
}

@keyframes tdh-bounce {
	0%,
	70%,
	100% {
		opacity: 0.3;
		transform: translateY(0);
	}
	35% {
		opacity: 1;
		transform: translateY(-3px);
	}
}

/* ------------------------------------------------------------- lead form */

.tdh-form {
	margin-top: 10px;
	padding: 12px;
	border: 1px solid var(--tdh-line);
	border-radius: 12px;
	background: rgba(195, 159, 101, 0.06);
}

.tdh-form h4 {
	margin: 0 0 4px;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--tdh-gold-dk);
}

.tdh-form p {
	margin: 0 0 10px;
	color: var(--tdh-dim);
	font-size: 12px;
	line-height: 1.6;
}

.tdh-field {
	margin-bottom: 8px;
}

.tdh-field label {
	display: block;
	margin-bottom: 3px;
	color: var(--tdh-dim);
	font-size: 11.5px;
}

.tdh-field input,
.tdh-field select,
.tdh-field textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	background: #fff;
	color: var(--tdh-ink);
	font-family: inherit;
	font-size: 13px;
	line-height: 1.5;
}

.tdh-field textarea {
	min-height: 62px;
	resize: vertical;
}

.tdh-field input:focus,
.tdh-field select:focus,
.tdh-field textarea:focus {
	border-color: var(--tdh-gold);
	outline: none;
	box-shadow: 0 0 0 3px rgba(195, 159, 101, 0.16);
}

.tdh-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.tdh-submit {
	width: 100%;
	padding: 10px;
	border: 0;
	border-radius: 9px;
	background: linear-gradient(125deg, var(--tdh-gold-lt), var(--tdh-gold));
	color: #fff;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.tdh-submit:hover,
.tdh-submit:focus-visible {
	background: var(--tdh-gold-dk);
	outline: none;
}

.tdh-submit[disabled] {
	opacity: 0.6;
	cursor: default;
}

.tdh-err {
	margin: 6px 0 0;
	color: #b3261e;
	font-size: 12px;
}

/* ------------------------------------------------------------- composer */

.tdh-foot {
	flex: 0 0 auto;
	padding: 10px 12px 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.07);
	background: #fff;
}

.tdh-compose {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.tdh-input {
	flex: 1 1 auto;
	max-height: 110px;
	padding: 10px 12px;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 14px;
	background: var(--tdh-bg);
	color: var(--tdh-ink);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.5;
	resize: none;
	overflow-y: auto;
}

.tdh-input:focus {
	border-color: var(--tdh-gold);
	background: #fff;
	outline: none;
	box-shadow: 0 0 0 3px rgba(195, 159, 101, 0.16);
}

.tdh-send {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--tdh-gold-lt), var(--tdh-gold));
	color: #fff;
	cursor: pointer;
	transition: transform 0.16s ease, opacity 0.16s ease;
}

.tdh-send:hover:not([disabled]) {
	transform: scale(1.06);
}

.tdh-send[disabled] {
	opacity: 0.45;
	cursor: default;
}

.tdh-send svg {
	width: 17px;
	height: 17px;
}

.tdh-privacy {
	margin: 7px 2px 0;
	color: #9a9a9a;
	font-size: 10.5px;
	text-align: center;
	line-height: 1.4;
}

.tdh-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 600px) {
	.tdh-panel {
		right: 0;
		bottom: 0;
		left: 0;
		top: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		border: 0;
		border-radius: 0;
		transform: translateY(16px);
	}

	.tdh-head {
		padding-top: max(16px, env(safe-area-inset-top));
	}

	.tdh-foot {
		padding-bottom: max(8px, env(safe-area-inset-bottom));
	}

	.tdh-launcher {
		right: 16px;
		bottom: 16px;
		width: 56px;
		height: 56px;
	}

	.tdh-launcher svg {
		width: 27px;
		height: 27px;
	}

	.tdh-bubble {
		max-width: 92%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tdh-root *,
	.tdh-root *::before,
	.tdh-root *::after {
		animation: none !important;
		transition: none !important;
	}
}
