/* ==========================================================================
   Soirée de Noël DCG — direction artistique
   Vert sapin sobre (rappel des couleurs vaudoises), touches d'or et de baie.
   ========================================================================== */

:root {
  --bg: #0b2219;
  --bg-2: #123a2b;
  --surface: rgba(245, 241, 230, 0.06);
  --surface-2: rgba(245, 241, 230, 0.1);
  --line: rgba(245, 241, 230, 0.14);
  --text: #f5f1e6;
  --muted: #a9c2b4;
  --vaud: #2f9e5b;
  --vaud-light: #7cc49a;
  --vaud-dark: #1f7a47;
  --gold: #d4af5a;
  --gold-light: #e8cf8a;
  --berry: #b8323f;
  --ok: #2f9e5b;
  --ko: #b8323f;
  --opt-0: #1f7a47;
  --opt-1: #9e2f3b;
  --opt-2: #a87d22;
  --opt-3: #355466;
  --opt-4: #5e3f7a;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-family: var(--font-body);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(47, 158, 91, 0.28), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(212, 175, 90, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 70%);
  background-attachment: fixed;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 0.4em; line-height: 1.1; letter-spacing: -0.01em; }
h1 { font-weight: 800; }
p { margin: 0 0 0.75em; line-height: 1.45; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.gold { color: var(--gold); }

#app, .host, #login { position: relative; z-index: 1; }

/* ---------- décor ---------- */

.fx-snow, .fx-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; }
.fx-snow { z-index: 0; }
.fx-confetti { z-index: 9999; }

.garland {
  position: fixed; top: 0; left: 0; right: 0; height: 1.375rem; z-index: 50; pointer-events: none;
  display: flex; justify-content: space-between; padding: 0 0.375rem; overflow: hidden;
}
.garland::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0.25rem; height: 0.125rem;
  background: linear-gradient(90deg, #1a4a36, #2a5e47, #1a4a36);
}
.bulb {
  position: relative; top: 0.3125rem; width: 0.5625rem; height: 0.8125rem; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c); box-shadow: 0 0 0.625rem 0.125rem var(--c); animation: twinkle 2.4s ease-in-out infinite; animation-delay: var(--d);
}
.bulb::before { content: ''; position: absolute; top: -0.1875rem; left: 0.125rem; width: 0.3125rem; height: 0.25rem; background: #2a5e47; border-radius: 1px; }
.bulb.b0 { --c: var(--gold-light); }
.bulb.b1 { --c: #d9505b; }
.bulb.b2 { --c: var(--vaud-light); }
.bulb.b3 { --c: #f5f1e6; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; box-shadow: none; } }

.tree { display: inline-block; vertical-align: middle; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
.tree-star { transform-origin: 32px 7px; animation: star-glow 2s ease-in-out infinite; }
@keyframes star-glow { 50% { filter: drop-shadow(0 0 6px #e8cf8a); transform: scale(1.12); } }
.sway { animation: sway 3s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

.brand { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.02em; }
.brand small { display: block; font-family: var(--font-body); font-weight: 600; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }

/* ---------- animations génériques ---------- */

.view-in > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.view-in > *:nth-child(2) { animation-delay: 0.05s; }
.view-in > *:nth-child(3) { animation-delay: 0.1s; }
.view-in > *:nth-child(4) { animation-delay: 0.15s; }
.view-in > *:nth-child(5) { animation-delay: 0.2s; }
.view-in > *:nth-child(n + 6) { animation-delay: 0.25s; }
.stagger > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 0.15s); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } }

.pop-in { animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }

.bump { animation: bump 0.35s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); } }

.shake-sm { animation: shake 0.4s; --amp: 4px; }
.shake-md { animation: shake 0.5s; --amp: 9px; }
.shake-lg { animation: shake 0.6s; --amp: 16px; }
@keyframes shake {
  10%, 90% { transform: translate(calc(var(--amp) * -0.3), 0); }
  20%, 80% { transform: translate(var(--amp), calc(var(--amp) * 0.2)); }
  30%, 50%, 70% { transform: translate(calc(var(--amp) * -1), calc(var(--amp) * -0.2)) rotate(-0.5deg); }
  40%, 60% { transform: translate(var(--amp), 0) rotate(0.5deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- mise en page ---------- */

.wrap { max-width: 640px; margin: 0 auto; padding: 34px 16px 16px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.grow { flex: 1; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.badge { background: var(--surface-2); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; white-space: nowrap; }
.badge.accent { background: var(--gold); border-color: transparent; color: #1b2a20; font-weight: 800; }

input[type='text'], input[type='number'], input[type='password'] {
  width: 100%; font: inherit; font-size: 1.25rem; padding: 14px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: rgba(245, 241, 230, 0.95); color: #10231a;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 90, 0.25); }

button, .btn {
  font: inherit; font-weight: 700; font-size: 1.05rem; border: 0; border-radius: 12px; padding: 14px 18px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: #1b2a20; cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center; box-shadow: 0 4px 0 #8f7134;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
}
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #8f7134; }
button:disabled { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }
button.secondary, .btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
button.danger { background: var(--berry); color: #fff; box-shadow: 0 4px 0 #6e1d26; }
button.small { font-size: 0.85rem; padding: 6px 10px; box-shadow: 0 2px 0 #8f7134; }
button.small.secondary { box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.block { width: 100%; }
.icon-btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); box-shadow: none;
  padding: 6px 10px; font-size: 1.1rem; border-radius: 999px; line-height: 1;
}
.icon-btn:active { transform: scale(0.92); box-shadow: none; }

/* ---------- options de réponse ---------- */

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.options.two { grid-template-columns: 1fr; }
.opt {
  min-height: 92px; color: #fff; font-size: 1.08rem; font-weight: 700; display: flex; align-items: center; gap: 12px;
  text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: opacity 0.4s, transform 0.4s, filter 0.4s;
}
button.opt:active { transform: translateY(4px) scale(0.98); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.opt .shape { font-size: 1.6rem; width: 1.4em; text-align: center; opacity: 0.9; }
.opt-0 { background: linear-gradient(160deg, #2a9159, var(--opt-0)); }
.opt-1 { background: linear-gradient(160deg, #b8434f, var(--opt-1)); }
.opt-2 { background: linear-gradient(160deg, #c49639, var(--opt-2)); }
.opt-3 { background: linear-gradient(160deg, #46697d, var(--opt-3)); }
.opt-4 { background: linear-gradient(160deg, #7a5a99, var(--opt-4)); }
.options .opt:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* 5 choix : le dernier sur toute la largeur */
.opt.dim { opacity: 0.3; filter: grayscale(0.6); transform: scale(0.97); }
.opt.good { outline: 3px solid var(--gold-light); box-shadow: 0 0 30px rgba(232, 207, 138, 0.6); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 50px rgba(232, 207, 138, 0.9); } }
.opt.picked { outline: 3px solid #fff; transform: scale(1.03); }
button.opt:disabled { filter: none; cursor: default; }
button.opt.dim:disabled { filter: grayscale(0.6); }

/* ---------- chrono ---------- */

.timerbar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.timerbar > div { height: 100%; background: linear-gradient(90deg, var(--vaud), var(--gold)); transition: width 0.1s linear, background 0.3s; }
.timer-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; min-width: 2.5ch; text-align: right; display: inline-block; }
.urgent .timerbar > div { background: var(--berry); }
.urgent .timer-num { color: #ff8a93; animation: heartbeat 0.5s ease-in-out infinite; }
@keyframes heartbeat { 30% { transform: scale(1.25); } }

/* ---------- résultats ---------- */

.big-emoji { font-size: 4rem; line-height: 1; }
.result-ok { background: linear-gradient(160deg, #2a9159, var(--vaud-dark)); border-color: rgba(255, 255, 255, 0.2); }
.result-ko { background: linear-gradient(160deg, #a83a46, #7d222c); border-color: rgba(255, 255, 255, 0.2); }
.result-neutral { background: linear-gradient(160deg, #46697d, #2b4554); }
.look-up { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--gold-light); margin: 0; animation: look 1.6s ease-in-out infinite; }
@keyframes look { 50% { transform: translateY(-4px); } }
.points { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; }

.bars { display: flex; align-items: flex-end; gap: 18px; height: 260px; padding-top: 30px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 8px; }
.bar .fill { width: 100%; border-radius: 12px 12px 4px 4px; min-height: 6px; height: 0; transition: height 1s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.bar .count { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; }
.bar .label { font-size: 1rem; text-align: center; font-weight: 600; }

.ranking { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ranking li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px;
}
.ranking li .pos { font-family: var(--font-display); font-weight: 800; min-width: 3.4em; white-space: nowrap; color: var(--gold); }
.ranking li .name { flex: 1; min-width: 4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ranking li > span:not(.pos):not(.name):not(.delta) { white-space: nowrap; }   /* « 3 405 km » sur une ligne */
.ranking li.me { background: linear-gradient(90deg, var(--gold-light), var(--gold)); color: #1b2a20; border-color: transparent; }
.ranking li.me .pos { color: #1b2a20; }
.ranking li:nth-child(1) .pos::after { content: ' 🥇'; }
.ranking li:nth-child(2) .pos::after { content: ' 🥈'; }
.ranking li:nth-child(3) .pos::after { content: ' 🥉'; }
.ranking.plain li .pos::after { content: none; }
.delta { font-size: 0.8em; font-weight: 700; min-width: 3ch; }
.delta.up { color: var(--vaud-light); }
.delta.down { color: #ff8a93; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--line); padding: 4px 14px 4px 4px; border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

/* ---------- avatars ---------- */

/* Rond, emoji ou photo ; la taille suit la police (classes lg / xl pour agrandir) */
.avatar {
  width: 1.9em; height: 1.9em; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle; object-fit: cover; line-height: 1; background: var(--surface-2); border: 2px solid var(--line);
}
.avatar .em { font-size: 1.3em; line-height: 1; }
.avatar.lg { font-size: 1.8rem; }
.avatar.xl { font-size: 3.4rem; border-width: 3px; border-color: var(--gold); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.who > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking li .avatar { margin-right: -4px; }
.podium .avatar { margin: 4px auto 10px; font-size: 2.2rem; }

.avatar-pick { display: flex; align-items: center; gap: 16px; margin: 10px 0; }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.small-text { font-size: 0.85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; max-height: 216px; overflow-y: auto;
  padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.15);
}
.emoji-btn {
  font-size: 1.6rem; line-height: 1; padding: 7px 0; background: var(--surface-2); border: 2px solid transparent; box-shadow: none;
  border-radius: 10px; color: inherit;
}
.emoji-btn:active { transform: scale(0.9); box-shadow: none; }
.emoji-btn.sel { border-color: var(--gold); background: rgba(212, 175, 90, 0.3); }

/* ---------- jeu « découpe » ---------- */

.parcel-wrap { width: 100%; }
.parcel {
  display: block; width: 100%; max-height: 52vh; border-radius: var(--radius); border: 1px solid var(--line);
  background-color: rgba(245, 241, 230, 0.04);
  background-image: linear-gradient(rgba(245, 241, 230, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(245, 241, 230, 0.07) 1px, transparent 1px);
  background-size: 22px 22px; user-select: none; -webkit-user-select: none;
}
.parcel.draw { touch-action: none; cursor: crosshair; aspect-ratio: 1; }
.parcel.big { max-height: 56vh; height: 56vh; }
.parcel-shape { fill: #efe8d4; }
.parcel-edge { fill: none; stroke: #1b2a20; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.parcel-vertex { fill: var(--berry); stroke: #fff; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.part-a { fill: rgba(212, 175, 90, 0.85); }
.part-b { fill: rgba(47, 158, 91, 0.75); }
.cut { stroke: var(--berry); stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cut-handle { fill: #fff; stroke: var(--berry); stroke-width: 2; vector-effect: non-scaling-stroke; }
.cut.other { stroke: #0b2219; stroke-width: 1.5; opacity: 0.35; animation: fade-in 0.3s both; animation-delay: calc(var(--i) * 40ms); }
.cut.best { stroke: var(--berry); stroke-width: 5; animation: fade-in 0.4s both; animation-delay: calc(var(--i) * 40ms); }
.late { animation: fade-in 0.4s both; animation-delay: calc(var(--i) * 40ms); }
@keyframes fade-in { from { opacity: 0; } }
.parcel-stage { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.screen .parcel-stage .ranking li { font-size: 1.2rem; gap: 10px; padding: 10px 16px; }
.parcel-stage .ranking li .pos { min-width: 2.6em; }

/* ---------- image de question, curseur ---------- */

.q-image { display: block; width: 100%; max-height: 32vh; object-fit: contain; border-radius: 10px; }
.slider-value { font-family: var(--font-display); font-size: 3rem; font-weight: 800; color: var(--gold-light); line-height: 1.1; }
.slider-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 48px; margin: 4px 0; background: transparent; }
input[type='range']::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 38px; height: 38px; margin-top: -15px; border-radius: 50%;
  background: linear-gradient(var(--gold-light), var(--gold)); border: 3px solid #fff; box-shadow: var(--shadow);
}
input[type='range']::-moz-range-track { height: 10px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
input[type='range']::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); border: 3px solid #fff; }

/* Nuage des réponses : pastilles empilées, taille adaptée au nombre de lignes et de colonnes */
.dotplot { padding-top: 2.2em; }
.dp-dots {
  position: relative; height: 140px; container-type: size; border-bottom: 2px solid var(--line);
  --d: min(100cqh / var(--rows), 100cqw / var(--cols), 1.6rem);
}
.dp-dot {
  position: absolute; bottom: calc(var(--k) * var(--d)); width: var(--d); height: var(--d); border-radius: 50%;
  background: var(--vaud-light); transform: translateX(-50%) scale(0.82);
  animation: fade-in 0.3s both; animation-delay: calc(var(--i) * 40ms);
}
.dp-dot.me { background: var(--berry); box-shadow: 0 0 0 2px #fff; z-index: 1; }
.dp-mean { position: absolute; top: 0; bottom: -8px; width: 0; border-left: 3px solid var(--gold); margin-left: -1.5px; z-index: 2; }
.dp-label { position: absolute; bottom: 100%; left: 0; transform: translateX(-50%); margin-bottom: 0.3em; white-space: nowrap; font-weight: 800; color: var(--gold-light); }
.dp-mean.left .dp-label { transform: translateX(-12%); }
.dp-mean.right .dp-label { transform: translateX(-88%); }
.dp-axis { position: relative; height: 1.7em; color: var(--muted); font-size: 0.85em; }
.dp-axis span { position: absolute; top: 0.35em; transform: translateX(-50%); }
.slider-stage { display: flex; flex-direction: column; gap: 1.5rem; }
.q-image-wrap { position: relative; flex: 1 1 0; min-height: 0; }
.q-image.big { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.slider-reveal { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: start; }

/* ---------- cartes ---------- */

.map { width: 100%; min-height: 320px; border-radius: var(--radius); overflow: hidden; background: #cfd8d2; border: 1px solid var(--line); box-shadow: var(--shadow); }
.map.tall { height: 58vh; }
.map.home-map { height: 280px; min-height: 0; transition: opacity .2s; }
.map.home-map.off { opacity: .35; }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.home-actions input { width: auto; margin-right: 6px; vertical-align: middle; }
.pin { width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); border: 0.125rem solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.pin.drop { animation: drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes drop { from { transform: translateY(-40px) scale(0.5); opacity: 0; } }
.star { font-size: 2.5rem; line-height: 2.5rem; text-align: center; color: var(--gold-light); text-shadow: 0 0 6px #000, 0 0 2px #000; animation: pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1) both, star-pulse 1.6s 0.7s ease-in-out infinite; }
@keyframes star-pulse { 50% { text-shadow: 0 0 18px var(--gold), 0 0 2px #000; } }
.leaflet-container { font: inherit; }
.leaflet-tooltip.answer-tip { background: var(--bg); color: var(--gold-light); border: 1px solid var(--gold); font-weight: 700; }
.leaflet-tooltip.answer-tip::before { border-top-color: var(--gold); }

/* ---------- mini-jeu réflexe ---------- */

.reflex {
  flex: 1; min-height: 50vh; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; text-align: center; padding: 20px;
  user-select: none; -webkit-user-select: none; cursor: pointer; touch-action: manipulation; border: 1px solid var(--line); transition: background 0.08s;
}
.reflex.ready { background: linear-gradient(160deg, #46697d, var(--opt-3)); }
.reflex.wait { background: linear-gradient(160deg, #b8434f, var(--opt-1)); }
.reflex.go { background: linear-gradient(160deg, #3fbf73, var(--vaud)); }

/* ---------- question piège ---------- */

select {
  width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: rgba(245, 241, 230, 0.95); color: #10231a;
}
select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 90, 0.25); }
.piege-reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; min-height: 0; }
.piege-reveal .card { max-height: 100%; overflow: hidden; }
.piege-bad { border-color: rgba(184, 50, 63, 0.6); }
.piege-good { border-color: rgba(212, 175, 90, 0.6); }
.ko-text { color: #ff8a93; }

/* ---------- mini-jeu course MO93 ---------- */

.mo93 { display: flex; flex-direction: column; gap: 6px; }
.mo93-track {
  position: relative; height: 34px; border-radius: 17px; background: var(--surface-2); border: 1px solid var(--line);
  margin: 18px 4px 0 14px; /* place pour le coureur au départ */
}
.mo93-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 17px; background: linear-gradient(90deg, var(--vaud-dark), var(--vaud-light)); transition: width 0.12s ease-out; }
.mo93-runner { position: absolute; left: 0; bottom: 4px; font-size: 2rem; line-height: 1; z-index: 1; transform: translateX(-50%) scaleX(-1); transition: left 0.12s ease-out; }
.mo93-flag { position: absolute; right: 2px; bottom: 4px; font-size: 2rem; line-height: 1; }
.mo93-pct { text-align: center; font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.tap-pad { min-height: 34vh; }
.tap-pad small { font-family: var(--font-body); font-size: 1rem; font-weight: 600; opacity: 0.9; }
.tap-count { font-size: 4.5rem; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---------- attente ---------- */

.ornament { width: 84px; height: 84px; margin: 0 auto 12px; position: relative; animation: sway 2.4s ease-in-out infinite; transform-origin: 50% -20px; }
.ornament::before { content: ''; position: absolute; left: 50%; top: -20px; width: 1px; height: 20px; background: var(--gold); }
.ornament::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff9aa3, var(--berry) 45%, #5c1219);
  box-shadow: inset -6px -8px 16px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- écran de projection ---------- */

/*
 * Tout l'écran est en rem et suit la taille de la fenêtre : 1 rem = 16 px en 1920 × 1080, 32 px en 3840 × 2160 (TV 4K).
 * Les tailles ci-dessous visent une lecture à 10-15 m : l'essentiel (question, choix, chrono) très grand,
 * le secondaire (pseudos) plus petit mais lisible.
 */
html.screen-page { font-size: max(12px, min(100vw / 120, 100vh / 67.5)); }
/* Règle de base : jamais de défilement sur l'écran. Tout tient dans la hauteur de la fenêtre. */
html.screen-page, html.screen-page body { height: 100%; overflow: hidden; }
.screen-page .tree { width: 5.5rem; height: 5.5rem; }

.screen { padding: 3rem 3.5rem 2rem; height: 100vh; overflow: hidden; display: flex; flex-direction: column; gap: 1.5rem; }
.screen > * { flex-shrink: 0; }
.screen > .fill { flex: 1 1 0; min-height: 0; }      /* prend la place restante (carte, parcelle…) */
.screen h1 { font-size: 4rem; }
.screen h2 { font-size: 2.4rem; }
.screen .brand small { font-size: 1.1rem; }
.screen .badge { font-size: 1.5rem; padding: 0.3rem 1rem; }
.screen .prompt { font-size: 3rem; font-weight: 600; font-family: var(--font-display); line-height: 1.2; }
.screen .opt { min-height: 10rem; font-size: 2.6rem; padding: 1rem 1.5rem; gap: 1rem; }
.screen .opt .shape { font-size: 2.6rem; }
.screen .options { gap: 1rem; }
.screen .ranking { gap: 0.6rem; }
.screen .ranking li { font-size: 2.1rem; padding: 0.55rem 1.4rem; gap: 1rem; }
.screen .ranking li .avatar { font-size: 0.85em; }
.screen .card { padding: 1.5rem; }
.screen .map.tall { height: 100%; min-height: 0; }
.screen .timerbar { height: 1rem; }
.screen .timer-num { font-size: 5rem; }
.screen .points { font-size: 4rem; }
.screen .muted { font-size: 1.6rem; }
.screen .bars { height: 28vh; flex-shrink: 1; min-height: 12rem; gap: 1.5rem; padding-top: 2.5rem; }
.screen .bars + .options .opt { min-height: 6.5rem; }   /* révélation du quiz : barres + choix sur le même écran */
.screen .bar .count { font-size: 3rem; }
.screen .bar .label { font-size: 1.9rem; }
.screen .reflex { font-size: 3.4rem; }
.screen .parcel-stage { gap: 1.5rem; }
.screen .parcel-stage .parcel-wrap { align-self: stretch; height: 100%; min-height: 0; }
.screen .parcel.big { height: 100%; max-height: none; }
.screen .parcel-stage .ranking li { font-size: 1.7rem; gap: 0.6rem; padding: 0.5rem 1rem; }
.screen .dotplot { font-size: 1.8rem; padding-top: 2.6em; }
.screen .dp-dots { height: 38vh; }
.screen .dp-mean { border-left-width: 0.3rem; }
.screen .options.compact .opt { min-height: 6.5rem; }
.screen .slider-reveal .ranking li { font-size: 1.7rem; gap: 0.6rem; padding: 0.5rem 1rem; }

/* ---------- beamer : occuper tout l'écran ---------- */
.screen .prompt.small-prompt { font-size: 2rem; }          /* révélation : la question se tasse, place aux réponses */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1.2rem; }
.hero-emoji { display: block; font-size: 9rem; line-height: 1.1; }
.screen .reflex .hero-emoji { margin-bottom: 0.3em; }
.hero-number { font-size: 9rem; line-height: 1.1; }
.reveal-main > .hero { padding: 1rem; gap: 0; }
.reveal-main > .hero .hero-number { font-size: 6rem; }
.screen .options.fill-rows { flex: 1 1 0; min-height: 0; grid-auto-rows: 1fr; }
.screen .options.fill-rows .opt { min-height: 0; font-size: 3.2rem; }

/* Grilles de révélation : zone principale à gauche, classement complet à droite, sur toute la hauteur */
.screen .slider-reveal, .screen .parcel-stage, .carte-reveal { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; align-items: stretch; }
.screen .slider-reveal > *, .screen .parcel-stage > *, .carte-reveal > * { min-height: 0; }
.reveal-main { display: flex; flex-direction: column; gap: 1.5rem; min-height: 0; }
.reveal-main > .grow-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.reveal-main > .bars { flex: 1 1 0; height: auto; }
.reveal-plan { position: relative; flex: 0 0 26%; min-height: 0; }
.screen .grow-card .dotplot { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.screen .grow-card .dp-dots { height: auto; flex: 1 1 0; min-height: 0; }
.screen .carte-reveal .map.tall { height: 100%; }

/* Course MO93 : une piste par coureur */
.course-head { display: flex; align-items: center; justify-content: space-around; gap: 1.5rem; text-align: center; }
.course-head .hero-number { font-size: 6.5rem; }
.course-head .prompt { font-size: 2.4rem; }
.lanes { justify-content: space-evenly; gap: 0.6rem; }
.lane { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 6rem; align-items: center; gap: 1rem; font-size: 1.4rem; animation: rise 0.45s both; animation-delay: calc(var(--i) * 90ms + 0.2s); }
.lane-name { display: flex; align-items: center; gap: 0.5rem; overflow: hidden; white-space: nowrap; font-weight: 600; }
.lane-name > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.lane-track { position: relative; height: 1.6rem; border-radius: 0.8rem; background: var(--surface-2); border: 1px solid var(--line); }
.lane-fill { position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 0.8rem; background: linear-gradient(90deg, var(--vaud-dark), var(--vaud-light)); animation: lane-grow 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 90ms + 0.4s); }
.lane-runner { position: absolute; left: var(--p); bottom: 0.1rem; font-size: 2.2rem; line-height: 1; transform: translateX(-50%) scaleX(-1); z-index: 1; animation: lane-run 2.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--i) * 90ms + 0.4s); }
.lane-flag { position: absolute; right: 0.2rem; bottom: 0.1rem; font-size: 2rem; line-height: 1; }
.lane-pct { text-align: right; font-weight: 700; color: var(--gold-light); font-variant-numeric: tabular-nums; }
@keyframes lane-grow { from { width: 0; } }
@keyframes lane-run { from { left: 0; } }

/* Question piège : les deux listes sur toute la hauteur, pastilles bien lisibles */
.screen .piege-reveal { align-items: stretch; }
.screen .piege-reveal .card { display: flex; flex-direction: column; gap: 1rem; }
.screen .piege-reveal .chip { font-size: 1.8rem; }
.screen .piege-reveal .chips.n-many .chip { font-size: 1.3rem; }   /* beaucoup de monde : tout doit tenir */
.screen .piege-reveal .chips.n-lots { gap: 0.4rem; }
.screen .piege-reveal .chips.n-lots .chip { font-size: 1.05rem; padding: 0.2rem 0.8rem 0.2rem 0.2rem; }
.screen .piege-reveal .chips[style] .chip { font-size: var(--chip-size); }   /* ajusté par fitChips() */
.screen .piege-reveal .chips[style] { gap: calc(var(--chip-size) * 0.35); }
/* Salle d'attente : avatars bien visibles depuis le fond de la salle */
.screen .chips { gap: 0.6rem; }
/* Beaucoup de joueurs : pastilles plus serrées pour que tout le monde tienne */
.screen .chips.n-many .chip { font-size: 1.2rem; }
.screen .chips.n-lots { gap: 0.45rem; }
.screen .chips.n-lots .chip { font-size: 1.1rem; }
.screen .chip { font-size: 1.3rem; padding: 0.3rem 1.1rem 0.3rem 0.3rem; gap: 0.6rem; border-width: 0.0625rem; }
.screen .chip .avatar { width: 2.5em; height: 2.5em; border-width: 0.1875rem; }
.screen .chip .avatar .em { font-size: 1.8em; }
.lobby { display: grid; grid-template-columns: auto 1fr; gap: 3.5rem; align-items: center; min-height: 0; }
.lobby .prompt { margin-bottom: 0.4em; }
.lobby .joinurl { margin-bottom: 0.5em; }
.qr { background: #fff; padding: 1rem; border-radius: var(--radius); width: min(42vh, 26rem); box-shadow: 0 0 0 0.375rem var(--gold), var(--shadow); }
.qr img { display: block; width: 100%; }
/* QR code pour rejoindre à tout moment : en haut à droite, avec une colonne réservée pour ne rien masquer */
.screen.with-qr { padding-right: 13rem; }
.qr-mini { position: fixed; right: 1.25rem; top: 2rem; background: #fff; padding: 0.4rem; border-radius: 0.6rem; width: 10rem; text-align: center; color: #1b2a20; font-size: 1rem; font-weight: 700; z-index: 10; }
.qr-mini img { width: 100%; display: block; }
.joinurl { font-size: 2.6rem; font-weight: 800; color: var(--gold-light); word-break: break-all; }
.counter { font-size: 2rem; }
.counter strong { font-family: var(--font-display); font-size: 1.3em; color: var(--gold-light); display: inline-block; }
.screen-corner { position: fixed; left: 1rem; bottom: 1rem; z-index: 10; }
.screen .icon-btn { font-size: 1.5rem; padding: 0.4rem 0.7rem; }
.screen .leaflet-tooltip { font-size: 1.3rem; padding: 0.3rem 0.6rem; }
/* Contrôles de carte à l'échelle de l'écran (minuscules en 4K sinon) */
.screen .leaflet-bar a { width: 1.9rem; height: 1.9rem; line-height: 1.9rem; font-size: 1.4rem; }
.screen .leaflet-control-layers-toggle { width: 2.75rem; height: 2.75rem; background-size: 1.6rem; }
.screen .leaflet-control-attribution { font-size: 0.75rem; }

/* ---------- finale : le podium se dévoile marche après marche, calé sur la musique ---------- */
.finale { position: relative; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.finale-title { text-align: center; margin: 0; min-height: 7.5rem; display: flex; flex-direction: column; justify-content: center; }
.finale-title span { display: block; font-size: 4.2rem; animation: title-in 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
@keyframes title-in { from { opacity: 0; transform: translateY(1rem) scale(0.94); filter: blur(6px); } }
.finale-stage { position: relative; flex: 1 1 0; min-height: 0; width: 100%; display: flex; justify-content: center; align-items: flex-end; gap: 2rem; }
.place { position: relative; width: 24rem; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.place .who { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 0; max-width: 100%; text-align: center; padding-bottom: 1rem; opacity: 0; transform: translateY(-40vh) scale(0.5); }
.place .who h2 { font-size: 2.6rem; margin: 0.4rem 0 0; white-space: nowrap; max-width: 24rem; overflow: hidden; text-overflow: ellipsis; }
.place .who p { font-size: 2.2rem; margin: 0; white-space: nowrap; }
.place .who .avatar.xl { font-size: 4rem; margin: 0 auto; }
.place.p1 .who .avatar.xl { font-size: 4.8rem; }
.place .crown { display: block; font-size: 5rem; line-height: 1; height: 5rem; opacity: 0; }
.place .block {
  position: relative; z-index: 1; width: 100%; border-radius: var(--radius) var(--radius) 0 0; border: 0.125rem solid var(--line); border-bottom: 0;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); display: flex; justify-content: center; padding-top: 1rem;
  transform-origin: bottom; animation: block-rise 4.5s cubic-bezier(0.3, 0.7, 0.2, 1) both;
}
.place.p1 .block { height: 21rem; animation-delay: 0.6s; }
.place.p2 .block { height: 15rem; animation-delay: 0.3s; }
.place.p3 .block { height: 10.5rem; }
.place .block .num { font-family: var(--font-display); font-weight: 800; font-size: 6.5rem; line-height: 1; color: rgba(255, 255, 255, 0.14); }
@keyframes block-rise { from { transform: scaleY(0); opacity: 0; } }
/* le faisceau de projecteur derrière la marche */
.place .beam {
  position: absolute; z-index: 0; left: 50%; bottom: 0; width: 34rem; height: 140%; transform: translateX(-50%); opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse 45% 70% at 50% 62%, rgba(255, 236, 180, 0.32), transparent 70%);
  transition: opacity 1.2s ease;
}
.place.shown .beam { opacity: 1; }
.place.shown .who { animation: who-drop 1.6s cubic-bezier(0.25, 1.2, 0.4, 1) both; }
.place.shown .block { border-color: var(--gold); }
.place.p1.shown .block { background: linear-gradient(180deg, rgba(212, 175, 90, 0.5), var(--surface)); box-shadow: 0 0 4rem rgba(212, 175, 90, 0.45); }
.place.p1.shown .block .num, .place.shown .block .num { color: rgba(255, 236, 180, 0.55); }
@keyframes who-drop {
  0% { opacity: 0; transform: translateY(-40vh) scale(0.5); }
  55% { opacity: 1; transform: translateY(0.6rem) scale(1.08); }
  75% { transform: translateY(-0.6rem) scale(0.98); }
  100% { opacity: 1; transform: none; }
}
/* le roulement : la 1re marche palpite, tout le monde retient son souffle */
.finale.roll .place.p1 .block { animation: block-rise 4.5s cubic-bezier(0.3, 0.7, 0.2, 1) both, throb 0.36s ease-in-out 4.5s infinite alternate; }
.finale.roll .place.p1 .block .num { color: var(--gold); }
.finale.roll .drum { opacity: 1; animation: drum 0.18s ease-in-out infinite alternate; }
.drum { position: absolute; z-index: 3; left: 50%; bottom: 23rem; transform: translateX(-50%); font-size: 6rem; opacity: 0; pointer-events: none; }
.finale.champion .drum { display: none; }
@keyframes throb { to { transform: scale(1.03, 1.05); box-shadow: 0 0 3rem rgba(212, 175, 90, 0.6); } }
@keyframes drum { from { transform: translateX(-50%) rotate(-8deg) scale(0.95); } to { transform: translateX(-50%) rotate(8deg) scale(1.08); } }
/* le champion : couronne qui tombe, rayons dorés qui tournent */
.place.p1.shown .crown { animation: crown-drop 1.4s cubic-bezier(0.3, 1.3, 0.5, 1) 0.9s both; }
@keyframes crown-drop { 0% { opacity: 0; transform: translateY(-30vh) rotate(-25deg); } 100% { opacity: 1; transform: none; } }
.place .rays {
  position: absolute; z-index: 0; left: 50%; top: 30%; width: 60rem; height: 60rem; margin: -30rem 0 0 -30rem; border-radius: 50%; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 220, 140, 0.16) 0 8deg, transparent 8deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 15%, transparent 65%); mask: radial-gradient(circle, #000 15%, transparent 65%);
}
.place.p1.shown .rays { opacity: 1; transition: opacity 2s ease; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.honors { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; min-height: 3.6rem; }
.honors .chip { font-size: 1.3rem; opacity: 0; }
.finale.honored .honors .chip { animation: rise 0.8s ease both; animation-delay: calc(var(--i) * 0.35s); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .place .rays, .finale.roll .drum, .finale.roll .place.p1 .block { animation: none !important; }
}

.audio-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; background: rgba(11, 34, 25, 0.85); backdrop-filter: blur(8px); cursor: pointer; font-size: 2rem;
}

/* ---------- animateur ---------- */

.host { max-width: 1200px; margin: 0 auto; padding: 36px 16px 16px; display: grid; gap: 16px; grid-template-columns: 1fr 340px; }
.host .full { grid-column: 1 / -1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* Gros bouton « Suivant » : la couleur annonce l'étape suivante */
.next-btn { display: block; width: 100%; font-size: 1.4rem; padding: 20px; color: #fff; }
.next-btn.go { background: linear-gradient(180deg, #3fbf73, var(--vaud-dark)); box-shadow: 0 4px 0 #145232; }
.next-btn.reveal { background: linear-gradient(180deg, #d0505d, var(--berry)); box-shadow: 0 4px 0 #7a1f29; }
.next-btn.board { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: #1b2a20; box-shadow: 0 4px 0 #8f7134; }
.next-btn.end { background: linear-gradient(180deg, #8a6bb0, var(--opt-4)); box-shadow: 0 4px 0 #3e2852; }
.next-btn.done { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.stepper span { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
.stepper span.sep { border: 0; padding: 0; }
.stepper span.on { background: var(--surface-2); color: var(--text); border-color: var(--gold); font-weight: 700; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
th { color: var(--muted); font-weight: 600; }
tr.current { background: rgba(212, 175, 90, 0.16); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--vaud-light); margin-right: 6px; box-shadow: 0 0 6px var(--vaud-light); }
.dot.off { background: #6b7a72; box-shadow: none; }
.scroll { max-height: 60vh; overflow: auto; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }

@media (max-width: 900px) {
  .host { grid-template-columns: 1fr; }
  .lobby { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .parcel-stage { grid-template-columns: 1fr; }
  .screen { padding: 2.25rem 1rem 1rem; }
}
@media (max-width: 380px) {
  .options { grid-template-columns: 1fr; }
}
