/* ===== Snack-Player im Messenger-Stil ===== */
html, body.lh-player-body { height: 100%; }
body.lh-player-body {
	background:
		radial-gradient(900px 500px at 0% 0%, #ebe7ff 0%, transparent 60%),
		radial-gradient(700px 400px at 100% 100%, #ffe9e1 0%, transparent 60%),
		var(--lh-bg);
	background-attachment: fixed;
}
.lh-app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 760px; margin: 0 auto; }

/* Kopfzeile */
.lh-top {
	position: relative; display: flex; align-items: center; gap: 12px;
	padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
	background: rgba(255, 255, 255, .82); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
	border-bottom: 1px solid var(--lh-line); z-index: 5;
}
@media (min-width: 761px) { .lh-top { border-radius: 0 0 22px 22px; border: 1px solid var(--lh-line); border-top: 0; } }
.lh-top__back { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--lh-ink-2); text-decoration: none; }
.lh-top__back:hover { background: var(--lh-primary-50); color: var(--lh-primary); }
.lh-top__avatar {
	width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: none;
	background: linear-gradient(135deg, var(--lh-primary-50), #fff1ec); box-shadow: inset 0 0 0 2px #fff, 0 2px 8px rgba(91, 76, 240, .15);
}
.lh-top__meta { min-width: 0; flex: 1; }
.lh-top__title { font-weight: 800; font-size: 16px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lh-top__sub { font-size: 12.5px; color: var(--lh-ok); font-weight: 600; }
.lh-top__sub.is-typing { color: var(--lh-primary); }
.lh-top__score {
	display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px;
	background: #fff6dc; color: #8a5a00; font-weight: 800; font-size: 14px;
}
.lh-top__score.pop { animation: lh-pop .45s ease; }
.lh-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; overflow: hidden; }
.lh-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lh-primary), #9a7bff, var(--lh-accent)); border-radius: 0 3px 3px 0; transition: width .5s ease; }

/* Chat */
.lh-chat { flex: 1; overflow-y: auto; padding: 22px 16px 12px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.lh-row { display: flex; gap: 8px; margin: 0 0 10px; align-items: flex-end; animation: lh-in .32s cubic-bezier(.2, .9, .3, 1.2) both; }
.lh-row--user { justify-content: flex-end; }
.lh-row__av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: #fff; box-shadow: var(--lh-shadow); flex: none; }
.lh-row--cont .lh-row__av { visibility: hidden; }
.lh-bubble {
	max-width: min(78%, 520px); padding: 11px 15px; border-radius: 20px; font-size: 16px; line-height: 1.45;
	background: #fff; box-shadow: 0 1px 2px rgba(23, 21, 58, .06), 0 4px 14px rgba(23, 21, 58, .05);
	border-bottom-left-radius: 6px; overflow-wrap: anywhere;
}
.lh-row--user .lh-bubble { background: linear-gradient(135deg, var(--lh-primary), #7a5cff); color: #fff; border-radius: 20px; border-bottom-right-radius: 6px; box-shadow: 0 6px 16px rgba(91, 76, 240, .25); }
.lh-bubble--q { border: 2px solid var(--lh-primary-100); }
.lh-bubble--q .lh-q-label { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--lh-primary); margin-bottom: 4px; }
.lh-bubble--ok { background: var(--lh-ok-50); color: #0b5c40; box-shadow: none; }
.lh-bubble--bad { background: var(--lh-bad-50); color: #8c1d33; box-shadow: none; }
.lh-bubble--tip { background: #fff8e5; color: #6b4a00; box-shadow: none; }
.lh-bubble img { display: block; border-radius: 12px; margin: 2px 0; }
.lh-bubble--img { padding: 6px; }
.lh-bubble--img .lh-cap { padding: 6px 8px 4px; }
.lh-bubble strong { font-weight: 800; }
.lh-bubble code { background: rgba(23, 21, 58, .07); padding: .1em .35em; border-radius: 6px; font-size: .92em; }
.lh-bubble .katex { font-size: 1.08em; }
.lh-solution { display: block; margin-top: 6px; font-size: 14.5px; opacity: .9; }

/* Tipp-Animation */
.lh-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.lh-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b7b3d6; animation: lh-dot 1s infinite ease-in-out; }
.lh-typing i:nth-child(2) { animation-delay: .15s; }
.lh-typing i:nth-child(3) { animation-delay: .3s; }

/* Antwortbereich */
.lh-dock {
	padding: 10px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom));
	background: linear-gradient(to top, rgba(245, 244, 252, 1) 60%, rgba(245, 244, 252, 0));
	min-height: 20px;
}
.lh-dock:empty { padding: 0; min-height: 0; }
.lh-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; animation: lh-up .3s ease both; }
.lh-choices--stack { flex-direction: column; align-items: stretch; }
.lh-choice {
	display: flex; align-items: center; gap: 10px; text-align: left;
	min-height: 48px; padding: 10px 16px; border-radius: 16px;
	background: #fff; border: 2px solid var(--lh-primary-100); color: var(--lh-ink);
	font-weight: 600; font-size: 15.5px; cursor: pointer; transition: all .15s ease;
}
.lh-choice:hover { border-color: var(--lh-primary); background: var(--lh-primary-50); }
.lh-choice:active { transform: scale(.985); }
.lh-choice__key {
	flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
	background: var(--lh-primary-50); color: var(--lh-primary); font-size: 13px; font-weight: 800;
}
.lh-choice.is-on { background: var(--lh-primary); border-color: var(--lh-primary); color: #fff; }
.lh-choice.is-on .lh-choice__key { background: rgba(255, 255, 255, .2); color: #fff; }
.lh-choice--primary { background: var(--lh-primary); border-color: var(--lh-primary); color: #fff; justify-content: center; }
.lh-choice--primary:hover { background: var(--lh-primary-600); border-color: var(--lh-primary-600); }
.lh-choice--tf { flex: 1; justify-content: center; font-size: 17px; }
.lh-choice--tip { background: #fff8e5; border-color: #ffe7a8; color: #6b4a00; font-size: 14px; min-height: 40px; }
.lh-hint { width: 100%; font-size: 12.5px; color: var(--lh-muted); text-align: right; margin: -2px 2px 2px; }

.lh-inputrow { display: flex; gap: 8px; align-items: center; animation: lh-up .3s ease both; }
.lh-inputrow .lh-input { flex: 1; border-radius: 999px; padding-left: 18px; min-height: 52px; font-size: 17px; }
.lh-inputrow__unit { font-weight: 700; color: var(--lh-muted); }
.lh-send {
	flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--lh-primary); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(91, 76, 240, .3);
}
.lh-send:disabled { opacity: .45; }

/* Ergebnis */
.lh-result { margin: 18px auto 8px; max-width: 420px; padding: 26px 22px 22px; text-align: center; animation: lh-in .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.lh-ring { --p: 0; position: relative; width: 140px; height: 140px; margin: 0 auto 12px; border-radius: 50%;
	background: conic-gradient(var(--lh-ring, var(--lh-primary)) calc(var(--p) * 1%), var(--lh-primary-50) 0); display: grid; place-items: center; transition: --p 1s; }
.lh-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: #fff; }
.lh-ring b { position: relative; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.lh-ring small { position: relative; display: block; font-size: 13px; color: var(--lh-muted); font-weight: 600; margin-top: -4px; }
.lh-result h2 { margin: 6px 0 4px; font-size: 22px; letter-spacing: -.01em; }
.lh-result p { margin: 0 0 16px; color: var(--lh-muted); }
.lh-result__actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.lh-result__link { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--lh-muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }

/* Overlay (Name eingeben, Session beendet) */
.lh-overlay {
	position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px;
	background: rgba(23, 21, 58, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
	animation: lh-fade .25s ease both;
}
.lh-modal { width: 100%; max-width: 400px; padding: 30px 26px 24px; text-align: center; animation: lh-in .4s cubic-bezier(.2, .9, .3, 1.2) both; }
.lh-modal__emoji { font-size: 46px; line-height: 1; margin-bottom: 8px; }
.lh-modal h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.lh-modal p { margin: 0 0 18px; color: var(--lh-muted); }
.lh-modal .lh-chip { display: inline-block; margin-bottom: 14px; padding: 5px 12px; border-radius: 999px; background: var(--lh-primary-50); color: var(--lh-primary); font-weight: 700; font-size: 13px; }
.lh-modal .lh-input { text-align: center; font-size: 18px; font-weight: 600; }

.lh-toast {
	position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 30;
	background: var(--lh-ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--lh-shadow-lg);
	animation: lh-up .3s ease both;
}

/* Konfetti */
.lh-confetti { position: fixed; top: -12px; width: 10px; height: 14px; z-index: 40; pointer-events: none; border-radius: 2px; animation: lh-fall linear forwards; }

@keyframes lh-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes lh-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes lh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lh-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes lh-pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes lh-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes lh-fall { to { transform: translateY(110vh) rotate(720deg); } }
.lh-shake { animation: lh-shake .3s ease 2; }

@media (max-width: 480px) {
	.lh-bubble { max-width: 86%; font-size: 15.5px; }
	.lh-chat { padding: 16px 12px 8px; }
}
.lh-choices--stack .lh-choice--tip { align-self: flex-start; }
.lh-bubble .katex-display { margin: .35em 0; }
