:root {
	--fond: #10131a;
	--fond-2: #181c26;
	--fond-3: #232937;
	--bord: #313a4d;
	--texte: #eef1f7;
	--texte-2: #a7b0c2;
	--accent: #ffb703;
	--accent-texte: #1b1400;
	--bon: #3ecf8e;
	--mauvais: #ff6b6b;
	--bleu: #5aa9ff;
	--rayon: 12px;
	color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--fond);
	color: var(--texte);
	font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
	-webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
a { color: var(--bleu); }
[hidden] { display: none !important; }

button, .bouton, input, select {
	font: inherit;
	color: inherit;
}
button, .bouton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	border: 1px solid var(--bord);
	background: var(--fond-3);
	padding: .55em 1em;
	border-radius: 10px;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}
button:hover:not(:disabled), .bouton:hover { border-color: var(--texte-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.principal { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); font-weight: 650; }
button.danger { color: var(--mauvais); }
button.petit { padding: .25em .6em; font-size: .85em; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }

input[type=text], input[type=password], input[type=number], input[type=url] {
	background: var(--fond);
	border: 1px solid var(--bord);
	border-radius: 10px;
	padding: .55em .75em;
	min-width: 0;
}

.carte {
	background: var(--fond-2);
	border: 1px solid var(--bord);
	border-radius: var(--rayon);
	padding: 1.1rem;
}
.muet { color: var(--texte-2); }
.erreur { color: var(--mauvais); }
.bon { color: var(--bon); }
.mauvais { color: var(--mauvais); }

.barre-temps { height: 6px; background: var(--fond-3); border-radius: 3px; overflow: hidden; }
.barre-temps > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.barre-temps.pause > span { background: var(--texte-2); }

.notification {
	position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
	background: var(--fond-3); border: 1px solid var(--bord); border-radius: 10px;
	padding: .7em 1.1em; max-width: calc(100% - 2rem); z-index: 50;
	box-shadow: 0 8px 30px rgb(0 0 0 / .4);
}
.notification.erreur { border-color: var(--mauvais); color: var(--texte); }

/* ---------- connexion ---------- */
.centre { min-height: 100%; display: grid; place-items: center; padding: 1rem; }
.connexion { width: min(380px, 100%); display: grid; gap: .8rem; }

/* ---------- joueur ---------- */
.joueur { max-width: 480px; margin: 0 auto; padding: 1rem; min-height: 100%; display: flex; flex-direction: column; gap: 1rem; }
.joueur header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.joueur header .score { font-weight: 700; color: var(--accent); }
.joueur .bloc { display: grid; gap: .9rem; text-align: center; }
.joueur form { display: grid; gap: .7rem; }
.joueur .saisie-annee {
	font-size: 2.6rem; text-align: center; letter-spacing: .12em; font-variant-numeric: tabular-nums;
	padding: .3em; width: 100%;
}
.joueur .gros { font-size: 3.4rem; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.joueur .verrou { font-size: 1.2rem; }
.joueur button.principal { font-size: 1.15rem; padding: .8em; }
.bandeau-pause { background: var(--fond-3); border: 1px dashed var(--texte-2); border-radius: 10px; padding: .5em; text-align: center; }

/* ---------- écran de présentation ---------- */
body.ecran { overflow: hidden; }
.ecran-racine { position: fixed; inset: 0; display: flex; flex-direction: column; }
.ecran-haut {
	display: flex; align-items: center; justify-content: space-between; gap: 2vw;
	padding: 1.2vh 2vw; font-size: clamp(16px, 2.2vw, 40px); font-weight: 650;
}
.ecran-haut .pastille { background: var(--fond-3); border-radius: 999px; padding: .15em .8em; }
.ecran-haut .points { color: var(--accent); }
.ecran-milieu { flex: 1; min-height: 0; position: relative; }
.ecran-bas { padding: 0 2vw 1.5vh; }
.ecran-bas .barre-temps { height: 1vh; min-height: 6px; }

.photo-plein { position: absolute; inset: 0; }
.photo-plein img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: apparition .5s ease-out; }
@keyframes apparition { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }

.qr-coin { position: absolute; right: 1.5vw; bottom: 1.5vh; background: #fff; padding: 6px; border-radius: 8px; width: clamp(70px, 8vw, 150px); opacity: .92; }
.qr-coin img { display: block; width: 100%; }

.ecran-accueil { height: 100%; display: grid; grid-template-columns: auto 1fr; gap: 4vw; align-items: center; padding: 3vh 5vw; }
.ecran-accueil .qr { background: #fff; padding: 1.2vw; border-radius: 1.5vw; width: min(42vh, 36vw); }
.ecran-accueil .qr img { display: block; width: 100%; }
.ecran-accueil h1 { font-size: clamp(28px, 5vw, 96px); }
.ecran-accueil .adresse { font-size: clamp(18px, 2.4vw, 46px); color: var(--accent); word-break: break-all; }
.ecran-accueil .rejoindre { font-size: clamp(16px, 1.8vw, 34px); color: var(--texte-2); }
.pseudos { display: flex; flex-wrap: wrap; gap: .5em; margin-top: 2vh; font-size: clamp(14px, 1.5vw, 28px); }
.pseudos span { background: var(--fond-3); border-radius: 999px; padding: .2em .8em; }

.revelation { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 27vw, 560px); gap: 1.5vw; padding: 0 1.5vw; min-height: 0; }
.revelation .mosaique { display: grid; gap: .8vw; align-content: center; min-height: 0; overflow: hidden; }
.revelation .mosaique img { width: 100%; height: 100%; object-fit: contain; border-radius: .6vw; min-height: 0; }
.annee-revelee { font-size: clamp(40px, 9vw, 200px); font-weight: 900; color: var(--accent); line-height: 1; text-align: center; animation: apparition .6s ease-out; }
.tableau-scores { display: flex; flex-direction: column; min-height: 0; }
.tableau-scores ol { list-style: none; margin: 0; padding: 0; overflow: hidden; display: grid; gap: .5vh; font-size: clamp(13px, 1.45vw, 30px); }
.tableau-scores li { display: grid; grid-template-columns: 2.4em 1fr auto auto; gap: .8em; align-items: center; background: var(--fond-2); border-radius: .5em; padding: .25em .7em; }
.tableau-scores li .rang { color: var(--texte-2); font-variant-numeric: tabular-nums; }
.tableau-scores li .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableau-scores li .reponse { font-variant-numeric: tabular-nums; font-size: .85em; }
.tableau-scores li .total { font-weight: 750; font-variant-numeric: tabular-nums; min-width: 4em; text-align: right; }
.tableau-scores.compact li { padding: .1em .6em; }

.fin { height: 100%; display: grid; grid-template-rows: auto 1fr; padding: 2vh 4vw; gap: 2vh; min-height: 0; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 2vw; font-size: clamp(16px, 2vw, 40px); }
.podium div { text-align: center; background: var(--fond-2); border-radius: 1vw 1vw 0 0; padding: 1vh 2vw; min-width: 14vw; }
.podium .p1 { min-height: 26vh; border-top: 6px solid var(--accent); }
.podium .p2 { min-height: 20vh; border-top: 6px solid #c0c7d4; }
.podium .p3 { min-height: 15vh; border-top: 6px solid #cd7f32; }
.podium strong { display: block; font-size: 1.3em; }
.podium .place { display: block; font-size: 2.2em; font-weight: 900; color: var(--texte-2); }
.podium .p1 .place { color: var(--accent); }

.voile-pause {
	position: absolute; inset: 0; display: grid; place-items: center; background: rgb(10 12 18 / .55);
	font-size: clamp(30px, 6vw, 120px); font-weight: 800; z-index: 5; backdrop-filter: blur(2px);
}
.bouton-plein-ecran { position: fixed; right: 1rem; top: 1rem; z-index: 20; opacity: .9; transition: opacity .3s; }
.bouton-plein-ecran.cache { opacity: 0; pointer-events: none; }
body.ecran.souris-cachee { cursor: none; }

/* ---------- pilotage ---------- */
.admin { max-width: 1400px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.admin > header { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; justify-content: space-between; }
.onglets { display: flex; gap: .3rem; }
.onglets button[aria-selected=true] { background: var(--accent); color: var(--accent-texte); border-color: var(--accent); }
.admin .grille { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .admin .grille { grid-template-columns: 1fr; } }
.admin .rangee { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.admin .etat-partie { font-size: 1.15rem; }
.admin .etat-partie strong { color: var(--accent); }
.admin .apercu { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.admin .apercu img { height: 64px; border-radius: 6px; opacity: .45; }
.admin .apercu img.vue { opacity: 1; }
.admin .apercu img.courante { outline: 3px solid var(--accent); }
.reglages { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.reglages label { display: grid; grid-template-rows: 1fr auto; align-items: end; gap: .25rem; font-size: .9rem; color: var(--texte-2); }
.reglages label input { color: var(--texte); }
.reglages .large { grid-column: 1 / -1; }
table.joueurs { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.joueurs th, table.joueurs td { padding: .35rem .4rem; border-bottom: 1px solid var(--bord); text-align: left; }
table.joueurs td.nombre, table.joueurs th.nombre { text-align: right; font-variant-numeric: tabular-nums; }

.liste-annees { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.annee {
	display: grid; grid-template-columns: auto 5.5rem 1fr auto; gap: .8rem; align-items: center;
	background: var(--fond-2); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .6rem .8rem;
}
.annee.survol { border-color: var(--accent); }
.annee.glisse { opacity: .4; }
.annee .poignee { cursor: grab; color: var(--texte-2); display: grid; gap: .15rem; }
.annee .poignee button { padding: .05em .45em; font-size: .8rem; }
.annee .titre { font-size: 1.35rem; font-weight: 750; }
.annee .titre small { display: block; font-size: .75rem; color: var(--texte-2); font-weight: 400; }
.annee .vide { color: var(--mauvais); font-size: .9rem; }
.vignettes { display: flex; flex-wrap: wrap; gap: .4rem; min-height: 56px; align-items: center; }
.vignette { position: relative; }
.vignette img { height: 72px; border-radius: 6px; display: block; cursor: grab; }
.vignette .num { position: absolute; left: 4px; top: 2px; font-size: .75rem; background: rgb(0 0 0 / .65); border-radius: 4px; padding: 0 .3em; }
.vignette button { position: absolute; right: 2px; top: 2px; padding: 0 .35em; font-size: .8rem; background: rgb(0 0 0 / .7); border-color: transparent; }
.vignette.cible-avant::before { content: ""; position: absolute; left: -4px; top: 0; bottom: 0; width: 3px; background: var(--accent); border-radius: 2px; }
.annee .actions { display: grid; gap: .3rem; justify-items: end; }
.annee .envoi { font-size: .85rem; color: var(--texte-2); }

dialog.visionneuse { border: none; padding: 0; background: transparent; max-width: 95vw; max-height: 95vh; }
dialog.visionneuse::backdrop { background: rgb(0 0 0 / .85); }
dialog.visionneuse img { max-width: 95vw; max-height: 95vh; display: block; }
.revelation .colonne-photos { min-height: 0; padding: 2vh 0; display: flex; }


.fin h1 { text-align: center; font-size: clamp(24px, 3.5vw, 70px); }
.admin .colonne { display: grid; gap: 1rem; }
.carte.pile { display: grid; gap: .6rem; }
.espace-haut { margin-top: .8rem; }

.toutes-photos { position: absolute; inset: 1vh 2vw 2vh; display: flex; }
.mosaique-dynamique { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; overflow: hidden; }
.mosaique-dynamique .rangee-photos { display: flex; gap: 12px; justify-content: center; }
.mosaique-dynamique img { display: block; border-radius: 8px; object-fit: cover; box-shadow: 0 6px 24px rgb(0 0 0 / .45); }
.mosaique-dynamique.animee img { animation: entree-mosaique .6s ease-out both; }
@keyframes entree-mosaique { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }

/* Révélation de la bonne année */
.panneau-scores { display: flex; flex-direction: column; gap: 1.5vh; padding: 2vh 0; min-height: 0; }
.annee-badge {
	font-size: clamp(36px, 6vw, 130px); font-weight: 900; color: var(--accent); line-height: 1; text-align: center;
	animation: badge-arrivee .5s ease-out 2.3s both;
}
@keyframes badge-arrivee { from { opacity: 0; transform: translateY(-30px) scale(1.4); } to { opacity: 1; transform: none; } }
.panneau-scores .tableau-scores li { animation: ligne-arrivee .4s ease-out both; animation-delay: calc(2.6s + var(--i, 0) * 60ms); }
.panneau-scores .tableau-scores ol { font-size: clamp(13px, 1.25vw, 26px); }
@keyframes ligne-arrivee { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.revelation .colonne-photos { animation: photos-recul 2.6s ease-in-out both; }
@keyframes photos-recul { 0%, 10% { filter: brightness(1); } 25%, 80% { filter: brightness(.35) blur(2px); } 100% { filter: none; } }
.annee-anim {
	position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 4;
	animation: anim-fin 2.6s linear both;
}
.annee-anim span {
	font-size: clamp(90px, 30vw, 620px); font-weight: 900; color: var(--accent); line-height: 1;
	text-shadow: 0 0 60px rgb(255 183 3 / .45), 0 10px 40px rgb(0 0 0 / .6);
	animation: annee-surgit 2.6s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes annee-surgit {
	0% { opacity: 0; transform: scale(.2) rotate(-8deg); filter: blur(12px); }
	22% { opacity: 1; transform: scale(1.08) rotate(0); filter: none; }
	30% { transform: scale(1); }
	78% { opacity: 1; transform: scale(1); }
	100% { opacity: 0; transform: translate(34vw, -38vh) scale(.2); }
}
@keyframes anim-fin { 0%, 99% { visibility: visible; } 100% { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
	.annee-anim { display: none; }
	.annee-badge, .panneau-scores .tableau-scores li, .revelation .colonne-photos { animation: none; }
}

/* Photo choisie en grand par-dessus la mosaïque */
.mosaique-dynamique img { cursor: zoom-in; }
.zoom-photo {
	position: absolute; inset: 0; z-index: 6; cursor: zoom-out;
	background: rgb(10 12 18 / .92); animation: zoom-fond .35s ease-out both;
}
.zoom-photo img { position: absolute; inset: 1.5vh 1.5vw; width: calc(100% - 3vw); height: calc(100% - 3vh); object-fit: contain; animation: zoom-entree .45s cubic-bezier(.2, .8, .2, 1) both; }
.zoom-photo .zoom-num { position: absolute; right: 2vw; bottom: 2vh; background: rgb(0 0 0 / .6); border-radius: 999px; padding: .2em .8em; font-size: clamp(14px, 1.4vw, 28px); }
.zoom-photo.sortie { pointer-events: none; animation: zoom-fond-sortie .25s ease-in both; }
.zoom-photo.sortie img { animation: zoom-sortie .25s ease-in both; }
@keyframes zoom-fond-sortie { to { opacity: 0; } }
@keyframes zoom-sortie { to { opacity: 0; transform: scale(.6); } }
@keyframes zoom-fond { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoom-entree { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.admin .apercu.cliquable img { cursor: zoom-in; opacity: 1; }
.admin .apercu img.zoomee { outline: 3px solid var(--bleu); }

/* Préparer : manche d'essai et clip */
.grille-preparer { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grille-preparer { grid-template-columns: 1fr; } }
.reponse-essai { display: block; font-size: .8rem; font-weight: 400; color: var(--texte-2); }
.reponse-essai select { font: inherit; background: var(--fond); border: 1px solid var(--bord); border-radius: 6px; color: var(--texte); }
.apercu-clip { width: 100%; max-height: 260px; border-radius: 8px; background: #000; }

/* Clip en plein écran sur la TV */
.clip-plein { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; place-items: center; }
.clip-plein video { width: 100%; height: 100%; object-fit: contain; }
.clip-plein button { position: absolute; font-size: clamp(18px, 2.4vw, 44px); padding: .8em 1.4em; }
.centre-texte { text-align: center; margin: 0; }
.panneau-scores .centre-texte { animation: badge-arrivee .5s ease-out 2.3s both; }
