/* =====================================================================
 *  QuizPulse — Feuille de style des interfaces joueur et projection
 * ---------------------------------------------------------------------
 *  Aucune police distante, aucun framework : tout est local, donc tout
 *  fonctionne meme si le reseau de la salle est capricieux.
 *  Deux echelles cohabitent :
 *    - le telephone du joueur   (body.qp-player)
 *    - le videoprojecteur       (body.qp-screen, typographie x2)
 * ===================================================================== */

:root {
	--bg: #0b0f1a;
	--bg-2: #070a12;
	--card: #141a2b;
	--card-2: #1a2236;
	--line: #243049;
	--ink: #eef2ff;
	--muted: #93a0c0;
	--ok: #3ddc97;
	--ko: #ff6b6b;
	--warn: #ffd166;
	--accent: #7c5cff;
	--accent-2: #4cc9f0;
	--gold: #ffd166;
	--silver: #cbd5e1;
	--bronze: #d99a6c;

	--radius: 18px;
	--radius-s: 12px;
	--shadow: 0 18px 50px rgba(4, 7, 18, .55);
	--shadow-s: 0 8px 24px rgba(4, 7, 18, .4);
	--ring: 0 0 0 3px rgba(124, 92, 255, .35);
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
	margin: 0;
	font-family: var(--font);
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-wrap: break-word;
}

/* Fond anime : trois halos qui respirent lentement. Discret, mais la
   salle sent tout de suite que la plateforme est vivante. */
body::before {
	content: "";
	position: fixed;
	inset: -20vh -10vw;
	z-index: -2;
	background:
		radial-gradient(42vw 42vw at 12% 8%, rgba(124, 92, 255, .30), transparent 62%),
		radial-gradient(38vw 38vw at 88% 12%, rgba(76, 201, 240, .22), transparent 60%),
		radial-gradient(48vw 48vw at 50% 108%, rgba(61, 220, 151, .16), transparent 60%);
	filter: blur(10px);
	animation: qp-breathe 22s ease-in-out infinite alternate;
}

body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background: linear-gradient(180deg, rgba(7, 10, 18, .35), rgba(7, 10, 18, .85));
	pointer-events: none;
}

@keyframes qp-breathe {
	from { transform: scale(1) translateY(0); }
	to   { transform: scale(1.08) translateY(-2vh); }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
}

/* ---------------------------------------------------------------------
 *  Structure
 * ------------------------------------------------------------------- */
.qp-wrap {
	width: 100%;
	max-width: 560px;
	margin: 0 auto;
	padding: 18px 16px 40px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-height: 100%;
}

.qp-wrap.is-wide { max-width: 1080px; }

.qp-top {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 4px 2px;
}

.qp-logo {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-weight: 800;
	letter-spacing: .3px;
	font-size: 1.05rem;
}

.qp-logo .spark {
	width: 30px;
	height: 30px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	box-shadow: 0 6px 18px rgba(124, 92, 255, .45);
	font-size: 1rem;
}

.qp-spacer { flex: 1; }

.card {
	background: linear-gradient(180deg, var(--card-2), var(--card));
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 18px;
}

.card.is-tight { padding: 14px; }
.card.is-flat { box-shadow: none; background: rgba(20, 26, 43, .72); }

.card-title {
	margin: 0 0 4px;
	font-size: 1.15rem;
	font-weight: 750;
}

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.is-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------------
 *  Champs et boutons
 * ------------------------------------------------------------------- */
label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 6px; }

input[type="text"], input[type="number"], input[type="password"],
input[type="search"], input[type="datetime-local"], textarea, select {
	width: 100%;
	padding: 13px 14px;
	font: inherit;
	color: var(--ink);
	background: rgba(7, 10, 18, .6);
	border: 1px solid var(--line);
	border-radius: var(--radius-s);
	outline: none;
	transition: border-color .15s, box-shadow .15s, background .15s;
}

input::placeholder, textarea::placeholder { color: #5f6c8c; }

input:focus, textarea:focus, select:focus {
	border-color: var(--accent);
	box-shadow: var(--ring);
	background: rgba(7, 10, 18, .85);
}

textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.btn {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 18px;
	min-height: 48px;
	font: inherit;
	font-weight: 650;
	color: var(--ink);
	background: rgba(36, 48, 73, .55);
	border: 1px solid var(--line);
	border-radius: 14px;
	cursor: pointer;
	transition: transform .12s, filter .15s, background .15s, box-shadow .15s;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }

.btn[disabled], .btn.is-busy {
	opacity: .55;
	cursor: not-allowed;
	transform: none;
}

.btn-primary {
	background: linear-gradient(135deg, var(--accent), #5b6cff);
	border-color: transparent;
	box-shadow: 0 12px 30px rgba(124, 92, 255, .38);
}

.btn-ok { background: linear-gradient(135deg, #2fbd82, var(--ok)); border-color: transparent; color: #04170f; }
.btn-ko { background: linear-gradient(135deg, #e05555, var(--ko)); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; font-size: 1.08rem; border-radius: 16px; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: .85rem; border-radius: 10px; }

/* ---------------------------------------------------------------------
 *  Etiquettes
 * ------------------------------------------------------------------- */
.pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px;
	border-radius: 999px;
	font-size: .78rem;
	font-weight: 650;
	background: rgba(124, 92, 255, .16);
	border: 1px solid rgba(124, 92, 255, .34);
	color: #cfc4ff;
}

.pill.is-ok { background: rgba(61, 220, 151, .14); border-color: rgba(61, 220, 151, .35); color: #a9f2d1; }
.pill.is-ko { background: rgba(255, 107, 107, .14); border-color: rgba(255, 107, 107, .35); color: #ffc4c4; }
.pill.is-warn { background: rgba(255, 209, 102, .14); border-color: rgba(255, 209, 102, .35); color: #ffe6ac; }
.pill.is-mute { background: rgba(147, 160, 192, .12); border-color: rgba(147, 160, 192, .28); color: var(--muted); }

.star-tag {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: .74rem;
	font-weight: 700;
	color: #2a1e00;
	background: linear-gradient(135deg, #ffe08a, var(--gold));
	box-shadow: 0 4px 14px rgba(255, 209, 102, .35);
}

/* ---------------------------------------------------------------------
 *  Compteur de temps
 * ------------------------------------------------------------------- */
.timer {
	--pct: 100;
	position: relative;
	width: 84px;
	height: 84px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	background:
		conic-gradient(var(--accent) calc(var(--pct) * 1%), rgba(36, 48, 73, .65) 0);
	transition: background .25s linear;
}

.timer::after {
	content: "";
	position: absolute;
	inset: 7px;
	border-radius: 50%;
	background: var(--bg);
	border: 1px solid var(--line);
}

.timer > span {
	position: relative;
	z-index: 1;
	font-size: 1.6rem;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

.timer.is-hurry { background: conic-gradient(var(--warn) calc(var(--pct) * 1%), rgba(36, 48, 73, .65) 0); }
.timer.is-hurry > span { color: var(--warn); }
.timer.is-panic { background: conic-gradient(var(--ko) calc(var(--pct) * 1%), rgba(36, 48, 73, .65) 0); animation: qp-pulse .9s ease-in-out infinite; }
.timer.is-panic > span { color: var(--ko); }

@keyframes qp-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.06); }
}

.bar {
	height: 8px;
	border-radius: 999px;
	background: rgba(36, 48, 73, .7);
	overflow: hidden;
}

.bar > i {
	display: block;
	height: 100%;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	transition: width .35s ease;
}

/* ---------------------------------------------------------------------
 *  Question et reponses du joueur
 * ------------------------------------------------------------------- */
.q-head { display: flex; align-items: center; gap: 14px; }

.q-prompt {
	margin: 0;
	font-size: clamp(1.25rem, 5.2vw, 1.7rem);
	line-height: 1.32;
	font-weight: 700;
}

.q-hint { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

.choices { display: grid; gap: 11px; }
.choices.is-duo { grid-template-columns: 1fr 1fr; }

.choice {
	display: flex;
	align-items: center;
	gap: 13px;
	width: 100%;
	padding: 15px 16px;
	text-align: left;
	font: inherit;
	font-weight: 600;
	color: var(--ink);
	background: rgba(7, 10, 18, .55);
	border: 1.5px solid var(--line);
	border-radius: 16px;
	cursor: pointer;
	transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
	-webkit-tap-highlight-color: transparent;
}

.choice:hover { border-color: rgba(124, 92, 255, .55); }
.choice:active { transform: scale(.985); }

.choice .key {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 10px;
	display: grid;
	place-items: center;
	font-weight: 800;
	background: rgba(124, 92, 255, .18);
	border: 1px solid rgba(124, 92, 255, .32);
	text-transform: uppercase;
}

.choice.is-picked {
	border-color: var(--accent);
	background: rgba(124, 92, 255, .18);
	box-shadow: 0 10px 26px rgba(124, 92, 255, .28);
}

.choice.is-picked .key { background: var(--accent); border-color: transparent; color: #0b0f1a; }

.choice.is-right { border-color: var(--ok); background: rgba(61, 220, 151, .16); }
.choice.is-right .key { background: var(--ok); color: #04170f; border-color: transparent; }
.choice.is-wrong { border-color: var(--ko); background: rgba(255, 107, 107, .14); }
.choice[disabled] { cursor: default; opacity: .95; }

/* Texte a trous : un champ par trou, aligne dans la phrase */
.cloze { font-size: 1.06rem; line-height: 2.35; }

.cloze .blank {
	display: inline-block;
	width: clamp(90px, 34vw, 190px);
	padding: 7px 10px;
	margin: 0 4px;
	vertical-align: baseline;
	text-align: center;
	font-weight: 700;
	border-radius: 10px;
	border: 1.5px dashed rgba(124, 92, 255, .5);
	background: rgba(124, 92, 255, .08);
}

.cloze .blank:focus { border-style: solid; }
.cloze .blank-no {
	display: inline-block;
	min-width: 20px;
	font-size: .7rem;
	color: var(--muted);
	vertical-align: super;
}

.verdict {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: rgba(7, 10, 18, .55);
	animation: qp-pop .35s cubic-bezier(.2, 1.4, .4, 1);
}

.verdict.is-ok { border-color: rgba(61, 220, 151, .45); background: rgba(61, 220, 151, .12); }
.verdict.is-ko { border-color: rgba(255, 107, 107, .45); background: rgba(255, 107, 107, .1); }
.verdict .big { font-size: 1.9rem; font-weight: 850; font-variant-numeric: tabular-nums; }

@keyframes qp-pop {
	from { transform: scale(.9); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

.qp-me {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.qp-me .box {
	padding: 12px 10px;
	border-radius: var(--radius-s);
	background: rgba(7, 10, 18, .5);
	border: 1px solid var(--line);
	text-align: center;
}

.qp-me .box b {
	display: block;
	font-size: 1.4rem;
	font-variant-numeric: tabular-nums;
}

.qp-me .box span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------------------------------------------------------------------
 *  Classement
 * ------------------------------------------------------------------- */
.board { display: flex; flex-direction: column; gap: 8px; }

.board-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	border-radius: 14px;
	background: rgba(7, 10, 18, .5);
	border: 1px solid var(--line);
	animation: qp-slide .35s ease both;
}

.board-row .rank {
	flex: 0 0 auto;
	min-width: 40px;
	font-weight: 850;
	font-variant-numeric: tabular-nums;
	color: var(--muted);
	text-align: right;
}

.board-row .who { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .pts { font-weight: 800; font-variant-numeric: tabular-nums; }

.board-row.is-1 { border-color: rgba(255, 209, 102, .5); background: linear-gradient(90deg, rgba(255, 209, 102, .16), rgba(7, 10, 18, .5)); }
.board-row.is-1 .rank, .board-row.is-1 .pts { color: var(--gold); }
.board-row.is-2 { border-color: rgba(203, 213, 225, .4); }
.board-row.is-2 .rank { color: var(--silver); }
.board-row.is-3 { border-color: rgba(217, 154, 108, .4); }
.board-row.is-3 .rank { color: var(--bronze); }
.board-row.is-me { outline: 2px solid var(--accent); }

@keyframes qp-slide {
	from { transform: translateY(9px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

/* ---------------------------------------------------------------------
 *  Projection : tout est plus grand, lisible du fond de la salle
 * ------------------------------------------------------------------- */
body.qp-screen { overflow: hidden; }

.screen {
	height: 100vh;
	display: flex;
	flex-direction: column;
	padding: clamp(18px, 2.4vh, 34px) clamp(20px, 3vw, 56px);
	gap: clamp(12px, 2vh, 26px);
}

.screen-top {
	display: flex;
	align-items: center;
	gap: 18px;
	flex: 0 0 auto;
}

.screen-top .title { font-size: clamp(1.1rem, 1.8vw, 1.6rem); font-weight: 800; }
.screen-top .sub { color: var(--muted); font-size: clamp(.85rem, 1.2vw, 1.1rem); }

.screen-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: clamp(14px, 2.4vh, 30px);
}

.screen-huge {
	font-size: clamp(2rem, 4.4vw, 4.4rem);
	line-height: 1.14;
	font-weight: 850;
	margin: 0;
	text-wrap: balance;
}

.screen-prompt {
	font-size: clamp(1.6rem, 3.2vw, 3.2rem);
	line-height: 1.24;
	font-weight: 800;
	margin: 0;
	text-wrap: balance;
}

.screen-choices {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: clamp(10px, 1.6vh, 20px);
}

.screen-choices.is-solo { grid-template-columns: minmax(0, 1fr); }

.screen-choice {
	display: flex;
	align-items: center;
	gap: 18px;
	padding: clamp(12px, 1.8vh, 22px) clamp(14px, 1.6vw, 26px);
	border-radius: 18px;
	background: rgba(20, 26, 43, .8);
	border: 2px solid var(--line);
	font-size: clamp(1.1rem, 1.9vw, 2rem);
	font-weight: 700;
	position: relative;
	overflow: hidden;
}

.screen-choice .key {
	width: clamp(38px, 3.2vw, 58px);
	height: clamp(38px, 3.2vw, 58px);
	border-radius: 14px;
	display: grid;
	place-items: center;
	background: rgba(124, 92, 255, .2);
	border: 1px solid rgba(124, 92, 255, .35);
	font-weight: 850;
	text-transform: uppercase;
	flex: 0 0 auto;
}

.screen-choice .fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: rgba(124, 92, 255, .22);
	transition: width .6s cubic-bezier(.2, .8, .2, 1);
	z-index: 0;
}

.screen-choice > * { position: relative; z-index: 1; }
.screen-choice .share { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.screen-choice.is-right { border-color: var(--ok); }
.screen-choice.is-right .fill { background: rgba(61, 220, 151, .22); }
.screen-choice.is-right .key { background: var(--ok); color: #04170f; border-color: transparent; }

.screen-timer {
	margin-left: auto;
	width: clamp(90px, 8vw, 148px);
	height: clamp(90px, 8vw, 148px);
}

.screen-timer > span { font-size: clamp(2rem, 3.4vw, 3.4rem); }

.counter {
	display: inline-flex;
	align-items: baseline;
	gap: 10px;
	font-variant-numeric: tabular-nums;
}

.counter b { font-size: clamp(2rem, 4vw, 4rem); font-weight: 850; }

/* Classement projete : deux colonnes quand la liste est longue */
.screen-board {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
	gap: clamp(8px, 1.2vh, 16px);
	align-content: start;
	overflow: hidden;
}

.screen-board .board-row {
	padding: clamp(9px, 1.3vh, 16px) clamp(12px, 1.4vw, 22px);
	font-size: clamp(1rem, 1.6vw, 1.7rem);
}

.screen-board .board-row .rank { min-width: clamp(48px, 4vw, 78px); }

/* Podium */
.podium {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: clamp(14px, 2vw, 40px);
	min-height: 0;
	flex: 1;
	padding-bottom: 2vh;
}

.podium .step {
	flex: 0 1 clamp(150px, 20vw, 300px);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	animation: qp-rise .7s cubic-bezier(.2, 1.1, .3, 1) both;
}

.podium .step .avatar {
	width: clamp(64px, 6.5vw, 118px);
	height: clamp(64px, 6.5vw, 118px);
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: clamp(1.6rem, 2.6vw, 2.8rem);
	font-weight: 850;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	color: #070a12;
	box-shadow: 0 14px 34px rgba(124, 92, 255, .4);
}

.podium .step .who {
	font-size: clamp(1.05rem, 1.9vw, 2rem);
	font-weight: 800;
	text-align: center;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.podium .step .pts { font-size: clamp(1rem, 1.6vw, 1.7rem); font-variant-numeric: tabular-nums; color: var(--muted); }

.podium .step .block {
	width: 100%;
	border-radius: 18px 18px 0 0;
	background: linear-gradient(180deg, rgba(124, 92, 255, .35), rgba(20, 26, 43, .9));
	border: 1px solid var(--line);
	border-bottom: none;
	display: grid;
	place-items: center;
	font-size: clamp(2rem, 4vw, 4.5rem);
	font-weight: 900;
	color: rgba(238, 242, 255, .55);
}

.podium .step.p1 { order: 2; }
.podium .step.p1 .block { height: clamp(150px, 26vh, 300px); background: linear-gradient(180deg, rgba(255, 209, 102, .45), rgba(20, 26, 43, .9)); border-color: rgba(255, 209, 102, .5); }
.podium .step.p1 .avatar { background: linear-gradient(135deg, #ffe08a, var(--gold)); box-shadow: 0 16px 40px rgba(255, 209, 102, .45); }
.podium .step.p2 { order: 1; animation-delay: .12s; }
.podium .step.p2 .block { height: clamp(110px, 19vh, 220px); }
.podium .step.p3 { order: 3; animation-delay: .24s; }
.podium .step.p3 .block { height: clamp(80px, 14vh, 165px); }

@keyframes qp-rise {
	from { transform: translateY(40px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

/* Vedette seule, plein ecran */
.solo {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(10px, 2vh, 24px);
	flex: 1;
	text-align: center;
}

.solo .avatar {
	width: clamp(120px, 14vw, 240px);
	height: clamp(120px, 14vw, 240px);
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-size: clamp(3rem, 6vw, 6rem);
	font-weight: 900;
	background: linear-gradient(135deg, #ffe08a, var(--gold));
	color: #2a1e00;
	box-shadow: 0 24px 60px rgba(255, 209, 102, .4);
	animation: qp-pop .5s cubic-bezier(.2, 1.4, .4, 1);
}

.solo .name { font-size: clamp(2rem, 5vw, 5rem); font-weight: 900; }
.solo .pts { font-size: clamp(1.4rem, 3vw, 3rem); color: var(--gold); font-variant-numeric: tabular-nums; }

/* Duel : deux vedettes face a face */
.duel {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: clamp(12px, 2vw, 32px);
}

.duel .vs {
	font-size: clamp(1.6rem, 3vw, 3rem);
	font-weight: 900;
	color: var(--accent);
	opacity: .85;
}

.duel .side {
	padding: clamp(12px, 2vh, 24px);
	border-radius: 20px;
	background: rgba(20, 26, 43, .8);
	border: 2px solid var(--line);
	text-align: center;
	font-size: clamp(1.1rem, 2.2vw, 2.2rem);
	font-weight: 800;
}

/* Nuage de mots */
.cloud {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: clamp(6px, 1vw, 20px);
	flex: 1;
	align-content: center;
	line-height: 1.05;
	overflow: hidden;
}

.cloud .w {
	font-weight: 800;
	padding: 2px 6px;
	border-radius: 10px;
	animation: qp-pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
	white-space: nowrap;
}

.cloud .w small { font-size: .5em; color: var(--muted); margin-left: .3em; font-weight: 600; }

/* QR et lien de connexion */
.qr-panel {
	display: flex;
	align-items: center;
	gap: clamp(16px, 3vw, 48px);
	flex-wrap: wrap;
	justify-content: center;
}

.qr-box {
	padding: clamp(12px, 1.6vw, 22px);
	background: #fff;
	border-radius: 20px;
	box-shadow: var(--shadow);
	line-height: 0;
}

.qr-box canvas, .qr-box svg { display: block; width: clamp(180px, 26vw, 420px); height: auto; image-rendering: pixelated; }

.join-url {
	font-family: var(--mono);
	font-size: clamp(1rem, 2.2vw, 2.2rem);
	font-weight: 700;
	padding: 12px 18px;
	border-radius: 14px;
	background: rgba(7, 10, 18, .6);
	border: 1px dashed var(--line);
	word-break: break-all;
}

/* ---------------------------------------------------------------------
 *  Messages flottants et etat reseau
 * ------------------------------------------------------------------- */
.qp-toasts {
	position: fixed;
	left: 50%;
	bottom: 22px;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 60;
	width: min(92vw, 460px);
	pointer-events: none;
}

.qp-toast {
	padding: 12px 16px;
	border-radius: 14px;
	background: rgba(20, 26, 43, .96);
	border: 1px solid var(--line);
	box-shadow: var(--shadow-s);
	font-weight: 600;
	font-size: .92rem;
	animation: qp-toast-in .28s ease both;
}

.qp-toast.is-ok { border-color: rgba(61, 220, 151, .5); }
.qp-toast.is-ko { border-color: rgba(255, 107, 107, .5); }
.qp-toast.is-warn { border-color: rgba(255, 209, 102, .5); }
.qp-toast.is-leaving { animation: qp-toast-out .3s ease both; }

@keyframes qp-toast-in {
	from { transform: translateY(14px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

@keyframes qp-toast-out {
	to { transform: translateY(10px); opacity: 0; }
}

.qp-net {
	position: fixed;
	top: 10px;
	left: 50%;
	transform: translateX(-50%);
	padding: 6px 14px;
	border-radius: 999px;
	font-size: .78rem;
	font-weight: 700;
	z-index: 60;
}

.qp-net.is-off { background: rgba(255, 107, 107, .2); border: 1px solid rgba(255, 107, 107, .5); color: #ffc4c4; }
.qp-net.is-warn { background: rgba(255, 209, 102, .18); border: 1px solid rgba(255, 209, 102, .45); color: #ffe6ac; }
.qp-net.is-on { background: rgba(61, 220, 151, .18); border: 1px solid rgba(61, 220, 151, .45); color: #a9f2d1; }

.qp-confetti {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 55;
	transition: opacity .5s;
}

.qp-confetti.is-leaving { opacity: 0; }

/* Ecran d'attente : petit pouls de patience */
.waiting-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--accent);
	animation: qp-blink 1.4s ease-in-out infinite;
}

@keyframes qp-blink {
	0%, 100% { opacity: .25; transform: scale(.85); }
	50% { opacity: 1; transform: scale(1.15); }
}

.skeleton {
	height: 14px;
	border-radius: 8px;
	background: linear-gradient(90deg, rgba(36, 48, 73, .5), rgba(60, 76, 112, .8), rgba(36, 48, 73, .5));
	background-size: 200% 100%;
	animation: qp-shine 1.4s linear infinite;
}

@keyframes qp-shine {
	from { background-position: 0 0; }
	to { background-position: -200% 0; }
}

/* Ecrans etroits */
@media (max-width: 420px) {
	.qp-wrap { padding: 14px 12px 32px; }
	.card { padding: 15px; border-radius: 16px; }
	.choices.is-duo { grid-template-columns: 1fr; }
}

/* Impression : la feuille de secours de l'animateur */
@media print {
	body { background: #fff; color: #000; }
	body::before, body::after { display: none; }
	.card { box-shadow: none; border: 1px solid #ccc; background: #fff; color: #000; }
}

/* =====================================================================
 *  Reponse attendue d'une question ecrite
 * ---------------------------------------------------------------------
 *  Sur une question a saisir, la bonne reponse doit sauter aux yeux :
 *  cadre vert, gros caracteres, bien detachee de "ta reponse".
 * ===================================================================== */
.answer-box {
	margin-top: 14px;
	padding: 16px 18px;
	border: 2px solid var(--ok);
	border-radius: 16px;
	background: rgba(61, 220, 151, .1);
	text-align: center;
}

.answer-box .answer-label {
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--ok);
	margin-bottom: 6px;
}

.answer-box .answer-text {
	font-size: clamp(1.25rem, 5vw, 1.7rem);
	font-weight: 850;
	line-height: 1.25;
	color: var(--ink);
	word-break: break-word;
}
/* =====================================================================
 *  Lien de connexion sur l'ecran de projection
 * ---------------------------------------------------------------------
 *  L'URL tient sur une ligne propre et le code de salle passe en gros
 *  sur la ligne suivante : lisible du fond de la salle.
 * ===================================================================== */
.join-url {
	word-break: break-all;
	line-height: 1.25;
}

.join-code {
	display: inline-block;
	font-size: clamp(1.5rem, 3.5vw, 2.6rem);
	font-weight: 900;
	letter-spacing: .2em;
	color: var(--accent-2);
	margin-top: 4px;
}

/* Texte a trous : le mot a trouver ressort en grand dans la phrase */
.cloze-answer {
	display: inline-block;
	color: var(--ok);
	font-size: 1.55em;
	font-weight: 900;
	letter-spacing: .04em;
	padding: 0 4px;
}

.cloze-full {
	font-size: clamp(1.05rem, 4vw, 1.35rem);
	line-height: 1.7;
}

/* =====================================================================
 *  Vue PAUSE de l'ecran de projection : minuteur bien visible au-dessus
 *  du classement, qui reste affiche et defilable pendant toute la pause.
 * ===================================================================== */
.pause-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(12px, 2.4vw, 28px);
}

.pause-bar-clock {
	font-size: clamp(2.2rem, 6vw, 4.2rem);
	font-weight: 900;
	font-variant-numeric: tabular-nums;
	color: var(--accent, #7c5cff);
	line-height: 1;
}

.screen-board.is-scroll {
	overflow-y: auto;
	max-height: 62vh;
	max-width: min(980px, 92vw);
	margin: 0 auto;
	width: 100%;
}

/* =====================================================================
 *  Rond de presence (liste des inscrits, ecran de bienvenue / attente)
 * ===================================================================== */
.live-dot {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
}

.live-dot.is-on {
	background: #3ddc97;
	box-shadow: 0 0 8px rgba(61, 220, 151, .55);
}

/* =====================================================================
 *  Ecran de projection : la page tient TOUJOURS dans la fenetre.
 *  Plus besoin de dezoomer : le bandeau reste en haut, chaque vue
 *  occupe la place disponible, et seules les listes defilent a
 *  l'interieur — la page elle-meme ne bouge plus jamais.
 * ===================================================================== */
body.qp-screen {
	height: 100vh;
	overflow: hidden;
}

.qp-screen .screen {
	height: 100vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.qp-screen .screen-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.qp-screen .screen-body > .stack,
.qp-screen .screen-body > .solo,
.qp-screen .screen-body > .qr-panel {
	flex: 1;
	min-height: 0;
	max-height: 100%;
	overflow: hidden;
}

/* Classement compact : plus de lignes visibles sans dezoomer, et le
   tableau defile a l'interieur s'il est vraiment trop long. */
.qp-screen .screen-board {
	gap: clamp(5px, 0.8vh, 10px);
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

.qp-screen .screen-board .board-row {
	padding: clamp(4px, 0.7vh, 10px) clamp(10px, 1vw, 18px);
	font-size: clamp(0.85rem, 1.25vw, 1.35rem);
}

.qp-screen .screen-board .board-row .rank {
	min-width: clamp(34px, 3vw, 56px);
}

.qp-screen .screen-board.is-scroll {
	max-height: none;
}

/* Salle d'attente : le QR et la colonne (compteurs + liste) partagent
   l'ecran ; la colonne defile a l'interieur, la page jamais. */
.qp-screen .qr-panel {
	flex-wrap: nowrap;
	max-height: 100%;
}

.qp-screen .qr-panel > .stack {
	min-height: 0;
	overflow-y: auto;
}


/* =====================================================================
 *  Vue MEDIA de l'ecran de projection : image ou video en plein ecran
 * ===================================================================== */
.screen-media {
	position: fixed;
	inset: 0;
	z-index: 5;
	background: #000;
	display: grid;
	place-items: center;
}
.screen-media img,
.screen-media video {
	max-width: 100vw;
	max-height: 100vh;
	object-fit: contain;
}

/* =====================================================================
 *  Bandeau haut compact : RIEN ne deborde, quel que soit l'ecran
 * ===================================================================== */
.screen-top {
	flex-wrap: nowrap;
	min-height: 0;
}
.screen-top .title {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.screen-top .sub {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#scMiniQr {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
}
#scMiniQr canvas {
	width: 64px !important;
	height: 64px !important;
}
#scMiniQr .join-url {
	font-size: clamp(.7rem, 1vw, 1rem);
	padding: 4px 8px;
	max-width: 28vw;
}
.screen-top .counter {
	flex: 0 0 auto;
}
/* Ecrans de faible hauteur (videoprojecteur, fenetre reduite) */
@media (max-height: 760px) {
	.screen { gap: 8px; padding-top: 10px; padding-bottom: 10px; }
	.screen-prompt { font-size: clamp(1.3rem, 2.6vw, 2.6rem); }
	.screen-choice { padding: 8px 14px; font-size: clamp(.95rem, 1.6vw, 1.7rem); }
	.screen-huge { font-size: clamp(1.6rem, 3.4vw, 3.4rem); }
	.answer-box, .card.is-flat { padding: 10px 14px; }
	#scMiniQr canvas { width: 48px !important; height: 48px !important; }
}

/* =====================================================================
 *  Mode GEANT (touche G sur l'ecran de projection)
 * ===================================================================== */
body.qp-giant .screen-prompt { font-size: clamp(2rem, 4.8vw, 5rem); }
body.qp-giant .screen-huge { font-size: clamp(2.4rem, 5.2vw, 5.6rem); }
body.qp-giant .screen-choice {
	font-size: clamp(1.3rem, 2.5vw, 2.8rem);
	padding: clamp(14px, 2.4vh, 28px) clamp(16px, 2vw, 32px);
}
body.qp-giant .screen-choice .key {
	width: clamp(48px, 4vw, 76px);
	height: clamp(48px, 4vw, 76px);
}
body.qp-giant .board-row { font-size: clamp(1.2rem, 2vw, 2.1rem); }
body.qp-giant .screen-timer {
	width: clamp(110px, 10vw, 190px);
	height: clamp(110px, 10vw, 190px);
}


/* =====================================================================
 *  Telecommande visible de l'ecran de projection (bas-droite)
 * ===================================================================== */
.sc-ctl {
	position: fixed;
	right: 14px;
	bottom: 12px;
	z-index: 70;
	display: flex;
	gap: 8px;
	opacity: .18;
	transition: opacity .25s;
}
.sc-ctl:hover { opacity: 1; }
.sc-ctl button {
	padding: 8px 14px;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: rgba(20, 26, 43, .92);
	color: var(--muted);
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}
.sc-ctl button.is-on {
	background: var(--accent);
	border-color: transparent;
	color: #fff;
}

/* =====================================================================
 *  Compaction automatique (classe posee par screen.js si ca depasse).
 *  Regles placees APRES le mode geant : en cas de conflit, la
 *  compaction l'emporte — le tout doit TENIR dans l'ecran.
 * ===================================================================== */
body.qp-compact .screen-prompt { font-size: clamp(1.15rem, 2.3vw, 2.3rem); }
body.qp-compact .screen-huge { font-size: clamp(1.5rem, 3.1vw, 3.1rem); }
body.qp-compact .screen-choice {
	font-size: clamp(.9rem, 1.5vw, 1.6rem);
	padding: 7px 14px;
}
body.qp-compact .screen-choice .key {
	width: clamp(30px, 2.6vw, 44px);
	height: clamp(30px, 2.6vw, 44px);
}
body.qp-compact .screen-body { gap: 10px; }
body.qp-compact .answer-box { padding: 10px 16px; margin-top: 6px; }
body.qp-compact .answer-text { font-size: clamp(1.05rem, 2.4vw, 1.9rem); }
body.qp-compact .screen-board .board-row {
	font-size: clamp(.85rem, 1.3vw, 1.3rem);
	padding: 5px 12px;
}
body.qp-compact #scMiniQr canvas { width: 44px !important; height: 44px !important; }

body.qp-compact2 .screen-prompt { font-size: clamp(1rem, 1.9vw, 1.9rem); }
body.qp-compact2 .screen-choice {
	font-size: clamp(.8rem, 1.25vw, 1.3rem);
	padding: 5px 10px;
}
body.qp-compact2 .answer-box { padding: 8px 12px; }
body.qp-compact2 .screen-body { gap: 6px; }


/* =====================================================================
 *  Ceremonie du classement des vedettes (vue starsShow)
 * ===================================================================== */
.sv-viewport { overflow: hidden; flex: 1; min-height: 0; display: flex; }
.sv-track { display: flex; gap: clamp(10px, 1.5vw, 26px); align-items: center; will-change: transform; }
.sv-track.sv-anim { transition: transform .85s cubic-bezier(.2, .8, .2, 1); }
.sv-viewport.is-grid .sv-track {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, auto));
	grid-auto-flow: row;
	align-content: center;
	justify-content: center;
	gap: clamp(10px, 1.6vh, 22px) clamp(10px, 1.5vw, 26px);
}
.sv-card {
	flex: 0 0 auto;
	width: clamp(180px, 15.5vw, 320px);
	min-height: clamp(200px, 34vh, 380px);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(6px, 1.2vh, 14px);
	padding: clamp(12px, 1.8vh, 24px);
	border-radius: 22px;
	background: linear-gradient(180deg, rgba(30, 38, 62, .92), rgba(16, 21, 36, .95));
	border: 2px solid var(--line);
	box-shadow: 0 22px 60px rgba(3, 6, 15, .6);
	position: relative;
	animation: sv-drop .75s cubic-bezier(.22, 1.18, .32, 1) both;
}
.sv-viewport.is-grid .sv-card { min-height: 0; height: 100%; width: clamp(170px, 14vw, 300px); }
@keyframes sv-drop {
	0%   { transform: translateY(-75vh) scale(1.05); opacity: 0; }
	55%  { opacity: 1; }
	80%  { transform: translateY(1.8vh) scale(.985); }
	100% { transform: none; }
}
.sv-place {
	font-size: clamp(2.2rem, 5vw, 5rem);
	font-weight: 900;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	animation: sv-placepop .55s .3s cubic-bezier(.2, 1.6, .4, 1) both;
	text-shadow: 0 6px 30px rgba(124, 92, 255, .45);
}
@keyframes sv-placepop {
	0% { transform: scale(.15) rotate(-10deg); opacity: 0; }
	100% { transform: none; opacity: 1; }
}
.sv-name { font-size: clamp(1.05rem, 2vw, 2rem); font-weight: 800; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-pts { font-size: clamp(.95rem, 1.6vw, 1.6rem); font-variant-numeric: tabular-nums; }
.sv-card.is-suspense .sv-name, .sv-card.is-suspense .sv-pts {
	color: transparent;
	background: linear-gradient(100deg, #56638c 25%, #f2f5ff 42%, #8f7bff 50%, #f2f5ff 58%, #56638c 75%);
	background-size: 240% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	animation: sv-shine 1.7s linear infinite;
}
.sv-card.is-suspense .sv-pts { animation-delay: .4s; }
@keyframes sv-shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.sv-card.is-revealed .sv-name, .sv-card.is-revealed .sv-pts { animation: sv-revealpop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.sv-card.is-revealed::after {
	content: "";
	position: absolute;
	inset: -24%;
	pointer-events: none;
	background:
		radial-gradient(circle at 28% 30%, rgba(255, 209, 102, .95), transparent 44%),
		radial-gradient(circle at 72% 38%, rgba(124, 92, 255, .9), transparent 42%),
		radial-gradient(circle at 50% 78%, rgba(76, 201, 240, .85), transparent 46%);
	filter: blur(2px);
	opacity: 0;
	animation: sv-burst 1.15s ease-out both;
}
@keyframes sv-burst { 0% { opacity: .95; transform: scale(.22); } 100% { opacity: 0; transform: scale(1.28); } }
@keyframes sv-revealpop { 0% { transform: scale(.55); opacity: 0; } 100% { transform: none; opacity: 1; } }


/* ==== 12e : ceremonie lisible en salle geante ==== */
.sv-viewport.is-line .sv-card { width: clamp(300px, 27vw, 560px); min-height: clamp(340px, 52vh, 660px); }
.sv-viewport.is-grid .sv-card { width: clamp(280px, 25vw, 520px); }
.sv-place { font-size: clamp(3.4rem, 8vw, 8.5rem); }
.sv-name { font-size: clamp(1.7rem, 3.4vw, 3.4rem); }
.sv-pts { font-size: clamp(1.5rem, 2.8vw, 2.8rem); }
/* Suspense : tres visible (lueur + balayage rapide et contrasté) */
.sv-card.is-suspense { border-color: rgba(255, 209, 102, .7); box-shadow: 0 0 70px rgba(255, 209, 102, .3), 0 22px 60px rgba(3, 6, 15, .6); }
.sv-card.is-suspense .sv-name, .sv-card.is-suspense .sv-pts {
	background: linear-gradient(100deg, #3d4a75 15%, #ffffff 34%, #ffd166 47%, #b7a5ff 55%, #ffffff 68%, #3d4a75 85%);
	background-size: 260% 100%;
	-webkit-background-clip: text;
	background-clip: text;
	animation: sv-shine 1.1s linear infinite;
}
.sv-card.is-suspense .sv-pts { animation-delay: .3s; }
@keyframes sv-shine { from { background-position: 140% 0; } to { background-position: -140% 0; } }
/* Reveal : explosion éclatante */
.sv-card.is-revealed::after {
	inset: -45%;
	background:
		radial-gradient(circle at 25% 30%, rgba(255, 209, 102, 1), transparent 46%),
		radial-gradient(circle at 75% 35%, rgba(124, 92, 255, 1), transparent 44%),
		radial-gradient(circle at 50% 80%, rgba(76, 201, 240, .95), transparent 48%),
		radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .95), transparent 30%);
	animation: sv-burst 1.5s ease-out both;
}
@keyframes sv-burst { 0% { opacity: 1; transform: scale(.12); } 60% { opacity: .9; } 100% { opacity: 0; transform: scale(1.9); } }
/* Accueil / compte a rebours : grand et centre */
.qp-screen .solo { margin: 0 auto; width: 100%; }
.pause-bar-clock { font-size: clamp(3.5rem, 15vw, 12rem); }
.qr-box canvas, .qr-box svg { width: clamp(300px, 46vh, 720px); }
/* QR plein ecran (bouton de la telecommande de l'ecran) */
#qrFS { position: fixed; inset: 0; z-index: 90; background: #070a12; display: grid; place-items: center; }
#qrFS[hidden] { display: none !important; }
#qrFS canvas { width: min(84vh, 84vw) !important; height: auto !important; }
