/* InClassWithMrc – Dictionary
   Les variables peuvent être redéfinies par le thème. */
:root {
	--icwm-dict-ink: #1e2a3a;
	--icwm-dict-amber: #f2a93b;
	--icwm-dict-sky: #dfe6ee;
	--icwm-dict-paper: #ffffff;
	--icwm-dict-font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--icwm-dict-display: "Bricolage Grotesque", var(--icwm-dict-font);
	--icwm-dict-hand: "Caveat", "Segoe Print", cursive;
	--icwm-dict-bottom: 20px;
	--icwm-dict-right: 20px;
}

/* Bouton flottant */
.icwm-dict-toggle {
	position: fixed;
	right: var(--icwm-dict-right);
	bottom: var(--icwm-dict-bottom);
	z-index: 99990;
	display: inline-flex;
	align-items: center;
	gap: .5em;
	padding: .7em 1.1em;
	border: 2px solid var(--icwm-dict-ink);
	border-radius: 999px;
	background: var(--icwm-dict-paper);
	color: var(--icwm-dict-ink);
	font: 600 15px/1 var(--icwm-dict-font);
	box-shadow: 4px 4px 0 var(--icwm-dict-ink);
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.icwm-dict-toggle:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--icwm-dict-ink); }
.icwm-dict-toggle:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--icwm-dict-ink); }
.icwm-dict-toggle:focus-visible { outline: 3px solid var(--icwm-dict-amber); outline-offset: 3px; }
.icwm-dict-toggle[aria-pressed="true"] { background: var(--icwm-dict-amber); }

/* Mode actif : le texte devient "consultable" */
body.icwm-dict-on :where(p, li, td, th, h1, h2, h3, h4, h5, h6, blockquote, dd, dt, figcaption, label, span, a, em, strong) {
	cursor: help;
}

/* Bulle */
.icwm-dict-pop {
	position: fixed;
	z-index: 99999;
	width: min(390px, calc(100vw - 24px));
	max-height: min(62vh, 480px);
	overflow-y: auto;
	padding: 14px 16px 10px;
	border: 2px solid var(--icwm-dict-ink);
	border-radius: 14px;
	background: var(--icwm-dict-paper);
	color: var(--icwm-dict-ink);
	font: 400 15px/1.45 var(--icwm-dict-font);
	box-shadow: 6px 6px 0 var(--icwm-dict-amber);
	text-align: left;
	cursor: auto;
}
.icwm-dict-pop[hidden] { display: none; }

.icwm-dict-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}
.icwm-dict-q { font: 700 1.25em/1.1 var(--icwm-dict-display); }
.icwm-dict-close {
	border: 0; background: none; color: inherit;
	font-size: 1.5em; line-height: 1; cursor: pointer; padding: 0 4px;
}

.icwm-dict-entry { padding: 8px 0; border-top: 1px dashed color-mix(in srgb, var(--icwm-dict-ink) 25%, transparent); }
.icwm-dict-hw { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.icwm-dict-hw strong { font-family: var(--icwm-dict-display); font-size: 1.05em; }
.icwm-dict-fl {
	padding: 1px 8px; border-radius: 999px;
	background: var(--icwm-dict-sky); font-size: .8em; font-style: italic;
}
.icwm-dict-ipa { opacity: .75; font-size: .92em; }
.icwm-dict-audio {
	width: 26px; height: 26px; border: 2px solid var(--icwm-dict-ink); border-radius: 50%;
	background: var(--icwm-dict-amber); color: var(--icwm-dict-ink);
	font-size: 10px; line-height: 1; cursor: pointer; padding: 0;
}
.icwm-dict-infl { margin-top: 2px; font-size: .85em; opacity: .7; }

.icwm-dict-senses { margin: 6px 0 0; padding-left: 1.3em; }
.icwm-dict-senses > li { margin: 0 0 6px; }
.icwm-dict-lab { font-size: .82em; opacity: .7; }
.icwm-dict-ex { margin: 3px 0 0; padding-left: 1em; list-style: none; }
.icwm-dict-ex li { position: relative; font-size: .92em; opacity: .85; font-style: italic; }
.icwm-dict-ex li::before { content: "›"; position: absolute; left: -1em; font-style: normal; color: var(--icwm-dict-amber); font-weight: 700; }
.icwm-dict-ex em { font-style: normal; font-weight: 600; }

.icwm-dict-msg { margin: 6px 0; }
.icwm-dict-mrc { font-family: var(--icwm-dict-hand); font-size: 1.35em; line-height: 1.2; }
.icwm-dict-sub { margin: 8px 0 4px; font-size: .85em; opacity: .7; }
.icwm-dict-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.icwm-dict-sugg button {
	border: 1.5px solid var(--icwm-dict-ink); border-radius: 999px;
	background: var(--icwm-dict-paper); color: inherit;
	padding: 3px 10px; font: inherit; font-size: .88em; cursor: pointer;
}
.icwm-dict-sugg button:hover { background: var(--icwm-dict-sky); }

.icwm-dict-src { margin: 8px 0 0; font-size: .75em; opacity: .6; text-align: right; }
.icwm-dict-src a { color: inherit; }

/* Mobile : la bulle devient un panneau en bas d'écran */
@media (max-width: 600px) {
	.icwm-dict-pop {
		left: 0 !important; right: 0; top: auto !important; bottom: 0;
		width: auto; max-height: 70vh;
		border-radius: 16px 16px 0 0;
		border-bottom: 0;
		box-shadow: 0 -4px 0 var(--icwm-dict-amber);
	}
	.icwm-dict-toggle { padding: .65em; }
	body.icwm-dict-on .icwm-dict-toggle-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.icwm-dict-toggle { transition: none; }
}

/* Mot ajouté au carnet */
.icwm-dict-saved { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--icwm-dict-ink) 25%, transparent); font-size: .85em; font-weight: 600; }
.icwm-dict-saved a { color: inherit; text-decoration-color: var(--icwm-dict-amber); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.icwm-dict-saved + .icwm-dict-src { margin-top: 2px; }
