/* Traduzioni sotto bolle, frasi chiave e box grammaticali, e dizionario al tocco (includes/traduzioni-lezioni.php).
   Il sito non ha un tema scuro: colori espliciti. Gli stili della lezione sono inline nell'HTML; questi riguardano solo gli elementi aggiunti. */

/* ── Traduzioni ── */
.kt-riga {
	margin: 4px 0 0 44px; /* sotto la bolla di sinistra: allineata al messaggio (avatar 34 + spazio 10) */
	color-scheme: only light;
}
.kt-riga.kt-dx {
	margin: 4px 44px 0 auto;
	align-self: flex-end;
	max-width: calc(100% - 44px);
}
.kt-riga.kt-largo {
	margin: 12px 0 0;
}
/* traduzione di un paragrafo di un testo di lettura (sotto il paragrafo italiano) */
.kt-riga.kt-lett {
	margin: 0 0 14px;
}
.kt-det summary {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	box-sizing: border-box;
	padding: 0 12px;
	border: 1px solid rgba(27, 75, 138, .35);
	border-radius: 999px;
	background: #fff;
	color: #1B4B8A;
	font: 600 12px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
	cursor: pointer;
	list-style: none;
}
.kt-det summary::-webkit-details-marker {
	display: none;
}
.kt-det[open] > summary {
	background: #1B4B8A;
	color: #fff;
}
.kt-testo {
	margin: 6px 0 0;
	padding: 8px 12px;
	background: #F8F6F1;
	border-left: 3px solid #E8A020;
	border-radius: 6px;
	color: #1A1A2E;
	font-size: 14px;
	line-height: 1.55;
}
.kt-testo[dir="rtl"] {
	border-left: 0;
	border-right: 3px solid #E8A020;
}
.kt-testo p {
	margin: 0 0 6px;
}
.kt-testo p:last-child {
	margin-bottom: 0;
}
.kt-box-titolo {
	font-weight: 700;
}
.kt-nota {
	margin: 6px 0 0;
	color: #6B7280;
	font-size: 11px;
	line-height: 1.4;
}
.kt-nota a {
	color: inherit;
	text-decoration: underline;
}
.kt-lista {
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
}
.kt-lista li {
	padding: 7px 0;
	border-bottom: 1px solid #E5E7EB;
	color: #1A1A2E;
	font-size: 14px;
	line-height: 1.5;
}
.kt-lista li:last-child {
	border-bottom: 0;
}
.kt-ita {
	margin-inline-end: 6px;
	color: #633806;
	font-weight: 600;
}
.kt-tab {
	width: 100%;
	margin: 4px 0;
	border-collapse: collapse;
	font-size: 13px;
}
.kt-tab th {
	padding: 6px 8px;
	background: #1A5C38;
	color: #fff;
	text-align: start;
}
.kt-tab td {
	padding: 6px 8px;
	border-bottom: 1px solid #E5E7EB;
	vertical-align: top;
}

/* ── Dizionario ── */
.kd-bottone {
	position: fixed;
	left: var(--kd-bl, 12px); /* a sinistra della colonna del contenuto (kalima-dizionario.js), non sul curriculum */
	bottom: var(--kd-bt, 93px); /* 12 px sopra la barra Precedente/Successivo di Tutor (kalima-dizionario.js); ripiego se manca */
	z-index: 9998; /* sotto il pannello (10001) */
	min-height: 36px;
	box-sizing: border-box;
	padding: 0 14px;
	border: 1px solid rgba(27, 75, 138, .45);
	border-radius: 999px;
	background: #fff;
	color: #1B4B8A;
	font: 600 13px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
	cursor: pointer;
	color-scheme: only light;
}
.kd-bottone[aria-pressed="true"] {
	background: #fff;
	color: #1B4B8A;
}
/* Parole del glossario: sottolineatura tratteggiata leggera. text-decoration segue il testo anche se l'unita' va a capo. */
.kd-p {
	text-decoration: underline dashed;
	text-decoration-color: rgba(27, 75, 138, .55);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	cursor: pointer;
}
.kl-bubble.right .kd-p {
	text-decoration-color: rgba(255, 255, 255, .75);
}
.kd-spento .kd-p {
	text-decoration: none;
	cursor: inherit;
}
.kd-hint {
	position: fixed;
	left: var(--kd-bl, 12px);
	bottom: calc(var(--kd-bt, 93px) + 44px);
	z-index: 9998;
	max-width: min(260px, calc(100vw - 24px));
	box-sizing: border-box;
	padding: 8px 12px;
	border-radius: 10px;
	background: #1B4B8A;
	color: #fff;
	font: 600 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
	cursor: pointer;
	color-scheme: only light;
}
.kd-hint[hidden],
.kd-spento .kd-hint {
	display: none;
}
.kd-hint::after {
	content: "";
	position: absolute;
	left: 24px;
	bottom: -6px;
	border: 6px solid transparent;
	border-bottom: 0;
	border-top-color: #1B4B8A;
}
/* Traduzione accanto all'italiano nelle spiegazioni brevi e nei titoli fissi. */
.kt-par {
	color: #4B5563;
	font-weight: 400;
	font-style: normal;
}
.kt-par.kt-sotto {
	display: inline-block;
	margin-top: 4px;
	font-size: .92em;
}
.kd-parte {
	margin-top: 3px;
	color: #4B5563;
	font-size: 13px;
	line-height: 1.4;
}
.kd-nota {
	margin-top: 2px;
	color: #6B7280;
	font-size: 13px;
}
.kd-reg {
	margin-top: 2px;
	font-size: 15px;
	font-weight: 600;
}
.kd-bottone[aria-pressed="false"] {
	background: #fff;
	color: #6B7280;
	border-color: rgba(107, 114, 128, .5);
	text-decoration: line-through;
}
.kd-pannello {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10001;
	max-height: 46vh;
	overflow-y: auto;
	box-sizing: border-box;
	padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 3px solid #1B4B8A;
	background: #fff;
	box-shadow: 0 -4px 16px rgba(0, 0, 0, .18);
	color: #1A1A2E;
	font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
	color-scheme: only light;
}
.kd-pannello[hidden] {
	display: none;
}
.kd-testata {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}
.kd-parola {
	color: #6B7280;
	font-size: 14px;
}
.kd-chiudi {
	width: 44px;
	height: 44px;
	flex: none;
	border: 0;
	border-radius: 50%;
	background: #F3F4F6;
	color: #1A1A2E;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.kd-voce {
	padding: 8px 0;
	border-top: 1px solid #E5E7EB;
}
.kd-voce:first-of-type {
	border-top: 0;
}
.kd-lemma {
	font-size: 18px;
	font-weight: 700;
}
.kd-forma {
	color: #6B7280;
	font-size: 13px;
}
.kd-sign {
	margin-top: 2px;
	font-size: 17px;
}
.kd-ese {
	margin-top: 4px;
	color: #633806;
	font-size: 14px;
	font-style: italic;
}
.kd-sign-en {
	margin-top: 2px;
	color: #6B7280;
	font-size: 13px;
}

/* Dizionario su desktop (da 768 px in su): scheda centrata sulla colonna del contenuto, ancorata sopra la barra Precedente/Successivo.
   --kd-cx (centro), --kd-cw (larghezza) e --kd-bb (distanza dal basso) li imposta kalima-dizionario.js all'apertura; senza, valgono i ripieghi.
   Sotto 768 px non cambia niente. Testo tutto centrato: nei blocchi RTL (dir="rtl" sull'elemento tradotto) il significato sta sotto la parola italiana. */
@media (min-width: 768px) {
	.kd-pannello {
		left: var(--kd-cx, 50%);
		right: auto;
		bottom: var(--kd-bb, 12px);
		transform: translateX(-50%);
		width: max-content;
		min-width: 360px;
		max-width: min(560px, calc(100vw - 32px), calc(var(--kd-cw, 100vw) - 32px));
		max-height: min(46vh, calc(100vh - var(--kd-bb, 12px) - 76px));
		border-radius: 14px;
		padding: 8px 20px 16px;
		box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
		text-align: center;
	}
	.kd-testata {
		justify-content: center;
		min-height: 44px;
		padding-inline: 44px;
	}
	.kd-chiudi {
		position: absolute;
		top: 4px;
		right: 4px;
		width: 44px;
		height: 44px;
	}
	.kd-pannello.kd-rtl .kd-chiudi {
		right: auto;
		left: 4px;
	}
	.kd-parola,
	.kd-lemma,
	.kd-forma,
	.kd-sign,
	.kd-sign-en,
	.kd-nota,
	.kd-reg,
	.kd-ese,
	.kd-parte,
	.kd-parte-sig {
		text-align: center;
	}
}

@media (max-width: 480px) {
	.kt-det summary {
		min-height: 36px;
	}
}

/* ── Traduzioni di blocco (kalima_traduzioni_frasi = blocco) e consegne degli esercizi ── */
.kt-bl[hidden] {
	display: none;
}
.kt-ctrl {
	margin: 6px 0 8px;
}
.kt-tutte {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	box-sizing: border-box;
	padding: 0 12px;
	border: 1px solid rgba(27, 75, 138, .35);
	border-radius: 999px;
	background: #fff;
	color: #1B4B8A;
	font: 600 12px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
	cursor: pointer;
	color-scheme: only light;
}
.kt-tutte.kt-aperto {
	background: #1B4B8A;
	color: #fff;
}
.kt-ico {
	flex: none;
}
.kl-h5p-label .kt-consegna,
.kl-esercizi-header .kt-consegna {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
}

/* ── Tipografia per scrittura: la lingua dell'elemento sceglie dimensione e interlinea.
   Base: testo del pannello e delle traduzioni almeno 16 px, note piccole almeno 15 px, mai sotto.
   --ks = fattore di dimensione, --kl = interlinea. Latino: invariato. */
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint) { --ks: 1; --kl: 1.5; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(uk),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ru),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(be) { --ks: 1.05; --kl: 1.45; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(zh) { --ks: 1.1; --kl: 1.6; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ar),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(fa),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ur) { --ks: 1.15; --kl: 1.8; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(hi),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(bn) { --ks: 1.12; --kl: 1.7; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(am),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ti),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(si) { --ks: 1.15; --kl: 1.7; }

.kd-sign { font-size: calc(17px * var(--ks)); line-height: var(--kl); }
.kd-sign-en { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kd-forma { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kd-nota { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kd-parte, .kd-parte-sig { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kd-reg { font-size: calc(16px * var(--ks)); line-height: var(--kl); }
.kd-ese { font-size: calc(16px * var(--ks)); line-height: var(--kl); }
.kd-parola { font-size: calc(15px * var(--ks)); }
.kt-testo, .kt-testo p { font-size: calc(16px * var(--ks)); line-height: var(--kl); }
.kt-lista li { font-size: calc(16px * var(--ks)); line-height: var(--kl); }
.kt-par, .kt-par.kt-sotto { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kt-consegna { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kt-nota { font-size: calc(15px * var(--ks)); line-height: var(--kl); }
.kt-et { font-size: calc(15px * var(--ks)); line-height: 1.3; }
.kd-hint { font-size: calc(15px * var(--ks)); line-height: var(--kl); }

/* Etichetta EN: il significato nel pannello arriva dall'inglese perche' manca nella lingua dello studente */
.kd-en {
	display: inline-block;
	margin-inline-end: 6px;
	padding: 0 5px;
	border: 1px solid #9CA3AF;
	border-radius: 4px;
	color: #4B5563;
	font: 700 11px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
	letter-spacing: .04em;
	vertical-align: .1em;
	unicode-bidi: isolate;
}

/* Font per le scritture che alcuni telefoni non hanno (sottoinsiemi Noto, SIL OFL, ospitati qui, woff2, font-display swap).
   Il file si scarica solo se in pagina c'e' testo in quella lingua e il telefono non ha gia' il font (local() prima). */
@font-face {
	font-family: "KL Ethiopic";
	src: local("Noto Sans Ethiopic"), local("Nyala"), local("Abyssinica SIL"), local("Kefa"), url("../fonts/noto-sans-ethiopic-400.woff2") format("woff2");
	font-weight: 400; font-style: normal; font-display: swap;
	unicode-range: U+1200-139F, U+2D80-2DDF;
}
@font-face {
	font-family: "KL Sinhala";
	src: local("Noto Sans Sinhala"), local("Iskoola Pota"), local("Nirmala UI"), url("../fonts/noto-sans-sinhala-400.woff2") format("woff2");
	font-weight: 400; font-style: normal; font-display: swap;
	unicode-range: U+0D80-0DFF, U+200C-200D;
}
@font-face {
	font-family: "KL Naskh";
	src: local("Noto Naskh Arabic"), url("../fonts/noto-naskh-arabic-400.woff2") format("woff2");
	font-weight: 400; font-style: normal; font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+200C-200F;
}
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(am),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ti) { font-family: "KL Ethiopic", system-ui, sans-serif; }
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(si) { font-family: "KL Sinhala", system-ui, sans-serif; }
/* Urdu e persiano: Naskh (il Nastaliq pesa troppo e a 16 px su schermo piccolo non e' leggibile); l'arabo usa il font di sistema */
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(ur),
:is(.kd-sign, .kd-sign-en, .kd-nota, .kd-parte, .kd-parte-sig, .kd-reg, .kd-forma, .kd-ese, .kd-parola, .kt-testo, .kt-testo p, .kt-lista li, .kt-par, .kt-nota, .kt-consegna, .kt-et, .kd-hint):lang(fa) { font-family: "KL Naskh", system-ui, sans-serif; }

/* Traduzioni lunghe (fr, uk, bn, ru, de, be, si...): niente larghezza oltre lo schermo a 360 px. Prima la pagina diventava piu' larga del telefono. */
.kl-glossario-box { flex-wrap: wrap; gap: 12px; }
.kl-glossario-btn { white-space: normal !important; max-width: 100%; box-sizing: border-box; text-align: center; }
.kl-glossario-btn .kt-par { white-space: normal !important; }
.kl-box-label { flex-wrap: wrap; max-width: 100%; }
.kl-box-label .kt-par, .kl-hero-num .kt-par { white-space: normal; overflow-wrap: anywhere; }
.tutor-learning-header .tutor-md-inline { display: inline-block; max-width: calc(100vw - 120px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* La traduzione nella riga in alto («Lezione 1 di 3 · A1 · Ciao!») sta su fondo blu: stesso colore della riga, non il grigio scuro delle altre traduzioni */
.kl-hero-num .kt-par { color: inherit; opacity: .85; font-size: calc(12px * var(--ks, 1)); line-height: var(--kl, 1.5); letter-spacing: normal; }

/* Regole generali anti-sforamento (360-412 px): testo e traduzioni lunghe vanno a capo, i contenitori flex non allargano la pagina, H5P e audio restano com'erano. */
.tutor-lesson-wrapper [class*="kl-"], .tutor-lesson-wrapper [class*="kt-"] { min-width: 0; overflow-wrap: anywhere; }
.tutor-lesson-wrapper :is(.kl-h5p-label, .kl-esercizi-header, .kl-box-label, .kl-glossario-box, .kl-chunk, .kl-hero-num, .kl-progress-label) { flex-wrap: wrap; }
.tutor-lesson-wrapper .kt-par.kt-sotto { flex: 1 1 100%; max-width: 100%; }
.tutor-lesson-wrapper :is(td, th) { overflow-wrap: anywhere; min-width: 0; }
.tutor-lesson-wrapper table { max-width: 100%; }
.tutor-lesson-wrapper :is(.h5p-content, .h5p-iframe-wrapper, iframe, audio) { overflow-wrap: normal; }
