/* =============================================
   REZULTATO PRANEŠIMAS — bendras visiems režimams (2026-11-12)
   result-toast.js → showResultToast()

   [banknotai +12] Egle  VILNIUS  🔥4 — viena eilutė (~44 px), plotis pagal
   turinį, viršuje centre. Litai — banknotų pluoštas su suma ženklelyje;
   neteisingam — tamsi moneta su ✕. Atsakymas nekerpamas: trumpėja vardas ir
   netelpantis prabėga; netelpa net atsakymas — vardas slepiamas, prabėga
   atsakymas. Plačiame ekrane platesnis ir stambesnis — telpa viskas.

   Vieta — `--notify-top` (klasikinėje jį rašo js/keyboard-visibility.js),
   kitur 20 px. Visos animacijos įskaičiuoja centravimą (translate -50%).
   ============================================= */

.result-toast {
	--rt-gold: #f4d58d;
	position: fixed;
	top: var(--notify-top, 20px);
	left: 50%;
	z-index: 99999;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: 9px;
	width: max-content;
	max-width: calc(100vw - 32px);
	padding: 4px 14px 4px 4px;
	border-radius: 999px;
	border: 1px solid rgba(245, 158, 11, 0.38);
	background: linear-gradient(90deg, rgba(40, 33, 14, 0.96), rgba(17, 21, 29, 0.96) 42%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
	backdrop-filter: blur(12px) saturate(140%);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
	color: #f5f7fa;
	font-family: 'Exo 2', sans-serif;
	font-size: 13px;
	line-height: 1.2;
	text-align: left;
	white-space: nowrap;
	pointer-events: none;
	overflow: hidden;
	transform: translateX(-50%);
	animation: rtSlideIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-toast.error {
	border-color: rgba(248, 113, 113, 0.38);
	background: rgba(17, 21, 29, 0.96);
	animation-name: rtShakeIn;
	animation-duration: 0.52s;
}

.result-toast.info {
	border-color: rgba(148, 163, 184, 0.35);
	background: rgba(17, 21, 29, 0.96);
}

/* Fono animacija: per pranešimą kas ~3 s praslenka švelnus atspindys
   (auksinis / rausvas / baltas pagal tipą). Turinio nedengia ryškiai —
   14 % šviesos, tekstas lieka įskaitomas. */
.result-toast::after {
	content: '';
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(105deg, transparent 38%, var(--rt-shine, rgba(255, 228, 150, 0.16)) 50%, transparent 62%);
	background-size: 260% 100%;
	background-repeat: no-repeat;
	background-position: 130% 0;
	animation: rtShine 3s ease-in-out 0.6s infinite;
}

.result-toast.error { --rt-shine: rgba(255, 170, 170, 0.12); }
.result-toast.info { --rt-shine: rgba(226, 232, 240, 0.1); }

.result-toast.is-leaving {
	animation: rtLiftOut 0.28s ease-in forwards;
}

/* ---- Litų pluoštas: priekyje stambiausias, kiti kyšo vėduokle ---- */
.result-toast__notes {
	--note-h: 26px;
	flex: none;
	position: relative;
	display: block;
	width: calc(var(--note-h) * 2.1 + (var(--n, 1) - 1) * 7px + 4px);
	height: calc(var(--note-h) + 8px);
}

.result-toast__note {
	position: absolute;
	left: 2px;
	top: 3px;
	width: auto;
	height: var(--note-h);
	border-radius: 2px;
	box-shadow: -1px 1px 4px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(0, 0, 0, 0.4);
	transform-origin: 15% 90%;
	transform: translateX(calc(var(--i, 0) * 7px)) rotate(calc(var(--i, 0) * 5deg - 3deg));
	z-index: calc(10 - var(--i, 0));
}

.result-toast__sum {
	position: absolute;
	left: 50%;
	bottom: -2px;
	z-index: 20;
	padding: 0 5px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 800;
	line-height: 1.35;
	color: #3b2a05;
	background: linear-gradient(#fff3b0, #f5c542);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Moneta — kai litų nėra (neteisingas atsakymas: ✕). */
.result-toast__coin {
	flex: none;
	display: grid;
	place-items: center;
	box-sizing: border-box;
	min-width: 30px;
	height: 30px;
	padding: 0 4px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 800;
	color: #3b2a05;
	background: radial-gradient(circle at 35% 30%, #fff3b0, #f5c542 45%, #b8860b);
	box-shadow: inset 0 0 0 2px rgba(120, 80, 0, 0.4);
}

.info .result-toast__coin {
	color: #e2e8f0;
	background: #273041;
	box-shadow: inset 0 0 0 2px rgba(148, 163, 184, 0.45);
}

.error .result-toast__coin {
	color: #f87171;
	background: #3a1d22;
	box-shadow: inset 0 0 0 2px rgba(248, 113, 113, 0.5);
}

/* ---- Vardas (trumpėja pirmas) ir atsakymas (nekerpamas) ---- */
.result-toast__track {
	flex: 0 1000 auto;
	min-width: 0;
	overflow: hidden;
}

.result-toast__answer {
	flex: none;
	overflow: hidden;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--rt-gold);
}

.error .result-toast__answer {
	color: #fecaca;
}

.result-toast.is-long-answer .result-toast__track {
	display: none;
}

.result-toast.is-long-answer .result-toast__answer {
	flex: 0 1 auto;
	min-width: 0;
}

.result-toast__track.is-overflowing,
.result-toast__answer.is-overflowing {
	-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
	mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
}

.result-toast__run {
	display: inline-block;
	padding: 0 2px;
}

/* Tarpai = išblukimo plotis: pradžios ir galo raidės nelieka blyškios. */
.is-overflowing .result-toast__run {
	padding: 0 14px 0 10px;
}

.result-toast__run.is-running {
	animation: rtMarquee var(--marquee-time, 2s) linear forwards;
}

.result-toast__name {
	font-weight: 500;
	color: #b8c2d1;
}

.result-toast__text {
	font-weight: 600;
	color: #e6ebf2;
}

.result-toast__streak {
	flex: none;
	font-weight: 700;
	color: #fdba74;
}

/* ---- Platus ekranas: telpa viskas be slinkimo ---- */
@media (min-width: 641px) {
	.result-toast {
		max-width: min(720px, calc(100vw - 48px));
		gap: 11px;
		padding: 5px 18px 5px 5px;
		font-size: 15px;
	}

	.result-toast__notes { --note-h: 30px; }
	.result-toast__sum { font-size: 12px; }

	.result-toast__coin {
		min-width: 34px;
		height: 34px;
		font-size: 13px;
	}
}

/* ---- Judesys ---- */
@keyframes rtSlideIn {
	0% { transform: translate(calc(-50% + 50vw + 100%), 0); opacity: 0; }
	70% { transform: translate(calc(-50% - 12px), 0); opacity: 1; }
	86% { transform: translate(calc(-50% + 5px), 0); }
	100% { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes rtShakeIn {
	0% { transform: translate(calc(-50% + 50vw + 100%), 0); opacity: 0; }
	60% { transform: translate(calc(-50% - 10px), 0); opacity: 1; }
	74% { transform: translate(calc(-50% + 7px), 0); }
	86% { transform: translate(calc(-50% - 4px), 0); }
	100% { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes rtLiftOut {
	from { transform: translate(-50%, 0); opacity: 1; }
	to { transform: translate(-50%, -24px); opacity: 0; }
}

@keyframes rtShine {
	0% { background-position: 130% 0; }
	55%, 100% { background-position: -30% 0; }
}

@keyframes rtMarquee {
	to { transform: translateX(var(--marquee-shift, 0)); }
}

@media (prefers-reduced-motion: reduce) {
	.result-toast,
	.result-toast.error,
	.result-toast.is-leaving,
	.result-toast__run.is-running,
	.result-toast::after {
		animation-duration: 0.01ms !important;
		animation-name: none !important;
	}
}
