:root {
	--bleu: #234a8f;
	--bleu-nuit: #12275a;
	--bleu-carte: #1a3a78;
	--blanc: #ffffff;
	--texte-doux: #c9d6f2;
	--banane: #f7cf46;
	--juste: #38b36a;
	--faux: #d9473b;
}
* { box-sizing: border-box; }
html { background: var(--bleu); height: 100%; overflow: hidden; }
body {
	margin: 0; min-height: 100vh; font-family: 'Open Sans', system-ui, sans-serif;
	color: var(--blanc); background: none; isolation: isolate;
	height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 64px;
}
#progression { position: fixed; top: 0; left: 0; width: 100%; height: 6px; z-index: 20; background: rgba(8,22,60,.45); }
#contenu_progression { height: 100%; width: 0; background: var(--banane); transition: width .4s ease; }

/* ---------- pubs ---------- */
.pub {
	position: relative; z-index: 2; width: var(--w); height: var(--h); max-width: 100%;
	margin-inline: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	border: 2px dashed rgba(255,255,255,.35); border-radius: 6px; background: rgba(8,22,60,.35);
	color: var(--texte-doux); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; overflow: hidden;
}
.pub b { font-size: 13px; letter-spacing: .05em; color: var(--blanc); }
.pub-top { margin-top: 22px; }
.pub-rect { margin-top: 20px; flex: none; }
@media (max-height: 860px) { .pub-rect { display: none; } }
.pub-feed { margin: 28px auto; }
.pub-sticky { display: none; }
.pub-side { display: none; }

/* ---------- mise en page ---------- */
#page { position: relative; z-index: 1; display: flex; justify-content: center; gap: 28px; padding: 0 16px; flex: 1; min-height: 0; }
main { width: 100%; max-width: 640px; min-width: 0; padding: 12px 0; text-align: center; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
#app { min-height: 0; display: flex; flex-direction: column; align-items: center; }
#app > .reponses, #app > .question, #app > .bilan_liste { width: 100%; }

/* ---------- accueil ---------- */
.titre { font-size: clamp(2.6rem, 8vw, 4.4rem); font-weight: 800; line-height: 1; margin: 18px 0 10px; letter-spacing: -.02em; text-wrap: balance; }
.intro { color: var(--texte-doux); font-size: 1.1rem; line-height: 1.55; margin: 0 0 32px; }
.intro strong { color: var(--blanc); font-weight: 600; }

button {
	font: inherit; font-weight: 800; cursor: pointer; border: 0; border-radius: 999px; padding: 14px 36px;
	background: var(--banane); color: #2a2200; font-size: 1.05rem; box-shadow: 0 5px 0 #b8941d; transition: transform .1s, box-shadow .1s;
}
button:hover { transform: translateY(2px); box-shadow: 0 3px 0 #b8941d; }
button:active { transform: translateY(5px); box-shadow: 0 0 0 #b8941d; }
button:focus-visible { outline: 3px solid var(--blanc); outline-offset: 3px; }

/* ---------- questions ---------- */
.compteur { color: var(--texte-doux); font-weight: 600; font-size: .9rem; letter-spacing: .08em; margin: 0 0 10px; }
.question { font-size: clamp(1.3rem, 3.6vw, 1.7rem); font-weight: 800; line-height: 1.3; margin: 0 0 26px; text-wrap: balance; }
.reponses { display: grid; gap: 12px; text-align: left; }
.reponses button {
	background: var(--bleu-carte); color: var(--blanc); font-weight: 600; border-radius: 12px; padding: 16px 20px;
	font-size: 1rem; box-shadow: 0 4px 0 var(--bleu-nuit); border: 2px solid rgba(255,255,255,.14);
}
.reponses button:hover:not(:disabled) { background: #24498f; }
.reponses button:disabled { cursor: default; transform: none; }
.reponses button.juste { background: var(--juste); border-color: #aef0c8; box-shadow: 0 4px 0 #1f7a44; }
.reponses button.faux { background: var(--faux); border-color: #ffb3aa; box-shadow: 0 4px 0 #8f2a22; }
#suivant { margin-top: 26px; }

/* ---------- bilan ---------- */
#score { font-size: clamp(2.4rem, 8vw, 3.6rem); font-weight: 800; margin: 0 0 6px; }
.verdict { color: var(--texte-doux); margin: 0 0 28px; }
.bilan_liste { text-align: left; overflow-y: auto; min-height: 0; max-height: calc(100dvh - 330px); padding-right: 6px; }
.bilan_liste::-webkit-scrollbar { width: 6px; } .bilan_liste::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 3px; }
.bilan_item { background: rgba(8,22,60,.45); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.bilan_quest { margin: 0 0 6px; font-weight: 600; line-height: 1.4; }
.bilan_mr { margin: 0; color: #7ee2a2; font-weight: 600; }
.bilan_mr.ko { color: #ff9a8f; text-decoration: line-through; }
.bilan_brmr { margin: 2px 0 0; color: var(--texte-doux); }
#recommencer { margin-top: 24px; }

/* ---------- Laink et Terracid (visuels officiels de wankil.fr) ---------- */
.perso { position: fixed; bottom: 0; z-index: 0; width: auto; height: clamp(140px, 27vh, 250px); max-width: 18vw; object-fit: contain; object-position: bottom; pointer-events: none; }
.perso-g { left: 0; }
.perso-d { right: 0; }
.perso.secoue { animation: secoue .5s; }
@keyframes secoue { 20% { transform: translateX(-10px) rotate(-3deg); } 40% { transform: translateX(10px) rotate(3deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
#son { position: fixed; top: 14px; right: 14px; z-index: 25; padding: 8px 12px; font-size: 1.1rem; box-shadow: none; background: rgba(8,22,60,.7); color: #fff; }
.edition { display: inline-block; margin: 0 0 8px; padding: 4px 14px; border-radius: 999px; background: var(--banane); color: #2a2200; font-weight: 800; letter-spacing: .14em; font-size: .85rem; text-transform: uppercase; }
.nouveau { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgba(247,207,70,.18); color: var(--banane); font-size: .7rem; letter-spacing: .1em; vertical-align: middle; }

/* ---------- écrans larges : colonnes de pub ---------- */
@media (min-width: 1180px) {
	.pub-side { display: flex; position: sticky; top: 80px; flex: none; margin-top: 40px; }
	#page { gap: 36px; }
}
/* ---------- mobile : bandeau collé en bas, persos réduits ---------- */
@media (max-width: 760px) {
	.pub-top { --w: 320px !important; --h: 50px !important; margin-top: 16px; }
	.pub-sticky {
		display: flex; position: fixed; bottom: 0; left: 50%; translate: -50% 0; margin: 0; border-radius: 6px 6px 0 0; z-index: 30; background: var(--bleu-nuit);
	}
	main { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 900px) { .perso { display: none; } }

/* ---------- bouton d'édition + voile jaune ---------- */
#edition {
	position: fixed; left: 50%; bottom: 14px; translate: -50% 0; z-index: 25; padding: 11px 26px; font-size: .95rem;
	background: rgba(8,22,60,.78); color: var(--banane); box-shadow: 0 0 0 2px var(--banane); backdrop-filter: blur(6px);
}
#edition:hover { background: var(--banane); color: #2a2200; box-shadow: 0 0 0 2px var(--banane), 0 0 24px rgba(247,207,70,.6); transform: none; }
body[data-edition="2026"] #edition { background: rgba(255,255,255,.9); color: #14275a; box-shadow: 0 0 0 2px var(--banane); }
body[data-edition="2026"] #edition:hover { background: #fff; color: #14275a; }

#voile {
	position: fixed; inset: 0; z-index: 100; pointer-events: none; display: grid; place-items: center; visibility: hidden;
	background: radial-gradient(circle at var(--x, 50%) var(--y, 90%), #ffe27a 0%, var(--banane) 55%, #f0b400 100%);
	clip-path: circle(0 at var(--x, 50%) var(--y, 90%));
}
#voile b { font-size: clamp(3rem, 14vw, 9rem); font-weight: 800; color: #14275a; letter-spacing: -.03em; opacity: 0; transform: scale(.6) rotate(-4deg); }
#voile.ouvre { visibility: visible; pointer-events: all; animation: jaillit .95s cubic-bezier(.7,0,.2,1) forwards; }
#voile.ouvre b { animation: titre .95s ease-out forwards; }
#voile.ferme { visibility: visible; clip-path: circle(150vmax at var(--x, 50%) var(--y, 90%)); animation: fond .8s ease-in forwards; }
#voile.ferme b { opacity: 1; transform: none; animation: sort .8s ease-in forwards; }
@keyframes jaillit { to { clip-path: circle(150vmax at var(--x, 50%) var(--y, 90%)); } }
@keyframes titre { 55% { opacity: 0; transform: scale(.6) rotate(-4deg); } 100% { opacity: 1; transform: scale(1) rotate(-2deg); } }
@keyframes fond { to { clip-path: circle(0 at 50% 50%); } }
@keyframes sort { to { opacity: 0; transform: scale(1.5) rotate(2deg); } }

/* ---------- édition 2026 : le site vire au jaune ---------- */
body[data-edition="2026"] .titre { color: var(--banane); text-shadow: 0 4px 0 rgba(20,39,90,.55); }
body[data-edition="2026"] #contenu_progression { background: #fff; }
body[data-edition="2026"] .reponses button { border-color: rgba(247,207,70,.45); }
@media (max-width: 760px) { #edition { bottom: 64px; } body { padding-bottom: 110px; } }
@media (max-height: 640px) { .titre { font-size: 2.4rem; margin: 6px 0; } .intro { margin-bottom: 14px; } }

/* ---------- fond : l'image Wankul passe du bleu au jaune par rotation de teinte ---------- */
body::after {
	content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
	background: var(--bleu-nuit) url('img/background.jpg') center / cover no-repeat;
	transition: filter .6s ease;
}
body[data-edition="2026"]::after { filter: hue-rotate(192deg) saturate(1.7) brightness(2.3) contrast(.9); }
body[data-edition="2026"] { color: #14275a; }
body[data-edition="2026"] .titre { color: #14275a; text-shadow: 0 4px 0 rgba(255,255,255,.55); }
body[data-edition="2026"] .intro, body[data-edition="2026"] .compteur, body[data-edition="2026"] .verdict { color: #3a3200; }
body[data-edition="2026"] .intro strong { color: #14275a; }
body[data-edition="2026"] .edition { background: #14275a; color: var(--banane); }
body[data-edition="2026"] .question, body[data-edition="2026"] #score { color: #14275a; }
body[data-edition="2026"] #contenu_progression { background: #14275a; }
body[data-edition="2026"] #progression { background: rgba(255,255,255,.4); }
body[data-edition="2026"] .pub { color: #3a3200; background: rgba(255,255,255,.35); border-color: rgba(20,39,90,.45); }
body[data-edition="2026"] .pub b { color: #14275a; }
body[data-edition="2026"] button#commencer, body[data-edition="2026"] #suivant, body[data-edition="2026"] #recommencer { background: #14275a; color: #fff; box-shadow: 0 5px 0 #0a1636; }
body[data-edition="2026"] .bilan_item { background: rgba(255,255,255,.55); }
body[data-edition="2026"] .bilan_quest { color: #14275a; }
body[data-edition="2026"] .bilan_mr { color: #0d7a3a; } body[data-edition="2026"] .bilan_mr.ko { color: #b3261e; }
body[data-edition="2026"] .bilan_brmr { color: #3a3200; }
body[data-edition="2026"] #son { background: rgba(20,39,90,.85); }

/* ---------- voile bleu pour le retour à l'édition classique ---------- */
#voile.bleu { background: radial-gradient(circle at var(--x, 50%) var(--y, 90%), #4f86e0 0%, #234a8f 55%, #12275a 100%); }
#voile.bleu b { color: #fff; }

#pied { position: fixed; left: 14px; bottom: 16px; z-index: 25; font-size: .78rem; color: var(--texte-doux); }
#pied a { color: inherit; }
body[data-edition="2026"] #pied { color: #3a3200; }
@media (max-width: 760px) { #pied { left: 50%; translate: -50% 0; bottom: 118px; } }
.titre { font-size: clamp(2.2rem, 6.5vw, 3.8rem); }
@media (max-width: 760px) { #pied { width: 92vw; text-align: center; line-height: 1.6; } }

/* ---------- barre du bas : sur mobile, liens + bouton d'édition + pub s'empilent sans se chevaucher ---------- */
#bas { display: contents; }
@media (max-width: 760px) {
	body { padding-bottom: 0; }
	#page { overflow-y: auto; overscroll-behavior: contain; }
	#bas {
		display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; position: relative; z-index: 30;
		padding: 8px 12px max(8px, env(safe-area-inset-bottom, 0px));
		background: rgba(8, 22, 60, .92); border-top: 1px solid rgba(255, 255, 255, .15);
	}
	#bas #pied, #bas #edition, #bas .pub-sticky { position: static; translate: none; margin: 0; }
	#bas .pub-sticky { width: var(--w); }
	#bas #pied { font-size: .72rem; text-align: center; line-height: 1.4; }
	#bas #edition { padding: 8px 22px; font-size: .88rem; }
	#bas .pub-sticky { display: flex; }
	body[data-edition="2026"] #bas { background: rgba(255, 244, 200, .94); }
	body[data-edition="2026"] #bas #pied { color: #3a3200; }
}
@media (max-width: 760px) and (max-height: 760px) {
	.pub-top { margin-top: 8px; }
	main { padding: 4px 0; }
	.question { font-size: 1.15rem; margin-bottom: 14px; }
	.reponses { gap: 8px; }
	.reponses button { padding: 11px 14px; font-size: .92rem; }
	#suivant { margin-top: 14px; padding: 11px 30px; }
	.compteur { margin-bottom: 4px; }
	.titre { font-size: 2.2rem; }
}
@media (max-width: 760px) { #page { padding-bottom: 12px; } main { padding-bottom: 10px; } }
