/* ==========================================================================
   Tamagotchi Helfer
   Optik passend zum GGAS-Designsystem "Foil & Paper" (claude-overrides.css).
   Nutzt dessen Tokens (--c-*, --r-*, --shadow-*, --dur-*, --ease-*), damit
   Light- und Darkmode (html.gg-halloween) automatisch mitgehen.
   Die Werte nach dem Komma sind Fallbacks, falls das Theme nicht geladen ist.
   ========================================================================== */
.tmgh {
	--tmgh-wd: 260px;
	--tmgh-wm: 180px;
	--tmgh-k: 1;                                  /* Skalierung auf großen Bildschirmen */
	--tmgh-w: calc(var(--tmgh-wd) * var(--tmgh-k));
	--tmgh-b: 16px;
	--tmgh-s: 16px;
	--tmgh-edge: var(--tmgh-s);                   /* tatsächlicher Seitenabstand (Breitbild: an Inhaltsbreite ausgerichtet) */
	--tmgh-vh: 100vh;                             /* sichtbare Höhe; per JS aus visualViewport (Tastatur!) */
	--tmgh-kb: 0px;                               /* Höhe der Bildschirmtastatur (per JS) */
	--tmgh-safe-t: env(safe-area-inset-top, 0px);
	--tmgh-safe-r: env(safe-area-inset-right, 0px);
	--tmgh-safe-b: env(safe-area-inset-bottom, 0px);
	--tmgh-safe-l: env(safe-area-inset-left, 0px);
	--tmgh-chat-max: 580px;

	--t-surface: var(--c-surface, #ffffff);
	--t-surface-2: var(--c-surface-2, #f5f0f1);
	--t-surface-3: var(--c-surface-3, #ece4e7);
	--t-line: var(--c-line, rgba(43, 22, 38, .10));
	--t-line-2: var(--c-line-2, rgba(43, 22, 38, .18));
	--t-ink: var(--c-ink, #1c1420);
	--t-ink-2: var(--c-ink-2, #4b3f50);
	--t-ink-3: var(--c-ink-3, #6b5f71);
	--t-accent: var(--c-accent, #d0216b);
	--t-accent-hover: var(--c-accent-hover, #b31a5b);
	--t-accent-soft: var(--c-accent-soft, #fce8f0);
	--t-accent-line: var(--c-accent-line, rgba(208, 33, 107, .28));
	--t-accent-ink: var(--c-accent-ink, #ffffff);
	--t-accent-text: var(--c-accent-text, #b31a5b);
	--t-self: var(--c-chat-self, #d0216b);
	--t-self-ink: var(--c-chat-self-ink, #ffffff);
	--t-success: var(--c-success, #15784e);
	--t-warning: var(--c-warning, #94570a);
	--t-danger: var(--c-danger, #c0283a);
	--t-danger-soft: var(--c-danger-soft, #fdeaec);
	--t-focus: var(--c-focus, #d0216b);
	--t-shadow-1: var(--shadow-1, 0 1px 2px rgba(40, 16, 34, .06), 0 1px 1px rgba(40, 16, 34, .04));
	--t-shadow-2: var(--shadow-2, 0 2px 6px rgba(40, 16, 34, .05), 0 10px 28px -8px rgba(40, 16, 34, .12));
	--t-shadow-3: var(--shadow-3, 0 8px 20px rgba(40, 16, 34, .08), 0 30px 60px -18px rgba(40, 16, 34, .22));
	--t-r-sm: var(--r-sm, 10px);
	--t-r-md: var(--r-md, 14px);
	--t-r-lg: var(--r-lg, 20px);
	--t-r-xl: var(--r-xl, 28px);
	--t-font: var(--font-sans, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
	--t-pixel: var(--font-pixel, ui-monospace, "Cascadia Mono", Consolas, monospace);
	--t-dur-1: var(--dur-1, 120ms);
	--t-dur-2: var(--dur-2, 220ms);
	--t-dur-3: var(--dur-3, 420ms);
	--t-ease: var(--ease-out, cubic-bezier(.2, .8, .2, 1));
	--t-spring: var(--ease-spring, cubic-bezier(.34, 1.4, .64, 1));

	position: fixed;
	bottom: calc(var(--tmgh-b) + var(--tmgh-safe-b));
	z-index: 99990;
	font: 400 15px/1.45 var(--t-font);
	color: var(--t-ink);
	text-align: left;
	-webkit-font-smoothing: antialiased;
}

/* Darkmode-Fallback, falls die Theme-Tokens fehlen */
html.gg-halloween .tmgh {
	--t-surface: var(--c-surface, #16121d);
	--t-surface-2: var(--c-surface-2, #1d1826);
	--t-surface-3: var(--c-surface-3, #282133);
	--t-line: var(--c-line, rgba(235, 220, 255, .09));
	--t-line-2: var(--c-line-2, rgba(235, 220, 255, .17));
	--t-ink: var(--c-ink, #f4effa);
	--t-ink-2: var(--c-ink-2, #cdc3d8);
	--t-ink-3: var(--c-ink-3, #a096ad);
	--t-accent: var(--c-accent, #c4a5ff);
	--t-accent-hover: var(--c-accent-hover, #d8c3ff);
	--t-accent-soft: var(--c-accent-soft, rgba(176, 140, 255, .14));
	--t-accent-line: var(--c-accent-line, rgba(196, 165, 255, .36));
	--t-accent-ink: var(--c-accent-ink, #170d26);
	--t-accent-text: var(--c-accent-text, #cfb6ff);
	--t-self: var(--c-chat-self, #6f45d1);
	--t-success: var(--c-success, #56d6a0);
	--t-warning: var(--c-warning, #f2b85a);
	--t-danger: var(--c-danger, #ff7b8b);
	--t-danger-soft: var(--c-danger-soft, rgba(255, 123, 139, .12));
	--t-focus: var(--c-focus, #c4a5ff);
	--t-shadow-1: var(--shadow-1, 0 1px 2px rgba(0, 0, 0, .4));
	--t-shadow-2: var(--shadow-2, 0 2px 6px rgba(0, 0, 0, .35), 0 12px 30px -10px rgba(0, 0, 0, .6));
	--t-shadow-3: var(--shadow-3, 0 10px 24px rgba(0, 0, 0, .45), 0 30px 70px -20px rgba(0, 0, 0, .7));
}

@supports (height: 100dvh) {
	.tmgh { --tmgh-vh: 100dvh; }
}
/* Ultrawide (21:9 / 32:9): am Inhaltsbereich statt am äußersten Bildschirmrand ausrichten */
.tmgh.is-boxed { --tmgh-edge: max(var(--tmgh-s), calc((100vw - var(--tmgh-maxw, 100vw)) / 2 + var(--tmgh-s))); }
/* Bei offener Tastatur (z. B. Chat im Querformat) über die Tastatur schieben */
.tmgh.is-chat { bottom: calc(var(--tmgh-b) + max(var(--tmgh-safe-b), var(--tmgh-kb))); }

.tmgh-right { right: calc(var(--tmgh-edge) + var(--tmgh-safe-r)); }
.tmgh-left { left: calc(var(--tmgh-edge) + var(--tmgh-safe-l)); }
.tmgh *, .tmgh *::before, .tmgh *::after { box-sizing: border-box; }
.tmgh [hidden] { display: none !important; }

/* Theme-/Button-Styles des Shops neutralisieren (.button-Pseudoelemente etc.) */
.tmgh button, .tmgh input {
	margin: 0;
	font: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-shadow: none;
	box-shadow: none;
	min-height: 0;
	min-width: 0;
	width: auto;
	height: auto;
	line-height: 1.2;
}
.tmgh button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tmgh button::before, .tmgh button::after { content: none; }
.tmgh button:focus-visible, .tmgh a:focus-visible {
	outline: none;
	box-shadow: 0 0 0 2px var(--t-surface), 0 0 0 4px var(--t-focus);
}

/* ---------- Gerät ---------- */
.tmgh-device {
	position: relative;
	width: var(--tmgh-w);
	aspect-ratio: 1412 / 1114;
	transform-origin: 50% 3%;
	animation: tmgh-swing 7s ease-in-out infinite;
	filter: drop-shadow(0 10px 18px rgba(40, 16, 34, .28));
	transition: width var(--t-dur-3) var(--t-ease);
	user-select: none;
	-webkit-user-select: none;
	touch-action: manipulation;
}
html.gg-halloween .tmgh-device { filter: drop-shadow(0 10px 22px rgba(150, 90, 255, .35)); }
.tmgh-device > img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	pointer-events: none;
	-webkit-user-drag: none;
}
/* Notfall-Optik, falls das Gerätebild nicht geladen werden kann */
.tmgh-device.is-noimg > img { visibility: hidden; }
.tmgh-device.is-noimg::before {
	content: "";
	position: absolute;
	inset: 22% 24% 8%;
	border-radius: 34% 34% 42% 42%;
	background: linear-gradient(160deg, #ffb347, #ff7a1a 55%, #e8590c);
	box-shadow: 0 0 0 5px #e0217a, inset 0 -6px 12px rgba(0, 0, 0, .2);
}
.tmgh-device.is-noimg .tmgh-lcd { background: #b9d6a6; border-radius: 6px; box-shadow: 0 0 0 3px #e0217a; }
.tmgh-device.is-noimg .tmgh-btn { background: radial-gradient(circle at 35% 30%, #fff, #b9b9c4 55%, #6d6d7a); }

.tmgh-lcd {
	position: absolute;
	left: 37.4%;
	top: 37.8%;
	width: 23.2%;
	height: 24.2%;
	image-rendering: pixelated;
	image-rendering: crisp-edges;
	cursor: pointer;
}
.tmgh .tmgh-btn {
	position: absolute;
	width: 8%;
	aspect-ratio: 1;
	height: auto;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	transform: translate(-50%, -50%);
	transition: background var(--t-dur-1);
}
.tmgh .tmgh-btn.is-down,
.tmgh .tmgh-btn:active {
	background: radial-gradient(circle, rgba(0, 0, 0, .45) 0, rgba(0, 0, 0, .2) 55%, transparent 72%);
}
.tmgh-b1 { left: 37.4%; top: 71.4%; }
.tmgh-b2 { left: 48.9%; top: 74.2%; }
.tmgh-b3 { left: 60.2%; top: 71.4%; }
.tmgh-tip {
	position: absolute;
	top: 116%;
	left: 50%;
	padding: 4px 9px;
	border-radius: 999px;
	background: var(--t-ink);
	color: var(--t-surface);
	font: 650 11px/1.3 var(--t-font);
	white-space: nowrap;
	box-shadow: var(--t-shadow-2);
	opacity: 0;
	transform: translate(-50%, 4px);
	pointer-events: none;
	transition: opacity var(--t-dur-2) var(--t-ease), transform var(--t-dur-2) var(--t-ease);
}
.tmgh-btn:hover .tmgh-tip,
.tmgh-btn:focus-visible .tmgh-tip,
.tmgh-device.is-hint .tmgh-tip { opacity: 1; transform: translate(-50%, 0); }

.tmgh .tmgh-min {
	position: absolute;
	top: 17%;
	right: 9%;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 1px solid var(--t-line-2);
	border-radius: 50%;
	background: var(--t-surface);
	color: var(--t-ink);
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	box-shadow: var(--t-shadow-2);
	opacity: 0;
	transition: opacity var(--t-dur-2), transform var(--t-dur-2) var(--t-spring);
}
.tmgh .tmgh-min:hover { transform: scale(1.08); }
.tmgh-device:hover .tmgh-min,
.tmgh .tmgh-min:focus-visible { opacity: 1; }
@media (hover: none) { .tmgh .tmgh-min { opacity: .9; } }

.tmgh .tmgh-open {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: transparent;
}

/* Minimiert */
.tmgh.is-min .tmgh-device { width: calc(92px * var(--tmgh-k)); }

/* Spielmodus: Gerät wird groß (begrenzt durch Bildschirmbreite und -höhe) */
.tmgh.is-playing .tmgh-device {
	width: min(
		calc(var(--tmgh-wplay, 460px) * var(--tmgh-k)),
		calc(100vw - 2 * var(--tmgh-edge) - var(--tmgh-safe-l) - var(--tmgh-safe-r)),
		calc((var(--tmgh-vh) - var(--tmgh-b) - var(--tmgh-safe-b) - var(--tmgh-safe-t) - var(--header-h, 0px) - 40px) * 1.267)
	);
	animation: none;
	transform: none;
}
.tmgh.is-playing .tmgh-lcd { cursor: default; }
.tmgh.is-playing .tmgh-device {
	touch-action: none;           /* beim Ziehen nicht die Seite scrollen */
	-webkit-touch-callout: none;
	cursor: ew-resize;
}
.tmgh.is-playing .tmgh-min { display: none; }

/* Beenden-Knopf im Spiel */
.tmgh .tmgh-quit {
	position: absolute;
	top: 14%;
	right: 7%;
	display: none;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--t-line-2);
	border-radius: 50%;
	background: var(--t-surface);
	color: var(--t-ink);
	font-size: 18px;
	font-weight: 700;
	box-shadow: var(--t-shadow-2);
}
.tmgh.is-playing .tmgh-quit { display: grid; }

/* Touch-Geräte: die echten Knöpfe sind zu klein -> Tippen aufs Gerät öffnet ein Menü */
.tmgh.is-touch .tmgh-btn { pointer-events: none; }
.tmgh.is-touch .tmgh-tip { display: none; }
.tmgh.is-touch .tmgh-device { cursor: pointer; }
.tmgh.is-touch .tmgh-min { width: 34px; height: 34px; font-size: 18px; opacity: .95; }

.tmgh-menu {
	position: absolute;
	bottom: calc(100% + 6px);
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	width: min(300px, calc(100vw - 2 * var(--tmgh-edge) - var(--tmgh-safe-l) - var(--tmgh-safe-r)));
	max-height: calc(var(--tmgh-vh) - var(--tmgh-w) * .79 - var(--tmgh-b) - var(--tmgh-safe-b) - 16px);
	overflow-y: auto;
	padding: 10px;
	border-radius: var(--t-r-lg);
	background: var(--t-surface);
	box-shadow: var(--t-shadow-3), inset 0 0 0 1px var(--t-line);
	animation: tmgh-pop var(--t-dur-3) var(--t-ease) both;
}
.tmgh-right .tmgh-menu { right: 0; }
.tmgh-left .tmgh-menu { left: 0; }
.tmgh .tmgh-menu-btn {
	min-height: 52px;
	padding: 0 12px;
	border: 0;
	border-radius: var(--t-r-md);
	background: var(--t-surface-2);
	color: var(--t-ink);
	font-size: 15px;
	font-weight: 650;
	box-shadow: inset 0 0 0 1px var(--t-line);
	transition: background-color var(--t-dur-2), transform var(--t-dur-1);
}
.tmgh .tmgh-menu-btn:active { transform: scale(.96); background: var(--t-accent-soft); color: var(--t-accent-text); }
.tmgh.is-min .tmgh-menu,
.tmgh.is-playing .tmgh-menu { display: none !important; }
.tmgh.is-playing .tmgh-bubble {
	left: 0;
	right: 0;
	bottom: calc(100% + 4px);
	margin: 0 auto;
	max-width: min(320px, 90%);
	text-align: center;
	border-radius: 18px;
}
.tmgh.is-playing .tmgh-tip { font-size: 13px; padding: 5px 12px; }
.tmgh.is-min .tmgh-btn,
.tmgh.is-min .tmgh-min,
.tmgh.is-min .tmgh-chat,
.tmgh.is-min .tmgh-bubble { display: none !important; }

.tmgh-device.is-shake { animation: tmgh-shake .5s ease-in-out 2; }

@keyframes tmgh-swing {
	0%, 100% { transform: rotate(-1.6deg); }
	50% { transform: rotate(1.6deg); }
}
@keyframes tmgh-shake {
	0%, 100% { transform: rotate(0); }
	20% { transform: rotate(-7deg); }
	40% { transform: rotate(6deg); }
	60% { transform: rotate(-4deg); }
	80% { transform: rotate(3deg); }
}
@keyframes tmgh-pop {
	from { opacity: 0; transform: translateY(10px) scale(.98); }
	to { opacity: 1; transform: none; }
}
@keyframes tmgh-msg {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

/* ---------- Sprechblase ---------- */
.tmgh-bubble {
	position: absolute;
	bottom: 52%;
	width: max-content;
	max-width: 230px;
	padding: 10px 14px;
	border-radius: 18px;
	background: var(--t-surface);
	color: var(--t-ink);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	box-shadow: var(--t-shadow-3), inset 0 0 0 1px var(--t-line);
	cursor: pointer;
	animation: tmgh-pop var(--t-dur-3) var(--t-ease) both;
}
.tmgh-right .tmgh-bubble { right: calc(100% - 14px); border-bottom-right-radius: 6px; }
.tmgh-left .tmgh-bubble { left: calc(100% - 14px); border-bottom-left-radius: 6px; }

/* ---------- Chat (wie .ggas-chat-card) ---------- */
.tmgh-chat {
	position: absolute;
	bottom: calc(100% + 8px);
	display: flex;
	flex-direction: column;
	width: min(380px, calc(100vw - 2 * var(--tmgh-edge) - var(--tmgh-safe-l) - var(--tmgh-safe-r)));
	max-height: min(var(--tmgh-chat-max), calc(var(--tmgh-vh) - var(--tmgh-w) * .79 - var(--tmgh-b) - var(--tmgh-safe-b) - var(--tmgh-safe-t) - var(--header-h, 0px) - 24px));
	overflow: hidden;
	border: 1px solid var(--t-line);
	border-radius: var(--t-r-xl);
	background: var(--t-surface);
	box-shadow: var(--t-shadow-3);
	transform-origin: bottom right;
	animation: tmgh-pop var(--t-dur-3) var(--t-ease) both;
}
.tmgh-right .tmgh-chat { right: 0; }
.tmgh-left .tmgh-chat { left: 0; transform-origin: bottom left; }

/* Kopf (wie .gg-support-chat-heading) */
.tmgh-head, .tmgh-stats, .tmgh-chips, .tmgh-form { flex-shrink: 0; }
.tmgh-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px 12px 16px;
	border-bottom: 1px solid var(--t-line);
	background: var(--t-surface-2);
}
.tmgh-avatar {
	flex: none;
	width: 40px !important;
	height: 40px !important;
	padding: 7px 4px;
	border-radius: 50%;
	background: #b9d6a6;
	box-shadow: inset 0 0 0 2px var(--t-ink), 0 0 0 2px var(--t-surface-2);
	image-rendering: pixelated;
}
.tmgh-title { flex: 1; min-width: 0; }
.tmgh-title strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--t-ink); }
.tmgh-title span { display: block; margin-top: 2px; color: var(--t-ink-3); font-size: 12px; }
/* Sprachumschalter (wie .gg-language-switch im Header) */
.tmgh-lang {
	flex: none;
	display: inline-flex;
	gap: 2px;
	padding: 3px;
	border-radius: 999px;
	background: var(--t-surface-3);
}
.tmgh .tmgh-lang button {
	min-width: 30px;
	height: 26px;
	padding: 0 7px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--t-ink-3);
	font-size: 11px;
	font-weight: 750;
	letter-spacing: .04em;
	transition: background-color var(--t-dur-2), color var(--t-dur-2);
}
.tmgh .tmgh-lang button:hover { color: var(--t-ink); }
.tmgh .tmgh-lang button[aria-pressed="true"] {
	background: var(--t-surface);
	color: var(--t-ink);
	box-shadow: var(--t-shadow-1);
}

.tmgh .tmgh-x {
	flex: none;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--t-line);
	border-radius: 50%;
	background: var(--t-surface);
	color: var(--t-ink-2);
	transition: transform var(--t-dur-2) var(--t-spring), color var(--t-dur-2), border-color var(--t-dur-2);
}
.tmgh .tmgh-x:hover { color: var(--t-ink); border-color: var(--t-line-2); transform: rotate(90deg); }

/* Status-Balken */
.tmgh-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	padding: 9px 16px;
	border-bottom: 1px solid var(--t-line);
	background: var(--t-surface);
	font-size: 12px;
}
.tmgh-stat { display: flex; align-items: center; gap: 6px; }
.tmgh-stat i {
	position: relative;
	flex: 1;
	height: 6px;
	overflow: hidden;
	border-radius: 999px;
	background: var(--t-surface-3);
}
.tmgh-stat b {
	position: absolute;
	inset: 0 auto 0 0;
	border-radius: 999px;
	background: var(--t-success);
	transition: width var(--t-dur-3) var(--t-ease), background-color var(--t-dur-2);
}
.tmgh-stat b.is-mid { background: var(--t-warning); }
.tmgh-stat b.is-low { background: var(--t-danger); }

/* Verlauf (wie .gg-support-thread) */
.tmgh-log {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-height: min(140px, calc(var(--tmgh-vh) * .18));
	overflow-y: auto;
	padding: 14px 14px 16px;
	overscroll-behavior: contain;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: var(--t-line-2) transparent;
	background:
		radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--t-ink) 6%, transparent) 1px, transparent 1.4px) 0 0 / 18px 18px,
		var(--t-surface);
}
.tmgh-msg {
	display: flex;
	flex-direction: column;
	max-width: 86%;
	margin-top: 10px;
	animation: tmgh-msg var(--t-dur-3) var(--t-ease) both;
}
.tmgh-msg:first-child { margin-top: 0; }
.tmgh-msg:has(.tmgh-cards) { width: 92%; max-width: 92%; }
.tmgh-msg > div { min-width: 0; }
.tmgh-bot { align-self: flex-start; }
.tmgh-user { align-self: flex-end; }
.tmgh-msg > div {
	padding: 9px 14px;
	border-radius: 18px;
	font-size: 14.5px;
	line-height: 1.45;
	overflow-wrap: anywhere;
}
.tmgh-bot > div {
	background: var(--t-surface-2);
	color: var(--t-ink);
	border-bottom-left-radius: 6px;
	box-shadow: 0 1px 1px rgba(30, 10, 30, .04), inset 0 0 0 1px var(--t-line);
}
.tmgh-user > div {
	background: var(--t-self);
	color: var(--t-self-ink);
	border-bottom-right-radius: 6px;
	box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--t-self) 70%, transparent);
}
/* Folgenachrichten desselben Absenders kompakt gruppieren */
.tmgh-bot + .tmgh-bot, .tmgh-user + .tmgh-user { margin-top: 3px; }
.tmgh-bot + .tmgh-bot > div { border-top-left-radius: 6px; }
.tmgh-user + .tmgh-user > div { border-top-right-radius: 6px; }
.tmgh-bot:has(+ .tmgh-bot) > div { border-bottom-left-radius: 18px; }
.tmgh-user:has(+ .tmgh-user) > div { border-bottom-right-radius: 18px; }

.tmgh-msg a { color: var(--t-accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.tmgh-msg a:hover { color: var(--t-accent-hover); }
.tmgh-user a { color: inherit; }
.tmgh-msg small { color: var(--t-ink-3); }

.tmgh-typing > div { display: inline-flex; gap: 4px; padding: 12px 14px; }
.tmgh-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--t-ink-3);
	opacity: .45;
	animation: tmgh-dot 1s infinite;
}
.tmgh-typing span:nth-child(2) { animation-delay: .15s; }
.tmgh-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tmgh-dot { 50% { opacity: 1; transform: translateY(-3px); } }

/* Produktkarten im Chat */
.tmgh-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 8px; }
.tmgh .tmgh-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 10px 6px 6px;
	border-radius: var(--t-r-md);
	background: var(--t-surface);
	color: var(--t-ink);
	text-decoration: none;
	box-shadow: var(--t-shadow-1), inset 0 0 0 1px var(--t-line);
	transition: transform var(--t-dur-2) var(--t-ease), box-shadow var(--t-dur-2) var(--t-ease);
}
.tmgh .tmgh-card:hover {
	color: var(--t-ink);
	transform: translateY(-2px);
	box-shadow: var(--t-shadow-2), inset 0 0 0 1px var(--t-accent-line);
}
.tmgh-card img {
	flex: none;
	width: 48px !important;
	height: 48px !important;
	object-fit: cover;
	border-radius: var(--t-r-sm);
	background: var(--t-surface-2);
}
.tmgh-card-t { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.tmgh-card-t strong { display: block; overflow: hidden; color: var(--t-ink); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.tmgh-card-t em { font-style: normal; font-weight: 700; color: var(--t-accent-text); }
.tmgh-card-t em del { color: var(--t-ink-3); font-weight: 400; opacity: 1; }
.tmgh-card-t em ins { text-decoration: none; }
.tmgh-card-t small {
	display: inline-block;
	margin-top: 3px;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--t-danger-soft);
	color: var(--t-danger);
	font-size: 11px;
	font-weight: 650;
}

/* Aktionen (wie .button / .ggas-btn) */
.tmgh-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tmgh .tmgh-act {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding: 0 14px;
	border-radius: 999px;
	background: var(--t-accent);
	color: var(--t-accent-ink);
	font-size: 13px;
	font-weight: 650;
	text-decoration: none;
	transition: background-color var(--t-dur-2), transform var(--t-dur-2) var(--t-ease);
}
.tmgh .tmgh-act:hover { background: var(--t-accent-hover); color: var(--t-accent-ink); transform: translateY(-1px); }
.tmgh .tmgh-act + .tmgh-act {
	background: var(--t-surface);
	color: var(--t-ink);
	box-shadow: inset 0 0 0 1px var(--t-line-2);
}
.tmgh .tmgh-act + .tmgh-act:hover { background: var(--t-surface-3); color: var(--t-ink); }

.tmgh-coupon {
	display: inline-block;
	margin: 8px 0 4px;
	padding: 6px 14px;
	border: 1.5px dashed var(--t-accent);
	border-radius: var(--t-r-sm);
	background: var(--t-accent-soft);
	color: var(--t-accent-text);
	font: 400 22px/1.1 var(--t-pixel);
	letter-spacing: .08em;
	cursor: copy;
}

/* Schnellthemen (Pills wie in der Hauptnavigation) */
.tmgh-chips {
	display: flex;
	gap: 6px;
	padding: 10px 12px 2px;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	cursor: grab;
	border-top: 1px solid var(--t-line);
	background: var(--t-surface);
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
	mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.tmgh-chips::-webkit-scrollbar { display: none; }
.tmgh-chips.is-dragging { cursor: grabbing; user-select: none; }
.tmgh-chips.is-dragging .tmgh-chip { pointer-events: none; }
.tmgh-chips.at-end { -webkit-mask-image: none; mask-image: none; }
.tmgh .tmgh-chip {
	flex: none;
	min-height: 32px;
	padding: 0 12px;
	border: 0;
	border-radius: 999px;
	background: var(--t-surface-2);
	color: var(--t-ink-2);
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	box-shadow: inset 0 0 0 1px var(--t-line);
	transition: background-color var(--t-dur-2), color var(--t-dur-2), box-shadow var(--t-dur-2);
}
.tmgh .tmgh-chip:hover {
	background: var(--t-accent-soft);
	color: var(--t-accent-text);
	box-shadow: inset 0 0 0 1px var(--t-accent-line);
}

/* Eingabeleiste (wie .gg-support-composer) */
.tmgh-form {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 12px 12px;
	background: var(--t-surface);
}
.tmgh .tmgh-input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 16px;
	border: 1px solid var(--t-line-2);
	border-radius: 22px;
	outline: none;
	background: var(--t-surface-2);
	color: var(--t-ink);
	font-size: 15px;
	transition: background-color var(--t-dur-2), border-color var(--t-dur-2), box-shadow var(--t-dur-2);
}
.tmgh .tmgh-input::placeholder { color: var(--t-ink-3); opacity: 1; }
.tmgh .tmgh-input:focus {
	border-color: var(--t-accent);
	background: var(--t-surface);
	box-shadow: 0 0 0 3px var(--t-accent-soft);
}
.tmgh .tmgh-send {
	flex: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--t-accent);
	color: var(--t-accent-ink);
	box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--t-accent) 80%, transparent);
	transition: background-color var(--t-dur-2), transform var(--t-dur-1);
}
.tmgh .tmgh-send:hover { background: var(--t-accent-hover); }
.tmgh .tmgh-send:active { transform: scale(.94); }
.tmgh .tmgh-send svg { transition: transform var(--t-dur-2) var(--t-spring); }
.tmgh .tmgh-send:hover svg { transform: translate(2px, -2px) rotate(8deg); }

/* ---------- Große / hohe Bildschirme (1440p, 4K, 32:9 mit 1440 px Höhe …) ---------- */
@media (min-width: 1600px) and (min-height: 1100px) {
	.tmgh { --tmgh-k: 1.12; --tmgh-chat-max: 660px; }
	.tmgh-chat { width: min(420px, calc(100vw - 2 * var(--tmgh-edge))); }
}
@media (min-width: 2400px) and (min-height: 1500px) {
	.tmgh { --tmgh-k: 1.3; --tmgh-chat-max: 760px; }
	.tmgh-chat { width: min(460px, calc(100vw - 2 * var(--tmgh-edge))); }
}

/* ---------- Niedrige, breite Bildschirme (Handy quer, kleine Laptops, Tablets mit Leiste) ----------
   Chat und Menü neben statt über dem Gerät, damit die Höhe reicht. */
@media (max-height: 640px) and (min-width: 601px) {
	.tmgh { --tmgh-w: min(calc(var(--tmgh-wd) * var(--tmgh-k)), calc(var(--tmgh-vh) * .42 * 1.267)); }
	.tmgh-chat, .tmgh-menu { bottom: 0; }
	.tmgh-right .tmgh-chat, .tmgh-right .tmgh-menu { right: calc(100% + 8px); }
	.tmgh-left .tmgh-chat, .tmgh-left .tmgh-menu { left: calc(100% + 8px); }
	.tmgh-chat {
		width: min(400px, calc(100vw - var(--tmgh-w) - 2 * var(--tmgh-edge) - var(--tmgh-safe-l) - var(--tmgh-safe-r) - 8px));
		max-height: min(var(--tmgh-chat-max), calc(var(--tmgh-vh) - var(--tmgh-b) - max(var(--tmgh-safe-b), var(--tmgh-kb)) - var(--tmgh-safe-t) - var(--header-h, 0px) - 16px));
		border-radius: var(--t-r-lg);
	}
	.tmgh-menu {
		width: min(300px, calc(100vw - var(--tmgh-w) - 2 * var(--tmgh-edge) - 8px));
		max-height: calc(var(--tmgh-vh) - var(--tmgh-b) - var(--tmgh-safe-b) - 16px);
	}
	.tmgh .tmgh-menu-btn { min-height: 44px; }
	.tmgh-head { padding-top: 8px; padding-bottom: 8px; }
	.tmgh-stats { padding-top: 6px; padding-bottom: 6px; }
	.tmgh-log { min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
	.tmgh-chips { padding-top: 6px; }
	.tmgh-form { padding-top: 6px; padding-bottom: 8px; }
	.tmgh .tmgh-input, .tmgh .tmgh-send { height: 40px; }
	.tmgh .tmgh-send { width: 40px; }
}
@media (max-height: 420px) and (min-width: 601px) {
	.tmgh-stats { display: none; }
}

/* ---------- Smartphones (hochkant) ---------- */
@media (max-width: 600px) {
	.tmgh { --tmgh-w: min(var(--tmgh-wm), 60vw); }
	.tmgh-chat { border-radius: var(--t-r-lg); }
	/* Sprechblase über dem Gerät statt daneben (sonst ragt sie aus dem Bildschirm) */
	.tmgh-right .tmgh-bubble, .tmgh-left .tmgh-bubble {
		bottom: calc(100% + 4px);
		max-width: min(280px, calc(100vw - 2 * var(--tmgh-edge)));
	}
	.tmgh-right .tmgh-bubble { right: 0; border-radius: 18px 18px 6px 18px; }
	.tmgh-left .tmgh-bubble { left: 0; border-radius: 18px 18px 18px 6px; }
	.tmgh-msg { max-width: 90%; }
	.tmgh .tmgh-input { font-size: 16px; } /* verhindert Zoom auf iOS */

	/* Offener Chat = Bottom-Sheet über die ganze Breite; das Gerät macht Platz.
	   Die Höhe folgt der sichtbaren Fläche, die Tastatur verdeckt also nichts. */
	.tmgh.is-chat .tmgh-device,
	.tmgh.is-chat .tmgh-bubble,
	.tmgh.is-chat .tmgh-menu { display: none !important; }
	.tmgh.is-chat .tmgh-chat {
		position: fixed;
		left: calc(8px + var(--tmgh-safe-l));
		right: calc(8px + var(--tmgh-safe-r));
		bottom: calc(8px + max(var(--tmgh-safe-b), var(--tmgh-kb)));
		width: auto;
		height: min(620px, calc(var(--tmgh-vh) - var(--header-h, 0px) - var(--tmgh-safe-t) - max(var(--tmgh-safe-b), var(--tmgh-kb)) - 24px));
		max-height: none;
		transform-origin: bottom center;
	}
	.tmgh.is-chat .tmgh-log { min-height: 0; }
}
/* Sehr schmale Geräte (iPhone SE 1. Gen., Galaxy Fold Außendisplay, 320 px …) */
@media (max-width: 360px) {
	.tmgh-head { gap: 8px; padding: 10px 10px 10px 12px; }
	.tmgh-avatar { width: 34px !important; height: 34px !important; padding: 6px 3px; }
	.tmgh-title strong { font-size: 14px; }
	.tmgh-title span { font-size: 11px; }
	.tmgh .tmgh-lang button { min-width: 26px; padding: 0 5px; }
	.tmgh .tmgh-x { width: 32px; height: 32px; }
	.tmgh-stats { gap: 8px; padding: 8px 12px; }
	.tmgh-log { padding: 12px 10px 12px; }
	.tmgh-msg, .tmgh-msg:has(.tmgh-cards) { max-width: 94%; }
	.tmgh .tmgh-menu-btn { font-size: 14px; padding: 0 8px; }
	.tmgh-coupon { font-size: 18px; }
}
/* Sehr niedrige Hochformat-Fenster (z. B. Split-Screen) */
@media (max-width: 600px) and (max-height: 520px) {
	.tmgh.is-chat .tmgh-stats { display: none; }
}

/* Option „Auf Smartphones ausblenden“ – hochkant und quer */
@media (max-width: 600px), (max-height: 500px) and (pointer: coarse) {
	.tmgh.is-hide-m { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
	.tmgh-device, .tmgh-chat, .tmgh-bubble, .tmgh-msg { animation: none !important; }
	.tmgh *, .tmgh *::before, .tmgh *::after { transition-duration: 1ms !important; }
}
