/* MemoMilo · Milo, le guide animé (v258) */
.mg-lion, .mg-inline, .mg-dialog, .mg-tour, .mg-tour * , .mg-dialog * { box-sizing: border-box; }
.mg-dialog, .mg-tour, .mg-inline { font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
html.mm-lang-ar .mg-dialog, html.mm-lang-ar .mg-tour, html.mm-lang-ar .mg-inline { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif; }

/* ---------- Le lion ---------- */
.mg-lion { position: relative; flex: 0 0 auto; aspect-ratio: 3 / 4; pointer-events: none; transform-origin: 50% 96%; }
.mg-lion-poster, .mg-lion-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 10px 14px rgba(0, 25, 40, .28)); }
.mg-lion-video { opacity: 0; transition: opacity .25s ease; background: transparent; }
.mg-lion.is-moving .mg-lion-video { opacity: 1; }
/* Jamais de pictogramme de lecture du navigateur sur Milo (Android affiche sinon un bouton pendant le chargement ou l’arrêt). */
.mg-lion-video::-webkit-media-controls, .mg-lion-video::-webkit-media-controls-panel, .mg-lion-video::-webkit-media-controls-overlay-play-button,
.mg-lion-video::-webkit-media-controls-start-playback-button, .mg-lion-video::-webkit-media-controls-play-button { display: none !important; -webkit-appearance: none; opacity: 0 !important; }
.mg-lion.is-moving .mg-lion-poster { opacity: 0; transition: opacity .2s .1s; }
/* Sans vidéo (iPhone, mouvement réduit) : Milo respire doucement. */
.mg-lion.is-still .mg-lion-poster { animation: mg-breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes mg-breathe { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.025, 1.035) rotate(-1deg); } }

/* ---------- La bulle ---------- */
.mg-bubble {
	position: relative; color: #123d62; text-align: start;
	background: linear-gradient(145deg, #ffffff, #e6f9fc); border: 1px solid rgba(255, 255, 255, .9);
	border-radius: 20px; padding: 12px 15px 13px; box-shadow: 0 10px 26px rgba(0, 25, 39, .22), inset 0 1px 0 #fff;
	font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", Roboto, system-ui, sans-serif;
}
html.mm-lang-ar .mg-bubble { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", Tahoma, system-ui, sans-serif; }
.mg-speaker { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 900; letter-spacing: 1.6px; text-transform: uppercase; color: #088fb7; }
html.mm-lang-ar .mg-speaker { letter-spacing: 0 !important; font-size: 11px; }
.mg-speaker i { width: 6px; height: 6px; border-radius: 50%; background: #23c6c5; box-shadow: 0 0 0 4px rgba(35, 198, 197, .12); animation: mg-talk .9s ease-in-out infinite; }
.mg-bubble.is-written .mg-speaker i { animation: none; }
@keyframes mg-talk { 50% { transform: scale(1.5); } }
.mg-words { position: relative; display: grid; margin: 6px 0 0; font-size: 16px; line-height: 1.38; font-weight: 800; letter-spacing: -.2px; }
html.mm-lang-ar .mg-words { font-size: 17px; line-height: 1.55; font-weight: 700; }
.mg-reserve, .mg-typed { grid-area: 1 / 1; }
.mg-reserve { visibility: hidden; }
.mg-typed::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-inline-start: 2px; vertical-align: -2px; background: #14aeca; animation: mg-blink .7s steps(1) infinite; }
.mg-bubble.is-written .mg-typed::after { display: none; }
@keyframes mg-blink { 50% { opacity: 0; } }

/* ---------- Étincelles et récompense ---------- */
.mg-spark { position: absolute; left: 50%; top: 45%; width: 6px; height: 6px; border-radius: 2px; pointer-events: none; z-index: 5; animation: mg-burst 1.4s ease-out forwards; }
@keyframes mg-burst { from { opacity: 1; transform: translate(0, 0) rotate(0); } to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(240deg); } }
.mg-reward {
	position: absolute; z-index: 4; padding: 4px 11px; border-radius: 14px; font-size: 20px; font-weight: 1000; color: #ffe18a;
	background: rgba(6, 43, 70, .82); border: 1px solid rgba(242, 207, 126, .5); text-shadow: 0 0 16px rgba(255, 202, 101, .7);
	animation: mg-reward 1.1s cubic-bezier(.2, .9, .3, 1.3) both;
}
@keyframes mg-reward { from { opacity: 0; transform: translateY(18px) scale(.6); } 45% { opacity: 1; transform: translateY(-4px) scale(1.12); } to { opacity: 1; transform: none; } }

/* ---------- 1. Dans le plateau ---------- */
.mq-onboarding-layer .mg-inline {
	position: absolute; left: 50%; bottom: calc(clamp(70px, 9.5vh, 84px) + max(0px, env(safe-area-inset-bottom)));
	width: min(96vw, 560px); display: flex; align-items: flex-end; gap: 4px; transform: translateX(-50%);
	pointer-events: none; opacity: 0; transition: opacity .28s ease, transform .4s cubic-bezier(.2, .9, .3, 1.15);
}
html[dir="rtl"] .mq-onboarding-layer .mg-inline { transform: translateX(50%); left: auto; right: 50%; }
.mq-onboarding-layer .mg-inline.is-in { opacity: 1; }
.mq-onboarding-layer .mg-inline.is-out { opacity: 0; }
.mg-lion-inline { height: clamp(150px, 22vh, 196px); margin-bottom: -6px; }
.mg-bubble-inline { flex: 1 1 auto; min-width: 0; align-self: center; margin-bottom: 26px; border-radius: 20px 20px 20px 6px; animation: mg-pop .5s cubic-bezier(.22, 1.5, .4, 1) both; }
html[dir="rtl"] .mg-bubble-inline { border-radius: 20px 20px 6px 20px; }
.mg-bubble-inline::before { content: ""; position: absolute; inset-inline-start: -11px; bottom: 16px; border-top: 10px solid transparent; border-bottom: 3px solid transparent; border-inline-end: 13px solid #f0fcfe; }
.mg-bubble-inline .mg-words { font-size: clamp(14px, 3.9vw, 17px); }
.mg-inline .mg-reward { inset-inline-end: 8px; top: -14px; }
@keyframes mg-pop { from { opacity: 0; transform: translateY(12px) scale(.82); } to { opacity: 1; transform: none; } }
.mq-shell[data-screen="plateau"] .mq-onboarding-layer { pointer-events: none; }
.mq-shell[data-screen="plateau"] .mq-onboarding-layer .mq-onboarding-art { display: none; }
@media (max-height: 700px) { .mg-lion-inline { height: 132px; } .mg-bubble-inline { margin-bottom: 16px; } }
@media (min-width: 700px) { .mg-lion-inline { height: min(24vh, 220px); } }

/* ---------- 2. Fenêtre d'accueil ---------- */
.mg-dialog {
	position: fixed; inset: 0; z-index: 2147482500; display: grid; place-items: center; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
	background: rgba(6, 34, 52, .45); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
	opacity: 0; transition: opacity .35s ease; grid-template-columns: minmax(0, 1fr); justify-items: center;
}
.mg-dialog.is-in { opacity: 1; }
.mg-dialog.is-leaving { opacity: 0; transition-duration: .28s; }
.mg-dialog-glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(55% 38% at 50% 30%, rgba(38, 213, 223, .32), transparent 70%), radial-gradient(45% 30% at 50% 90%, rgba(255, 215, 123, .2), transparent 70%); }
.mg-dialog-card {
	position: relative; width: 100%; max-width: 400px; min-width: 0; padding: 18px 18px 18px; border-radius: 30px; overflow: hidden;
	background: radial-gradient(ellipse at 50% 18%, #245d88 0, #133957 52%, #08283e 100%); border: 1px solid rgba(255, 255, 255, .6);
	box-shadow: 0 30px 70px rgba(4, 30, 48, .45); transform: translateY(24px) scale(.94); transition: transform .55s cubic-bezier(.2, .9, .25, 1.15);
}
.mg-dialog.is-in .mg-dialog-card { transform: none; }
.mg-dialog-card::before { content: ""; position: absolute; width: 420px; height: 420px; left: 50%; top: -60px; margin-left: -210px; border-radius: 50%; border: 1px solid rgba(145, 237, 255, .1); box-shadow: 0 0 0 55px rgba(122, 200, 233, .03), 0 0 0 110px rgba(122, 200, 233, .025); pointer-events: none; }
.mg-dialog-stage { position: relative; display: flex; justify-content: center; height: clamp(190px, 33vh, 270px); }
.mg-dialog-stage::after { content: ""; position: absolute; bottom: 2px; left: 22%; width: 56%; height: 34px; border-radius: 50%; background: rgba(38, 220, 255, .18); filter: blur(10px); }
.mg-lion-dialog { height: 100%; z-index: 1; animation: mg-arrive .8s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes mg-arrive { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
.mg-dialog-copy { position: relative; margin-top: -6px; }
.mg-dialog-title { margin: 0 0 10px; text-align: center; color: #fff; font-size: 1.3rem; line-height: 1.2; font-weight: 950; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
html.mm-lang-ar .mg-dialog-title { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif; }
.mg-bubble-dialog { border-radius: 20px; animation: mg-pop .6s .25s cubic-bezier(.22, 1.5, .4, 1) both; }
.mg-bubble-dialog::before { content: ""; position: absolute; left: 50%; top: -12px; margin-left: -8px; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 13px solid #fbfeff; }
.mg-dialog-actions { display: flex; gap: 10px; margin-top: 16px; }
.mg-dialog-actions .mg-btn { flex: 1 1 0; }

/* ---------- Boutons ---------- */
.mg-btn { min-height: 50px; padding: 0 18px; border: 0; border-radius: 999px; font: inherit; font-size: 1rem; font-weight: 900; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .15s, box-shadow .15s; }
html.mm-lang-ar .mg-btn { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif; }
.mg-btn-primary { color: #fff; background: linear-gradient(110deg, #078bdc, #08b9ca); box-shadow: 0 4px 0 #066a8e, 0 10px 22px rgba(8, 160, 200, .3); }
.mg-btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #066a8e, 0 6px 14px rgba(8, 160, 200, .25); }
.mg-btn-ghost { color: #d9f4fb; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
.mg-btn-ghost:active { transform: scale(.97); }
.mg-btn-small { min-height: 40px; padding: 0 18px; font-size: .92rem; }
.mg-btn-link { min-height: 40px; padding: 0 8px; background: none; color: #5d84a0; font-size: .86rem; font-weight: 800; }
.mg-btn:focus-visible { outline: 3px solid #ecaa28; outline-offset: 3px; }

/* ---------- 3. Visite guidée ---------- */
.mg-tour { position: fixed; inset: 0; z-index: 2147482400; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.mg-tour.is-in { opacity: 1; }
.mg-tour.is-leaving { opacity: 0; }
.mg-shade { position: fixed; pointer-events: auto; background: rgba(4, 24, 38, .62); transition: all .32s cubic-bezier(.2, .8, .25, 1); }
.mg-hole-block { position: fixed; pointer-events: auto; background: transparent; }
.mg-tour.is-interactive .mg-hole-block, .mg-tour:not(.has-target) .mg-hole-block { display: none; }
.mg-ring { position: fixed; pointer-events: none; display: none; transition: all .32s cubic-bezier(.2, .8, .25, 1);
	box-shadow: 0 0 0 3px #5ce5e8, 0 0 0 7px rgba(92, 229, 232, .28), 0 0 28px rgba(92, 229, 232, .55); }
.mg-tour.has-target .mg-ring { display: block; }
.mg-tour.is-interactive .mg-ring { animation: mg-ring 1.3s ease-in-out infinite; }
.mg-ring i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; display: none; background: rgba(255, 255, 255, .5); }
.mg-tour.is-interactive .mg-ring i { display: block; animation: mg-tap 1.3s ease-out infinite; }
@keyframes mg-ring { 50% { box-shadow: 0 0 0 3px #ffd77b, 0 0 0 10px rgba(255, 215, 123, .25), 0 0 34px rgba(255, 215, 123, .6); } }
@keyframes mg-tap { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
.mg-panel {
	position: fixed; left: 50%; width: min(94vw, 470px); transform: translateX(-50%); pointer-events: auto;
	display: flex; align-items: flex-end; gap: 4px; transition: opacity .25s ease, top .35s, bottom .35s;
}
.mg-panel.is-bottom { bottom: calc(14px + env(safe-area-inset-bottom)); }
.mg-panel.is-top { top: calc(12px + env(safe-area-inset-top)); }
.mg-tour.is-waiting .mg-panel { opacity: 0; pointer-events: none; }
.mg-lion-tour { height: clamp(122px, 19vh, 168px); margin-bottom: -4px; }
.mg-panel-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; align-self: center; }
.mg-panel.is-swap .mg-bubble-tour { animation: mg-pop .45s cubic-bezier(.22, 1.5, .4, 1) both; }
.mg-bubble-tour { border-radius: 20px 20px 20px 6px; }
html[dir="rtl"] .mg-bubble-tour { border-radius: 20px 20px 6px 20px; }
.mg-bubble-tour::before { content: ""; position: absolute; inset-inline-start: -11px; bottom: 16px; border-top: 10px solid transparent; border-bottom: 3px solid transparent; border-inline-end: 13px solid #f0fcfe; }
.mg-bubble-tour .mg-words { font-size: clamp(14px, 3.9vw, 16.5px); }
.mg-panel-bar { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.mg-count { margin-inline-end: auto; font-size: 11px; font-weight: 900; letter-spacing: 1px; color: rgba(225, 245, 252, .85); text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.mg-panel .mg-btn-link { color: #d9f1fa; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.mg-tap-hint { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: .85rem; font-weight: 900; color: #123d62; background: #ffd77b; box-shadow: 0 6px 16px rgba(236, 170, 40, .35); animation: mg-hint 1.3s ease-in-out infinite; }
html.mm-lang-ar .mg-tap-hint { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif; }
@keyframes mg-hint { 50% { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(236, 170, 40, .45); } }

@media (prefers-reduced-motion: reduce) {
	.mg-tour *, .mg-dialog *, .mg-inline * { animation: none !important; }
	.mg-shade, .mg-ring { transition: none; }
}
.mq-onboarding-layer.is-leaving .mg-inline { opacity: 0; transform: translateX(-50%) translateY(10px); }
html[dir="rtl"] .mq-onboarding-layer.is-leaving .mg-inline { transform: translateX(50%) translateY(10px); }
