:root {
  --bg: #14062b;
  --bg2: #230a45;
  --card: rgba(30, 12, 58, .78);
  --line: rgba(255, 255, 255, .12);
  --text: #fff7ff;
  --muted: #b9a8d6;
  --pink: #ff2e93;
  --yellow: #ffd23f;
  --cyan: #2ee6ff;
  --ok: #3dffa2;
  --bad: #ff4d4d;
  --radius: 18px;
  --display: 'Bungee', 'Bricolage Grotesque', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); font: 16px/1.4 'Bricolage Grotesque', system-ui, sans-serif; }
html { background: var(--bg); }
body { min-height: 100dvh; overflow-x: hidden; }
main { position: relative; max-width: 980px; margin: 0 auto; padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
h2 { font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
h2 small, small { color: var(--muted); font-weight: 400; }

/* ---------- Plateau : faisceaux de projecteurs ---------- */
.stage-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at 50% 120%, #5b1580 0%, transparent 55%), radial-gradient(ellipse at 50% -20%, #2b0e5e 0%, transparent 60%), var(--bg); }
.beam { position: absolute; top: -20vh; width: 40vmax; height: 140vh; transform-origin: 50% 0; filter: blur(30px); opacity: .35; animation: sweep 9s ease-in-out infinite alternate; }
.b1 { left: 5%; background: linear-gradient(var(--pink), transparent 70%); }
.b2 { left: 40%; background: linear-gradient(var(--cyan), transparent 70%); animation-duration: 12s; animation-delay: -4s; opacity: .22; }
.b3 { right: 0; background: linear-gradient(var(--yellow), transparent 70%); animation-duration: 10s; animation-delay: -2s; opacity: .2; }
@keyframes sweep { from { transform: rotate(-25deg); } to { transform: rotate(25deg); } }

.screen { display: none; }
.screen.active { display: block; animation: in .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes in { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.sfx { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 20; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 1.35rem; cursor: pointer; display: grid; place-items: center; padding: 0; }
.sfx .off, .sfx.muted .on { display: none; }
.sfx.muted .off { display: inline; }

/* ---------- Accueil ---------- */
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(3.2rem, 16vw, 6.5rem); text-align: center; margin: 7vh 0 28px; line-height: .95; display: flex; flex-direction: column; align-items: center; }
.logo .l1 { color: var(--yellow); text-shadow: 0 0 18px rgba(255, 210, 63, .6), 4px 4px 0 #a3189d; transform: rotate(-4deg); }
.logo .l2 { color: var(--pink); text-shadow: 0 0 22px rgba(255, 46, 147, .8), 4px 4px 0 #3a0a6b; animation: neon 4s infinite; }
@keyframes neon { 0%, 92%, 100% { opacity: 1; } 93%, 95% { opacity: .55; } }
/* Vumètres à la place des « I » : boîte sans texte en flux, dont le bas se pose sur la ligne de base comme une lettre.
   Six segments, cyan, jaune puis rose de bas en haut ; app.js éteint ceux au-dessus du niveau de la musique. */
.logo .vu { position: relative; display: inline-block; width: .32em; height: .72em; margin: 0 .05em; vertical-align: baseline; }
.logo .vu > b { position: absolute; inset: 0; display: flex; flex-direction: column-reverse; gap: .055em; }
.logo .vu i { flex: 1; border-radius: .04em; box-shadow: 0 0 10px currentColor; transition: opacity .08s; }
.logo .vu i:nth-child(-n+2) { background: var(--cyan); color: rgba(46, 230, 255, .7); }
.logo .vu i:nth-child(3), .logo .vu i:nth-child(4) { background: var(--yellow); color: rgba(255, 210, 63, .7); }
.logo .vu i:nth-child(n+5) { background: var(--pink); color: rgba(255, 46, 147, .8); }
.logo .vu i.off { opacity: .22; box-shadow: none; }
.logo .l1 .vu { filter: drop-shadow(4px 4px 0 #a3189d); }
.logo .l2 .vu { filter: drop-shadow(4px 4px 0 #3a0a6b); }
.title { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 9vw, 3.4rem); text-align: center; color: var(--yellow); text-shadow: 0 0 20px rgba(255, 210, 63, .5), 3px 3px 0 #a3189d; margin: 20px 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
label { font-weight: 600; }
input, select { font: inherit; color: var(--text); background: rgba(10, 2, 24, .7); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; min-height: 48px; }
input:focus-visible, select:focus-visible, .btn:focus-visible, .sfx:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row input { text-transform: uppercase; }
details summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.err { color: var(--bad); min-height: 1.2em; margin: 0; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.center { text-align: center; }

.btn { font: inherit; font-weight: 800; color: var(--text); background: rgba(255, 255, 255, .08); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; min-height: 48px; cursor: pointer; transition: transform .12s, filter .2s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #ff5aa9, var(--pink)); border: 0; box-shadow: 0 6px 0 #a3105d, 0 10px 30px rgba(255, 46, 147, .35); text-transform: uppercase; letter-spacing: .04em; }
.btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #a3105d; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; font-size: 1.15rem; margin-top: 14px; min-height: 56px; }

/* ---------- Lobby ---------- */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; padding-right: 52px; }
.bar small { display: block; font-size: .8rem; }
.bar strong { font-size: 1.35rem; }
.code { font-family: var(--display); font-weight: 400; font-size: 1.8rem !important; color: var(--yellow); letter-spacing: .08em; text-shadow: 0 0 14px rgba(255, 210, 63, .5); }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.side { display: grid; gap: 14px; align-content: start; }
@media (min-width: 760px) { .grid { grid-template-columns: 270px 1fr; align-items: start; } }
.pill { font-size: .8rem; background: var(--pink); border-radius: 99px; padding: 1px 9px; }
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.players li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: rgba(10, 2, 24, .6); border-radius: 12px; }
.players li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players li.off { opacity: .45; }
.players em { color: var(--muted); font-style: normal; font-size: .85rem; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; min-width: 36px; min-height: 36px; }
.x:hover, .x[aria-expanded="true"] { color: var(--yellow); }
/* Thème voté par le joueur (mode vote), à côté de son nom */
.players li .vote-de, .nom3d .vote-de { flex: none; display: inline-grid; color: var(--cyan); font-size: 1.1rem; }
/* Menu de l'hôte sur un joueur (bouton ⋮) : exclure, exclure pour de bon, donner l'hôte */
.menu-joueur { position: fixed; z-index: 30; display: grid; min-width: 210px; padding: 6px; background: #2a0f4f; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 36px rgba(0, 0, 0, .5); }
.menu-joueur button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: .88rem; font-weight: 700; text-align: left; cursor: pointer; }
.menu-joueur button:hover { background: rgba(255, 255, 255, .1); }
.menu-joueur button:focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px; }
.menu-joueur [data-action="ban"] { color: var(--bad); }
.menu-joueur [data-action="hote"] { color: var(--yellow); }
.qr { text-align: center; }
.qr img { display: block; margin: 0 auto; background: #fff; border-radius: 12px; padding: 8px; width: 160px; height: 160px; }
.qr p { margin: 8px 0 0; color: var(--muted); font-size: .85rem; }

/* ---------- Partie ---------- */
.timer { height: 12px; background: rgba(255, 255, 255, .1); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--yellow)); transform-origin: left; box-shadow: 0 0 14px var(--cyan); }
.timer i.low { background: var(--bad); box-shadow: 0 0 18px var(--bad); animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .55; } }
.screenbox { position: relative; width: 100%; max-width: 600px; aspect-ratio: 16 / 9; margin: 0 auto 12px; border-radius: var(--radius); overflow: hidden; background: #000; border: 3px solid rgba(255, 210, 63, .55); box-shadow: 0 0 40px rgba(255, 46, 147, .35), inset 0 0 30px rgba(0, 0, 0, .6); }
.yt, .yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Lecteur YouTube intouchable : ni survol (titre, chaîne, « regarder plus tard »), ni clic qui mettrait en pause ou ouvrirait YouTube. */
.yt { pointer-events: none; }
.cover { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: radial-gradient(circle at 50% 40%, #4d1785, #1a0636 70%); transition: opacity .5s; }
.cover p { margin: 0; font-family: var(--display); color: var(--yellow); letter-spacing: .05em; }
.screenbox.shown .cover { opacity: 0; pointer-events: none; }
.secs { position: absolute; top: 10px; right: 14px; font-family: var(--display); font-size: 1.6rem; color: var(--text); text-shadow: 0 0 10px var(--pink); }
.secs.low { color: var(--bad); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.25); } }
.eq { display: flex; gap: 6px; align-items: end; height: 64px; }
.eq i { width: 10px; background: linear-gradient(var(--yellow), var(--pink)); border-radius: 5px; height: 20%; }
.playing .eq i { animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.2s; } .eq i:nth-child(3) { animation-delay: -.5s; } .eq i:nth-child(4) { animation-delay: -.7s; }
.eq i:nth-child(5) { animation-delay: -.35s; } .eq i:nth-child(6) { animation-delay: -.6s; } .eq i:nth-child(7) { animation-delay: -.15s; }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.reveal { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(20, 6, 43, .88); border: 2px solid var(--yellow); border-radius: 14px; padding: 10px 14px; text-align: center; animation: flip .5s cubic-bezier(.2, .9, .3, 1.3); backdrop-filter: blur(6px); }
@keyframes flip { from { transform: rotateX(90deg); opacity: 0; } }
.reveal p { margin: 2px 0; font-size: clamp(1rem, 4.5vw, 1.4rem); font-weight: 800; }
.reveal small { font-size: .7rem; font-weight: 400; text-transform: uppercase; letter-spacing: .1em; margin-right: 6px; }
.finders { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.finders span { font-size: .8rem; background: rgba(61, 255, 162, .15); color: var(--ok); padding: 2px 10px; border-radius: 99px; }
.finders span.none { background: rgba(255, 77, 77, .15); color: var(--bad); }
.sound { display: block; margin: 0 auto 12px; }

.fields { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.field { padding: 7px 16px; border-radius: 99px; border: 2px dashed var(--line); color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; transition: .2s; }
.field.ok { border: 2px solid var(--ok); color: #062a1a; background: var(--ok); box-shadow: 0 0 18px rgba(61, 255, 162, .5); animation: pop .35s; }
@keyframes pop { 50% { transform: scale(1.18); } }
.guess { display: flex; gap: 8px; max-width: 600px; margin: 0 auto 10px; }
.guess input { font-size: 1.1rem; border: 2px solid rgba(46, 230, 255, .45); }
.guess input:focus { border-color: var(--cyan); box-shadow: 0 0 18px rgba(46, 230, 255, .35); outline: none; }
.guess.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.feed { list-style: none; padding: 0; margin: 0 auto 16px; max-width: 600px; display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; max-height: 64px; overflow: hidden; }
.feed li { font-size: .85rem; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .07); animation: in .2s; }
.feed li.no { color: var(--muted); text-decoration: line-through; }
.feed li.ok { color: var(--ok); }
.board { list-style: none; padding: 0; margin: 0 auto; max-width: 600px; display: grid; gap: 6px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: transform .3s; }
.board li .rk { flex: none; font-family: var(--display); color: var(--yellow); width: 2ch; }
.board li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li i { font-style: normal; color: var(--ok); letter-spacing: 2px; font-size: .8rem; }
.board li b { font-family: var(--display); font-weight: 400; min-width: 2ch; text-align: right; }
.board li.me { border-color: var(--pink); box-shadow: 0 0 14px rgba(255, 46, 147, .3); }
.board li.off { opacity: .45; }
.board li.bump b { animation: pop .4s; color: var(--ok); }

/* ---------- Overlays ---------- */
.splash { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(20, 6, 43, .6), rgba(20, 6, 43, .92)); animation: fade 1.6s forwards; }
.splash div { text-align: center; animation: zoom 1.6s cubic-bezier(.2, .9, .3, 1.2) forwards; }
.splash small { display: block; font-family: var(--display); color: var(--cyan); font-size: 1.1rem; letter-spacing: .1em; }
.splash strong { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(1.8rem, 8vw, 3.4rem); color: var(--yellow); text-shadow: 0 0 24px rgba(255, 210, 63, .6), 4px 4px 0 #a3189d; padding: 0 16px; }
@keyframes zoom { 0% { transform: scale(.4); opacity: 0; } 25%, 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.flash { position: fixed; inset: 0; z-index: 25; pointer-events: none; opacity: 0; box-shadow: inset 0 0 120px 30px var(--ok); }
.flash.on { animation: flash .6s; }
.flash.bad { box-shadow: inset 0 0 100px 20px var(--bad); }
@keyframes flash { 30% { opacity: 1; } }
.fx { position: fixed; inset: 0; z-index: 26; pointer-events: none; overflow: hidden; }
.fx i { position: absolute; width: 10px; height: 14px; border-radius: 2px; animation: confetti 1.4s cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
.fx b { position: absolute; font-family: var(--display); font-weight: 400; font-size: 2.4rem; color: var(--ok); text-shadow: 0 0 16px rgba(61, 255, 162, .7); animation: float 1.1s ease-out forwards; }
@keyframes float { to { transform: translateY(-90px) scale(1.3); opacity: 0; } }

/* ---------- Fin ---------- */
.podium { display: flex; justify-content: center; align-items: end; gap: 10px; max-width: 520px; margin: 10px auto 18px; min-height: 220px; }
.step { flex: 1; max-width: 170px; text-align: center; animation: rise .8s cubic-bezier(.2, .9, .3, 1.2) both; }
.step .who { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 6px; }
.step .medal { font-size: 2.3rem; display: block; margin: 0 auto 4px; }
.step.p1 .medal { color: var(--yellow); filter: drop-shadow(0 0 8px rgba(255, 210, 63, .6)); }
.step.p2 .medal { color: #e6e6f5; }
.step.p3 .medal { color: #ffb37a; }
.step .col { border-radius: 12px 12px 0 0; display: grid; place-items: center; font-family: var(--display); font-size: 1.5rem; color: #2a0a3f; }
.step.p1 { order: 2; animation-delay: .9s; } .step.p1 .col { height: 150px; background: linear-gradient(var(--yellow), #e0a400); box-shadow: 0 0 40px rgba(255, 210, 63, .5); }
.step.p2 { order: 1; animation-delay: .5s; } .step.p2 .col { height: 110px; background: linear-gradient(#e6e6f5, #a7a7c4); }
.step.p3 { order: 3; animation-delay: .2s; } .step.p3 .col { height: 80px; background: linear-gradient(#ffb37a, #c4692b); }
.step.me .who { color: var(--pink); }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } }
.rest { margin-bottom: 6px; }
.end-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 600px; margin: 18px auto 28px; }
.end-actions .btn.big { margin: 0; }
.recap-title { justify-content: center; font-family: var(--display); font-weight: 400; color: var(--cyan); }
.recap { list-style: none; padding: 0; margin: 0 auto; max-width: 600px; display: grid; gap: 8px; }
/* Sur téléphone, les menus (niveau, signalement) passent sous le titre au lieu de l'écraser. */
.recap li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.recap img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; flex: none; }
.recap .t { flex: 1 1 160px; min-width: 0; }
.recap .t a, .recap .t b { color: var(--text); font-weight: 800; text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap .t a:hover { text-decoration: underline; }
.recap .t small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap select { width: auto; min-height: 36px; padding: 4px 8px; font-size: .8rem; }
.recap .done { color: var(--muted); font-size: .8rem; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #3a1466; border: 1px solid var(--line); padding: 10px 18px; border-radius: 99px; opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100% - 32px); z-index: 40; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .beam { display: none; }
}
@media (max-width: 759px) {
  .qr { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px; }
  .qr img { width: 96px; height: 96px; margin: 0; padding: 5px; }
  .qr p { margin: 0; }
}
.link { background: none; border: 0; padding: 4px 2px; color: var(--yellow); font: inherit; cursor: pointer; text-decoration: underline; }
.link:disabled { display: none; }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }

.link { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; color: var(--text); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 32px; }
.link:hover { border-color: var(--yellow); }

/* ---------- Icônes dessinées (symboles en haut d'index.html), colorées par currentColor ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; vertical-align: -.15em; }
.crown { color: var(--yellow); }

/* ---------- Réglages du lobby, façon écran de sélection d'un jeu ---------- */
#settings { padding-bottom: 0; }
#settings > h2 { font-family: var(--display); font-weight: 400; font-size: 1.15rem; letter-spacing: .04em; }
#settings > h2 small { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: .85rem; letter-spacing: 0; }
#settings .panel { padding: 18px 0 6px; border-top: 1px solid var(--line); }
#settings .panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
#settings .panel-head .panel-title { margin: 0; }
#settings .panel-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: .95rem; letter-spacing: .05em; color: var(--yellow); }
#settings .panel-title b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--pink); color: #fff; font-size: .78rem; box-shadow: 0 3px 0 #a3105d; }
#settings .panel-title small { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: .8rem; letter-spacing: 0; }
#settings .quick { margin-left: auto; display: flex; gap: 6px; }
#settings.locked .quick { display: none; }

/* Cartes cliquables : la case à cocher est cachée, c'est la carte qui s'allume */
#settings :is(.mode, .lvl, .tile) { position: relative; display: block; }
#settings :is(.mode, .lvl, .tile) input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; }
#settings :is(.mode, .lvl, .tile) > span { height: 100%; background: rgba(10, 2, 24, .6); border: 2px solid var(--line); border-radius: 16px; cursor: pointer; transition: transform .15s, border-color .2s, background .2s, box-shadow .2s, opacity .2s; }
#settings :is(.mode, .lvl, .tile) > span:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .3); }
#settings :is(.mode, .lvl, .tile) input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
#settings :is(.mode, .lvl, .tile) .ico { transition: opacity .2s, filter .2s; }

/* 1. Modes : trois grandes cartes, chacune sa couleur néon */
#settings .modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
#settings .mode { --m: 255, 210, 63; }
#settings .mode.m-timed { --m: 46, 230, 255; }
#settings .mode.m-race { --m: 255, 46, 147; }
#settings .mode > span { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 16px 12px 14px; text-align: center; }
#settings .mode .ico { font-size: 2.3rem; color: rgb(var(--m)); filter: drop-shadow(0 0 4px rgba(var(--m), .45)); }
#settings .mode strong { font-size: 1rem; }
#settings .mode small { font-size: .78rem; line-height: 1.3; }
#settings .mode input:checked + span { border-color: rgb(var(--m)); background: linear-gradient(180deg, rgba(var(--m), .2), rgba(var(--m), .04)); box-shadow: 0 0 22px rgba(var(--m), .3); }
#settings .mode input:checked + span strong { color: rgb(var(--m)); }
#settings .mode input:checked + span .ico { filter: drop-shadow(0 0 7px rgba(var(--m), .85)); }

/* 2. Difficultés : une tuile par niveau, à la couleur du niveau (comme le badge en partie) */
#settings .levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
#settings .lvl { --c: 255, 255, 255; }
#settings .lvl.facile { --c: 61, 255, 162; }
#settings .lvl.moyen { --c: 46, 230, 255; }
#settings .lvl.difficile { --c: 255, 210, 63; }
#settings .lvl.impossible { --c: 255, 77, 77; }
#settings .lvl > span { display: grid; justify-items: center; gap: 3px; padding: 12px 4px 10px; text-align: center; opacity: .55; }
#settings .lvl .ico { font-size: 1.9rem; color: rgb(var(--c)); }
/* barres de niveau : 1 à 5 allumées, le reste en veilleuse */
#settings .lvl .ico path { stroke-width: 3.2; }
#settings .lv.l1 path:nth-child(n+2), #settings .lv.l2 path:nth-child(n+3), #settings .lv.l3 path:nth-child(n+4), #settings .lv.l4 path:nth-child(n+5) { stroke-opacity: .22; }
#settings .lvl strong { font-size: .85rem; white-space: nowrap; }
#settings .lvl small { font-size: .78rem; font-weight: 800; color: rgb(var(--c)); }
#settings .lvl input:checked + span { opacity: 1; border-color: rgb(var(--c)); background: linear-gradient(180deg, rgba(var(--c), .22), rgba(var(--c), .05)); box-shadow: 0 0 18px rgba(var(--c), .3); }
#settings .lvl input:checked + span .ico { filter: drop-shadow(0 0 5px rgba(var(--c), .75)); }
#settings.no-bonus .lvl small { visibility: hidden; }

/* 3. Thèmes : grille de tuiles avec une icône */
/* une couleur néon par groupe : francophone, époques, genres, écrans, ambiance, autres */
#settings .tgroup { --g: 255, 46, 147; margin-bottom: 14px; }
#settings .tgroup.g1 { --g: 255, 210, 63; }
#settings .tgroup.g2 { --g: 46, 230, 255; }
#settings .tgroup.g3 { --g: 61, 255, 162; }
#settings .tgroup.g4 { --g: 190, 140, 255; }
#settings .tgroup.g5 { --g: 255, 255, 255; }
#settings .tgroup-title { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: rgb(var(--g)); margin-bottom: 8px; }
#settings .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
#settings .tile > span { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 12px; border-radius: 14px; }
#settings .tile .ico { font-size: 1.7rem; color: rgb(var(--g)); opacity: .8; }
#settings .tile b { display: grid; min-width: 0; font-size: .88rem; font-weight: 700; line-height: 1.2; }
#settings .tile small { font-size: .72rem; }
#settings .tile input:checked + span { border-color: rgb(var(--g)); background: linear-gradient(180deg, rgba(var(--g), .2), rgba(var(--g), .05)); box-shadow: 0 0 16px rgba(var(--g), .25); }
#settings .tile input:checked + span .ico { opacity: 1; filter: drop-shadow(0 0 5px rgba(var(--g), .8)); }
/* coche en pastille sur le coin : ne prend pas de place au texte */
#settings .tile input:checked + span::after { content: '✓'; position: absolute; top: -7px; right: -7px; z-index: 1; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgb(var(--g)); color: #2a0a3f; font-size: .7rem; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); }

/* 4. Options : « Manches ……… ◀ 10 ▶ » comme dans un menu de jeu */
#settings .options { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 8px; margin-bottom: 8px; }
#settings .optn { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 8px 8px 8px 14px; background: rgba(10, 2, 24, .6); border: 1px solid var(--line); border-radius: 14px; }
#settings .optn-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--cyan); }
#settings .optn .hint { grid-column: 1 / -1; margin: 0; font-size: .76rem; }
#settings .cycle { display: grid; grid-template-columns: 34px 150px 34px; align-items: center; gap: 4px; }
#settings .cyc { width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: var(--yellow); font: inherit; font-size: .95rem; cursor: pointer; display: grid; place-items: center; padding: 0; transition: background .15s, transform .1s; }
#settings .cyc:hover { background: rgba(255, 210, 63, .2); }
#settings .cyc:active { transform: scale(.88); }
#settings .cycle select { appearance: none; -webkit-appearance: none; width: 100%; min-height: 34px; padding: 0 4px; border: 0; background: none; text-align: center; text-align-last: center; font-weight: 800; font-size: .95rem; cursor: pointer; }
#settings .cycle select:disabled { opacity: 1; cursor: default; }
#settings .cycle option { background: var(--bg2); color: var(--text); }
#settings.locked .cyc { visibility: hidden; }

/* Vue des joueurs : réglages en lecture seule, ce qui n'est pas choisi s'efface */
#settings.locked :is(.mode, .lvl, .tile) > span { cursor: default; transform: none; border-color: var(--line); }
#settings.locked input:not(:checked) + span { opacity: .35; }

/* Qui choisit les thèmes : « Choix de l'hôte | Vote des joueurs », deux boutons collés */
#settings .qui-choisit { display: inline-flex; padding: 3px; border-radius: 99px; background: rgba(10, 2, 24, .6); border: 1px solid var(--line); }
#settings .qui-choisit label { position: relative; }
#settings .qui-choisit input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; }
#settings .qui-choisit span { display: block; padding: 5px 12px; border-radius: 99px; color: var(--muted); font-size: .78rem; font-weight: 800; white-space: nowrap; cursor: pointer; transition: background .2s, color .2s; }
#settings .qui-choisit input:checked + span { background: var(--yellow); color: var(--bg); }
#settings .qui-choisit input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
#settings.locked .qui-choisit span { cursor: default; }
/* Mode vote : chacun coche son thème, les tuiles restent vives pour tous ; voix et part de chaque thème (barre du bas) */
#settings:not(.vote) .vote-hint, #settings.vote .quick { display: none; }
#settings .vote-hint { margin: -4px 0 12px; }
#settings.vote.locked .tile > span { cursor: pointer; }
#settings.vote.locked .tile input + span { opacity: 1; }
#settings .tile .voix { margin-left: auto; padding: 1px 8px; border-radius: 99px; background: rgba(var(--g), .18); color: rgb(var(--g)); font-size: .72rem; font-style: normal; font-weight: 800; white-space: nowrap; }
#settings .tile .voix:empty { display: none; }
#settings.vote .tile > span::before { content: ''; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 3px; border-radius: 99px; background: linear-gradient(90deg, rgb(var(--g)) calc(var(--part, 0) * 100%), transparent 0); }

/* Bouton Lancer : reste visible en bas pendant qu'on fait défiler les réglages */
#settings .start { position: sticky; bottom: 0; z-index: 1; margin: 0 -18px; padding: 16px 18px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(30, 12, 58, 0), rgba(30, 12, 58, .96) 30%); border-radius: 0 0 var(--radius) var(--radius); }
#settings .start .btn.big { margin-top: 0; }
#settings .start .err { margin-bottom: 8px; }
#settings .start .hint { margin: 0; padding: 8px 0; }

@media (max-width: 600px) {
  #settings .modes { grid-template-columns: minmax(0, 1fr); }
  #settings .mode > span { grid-template-columns: auto minmax(0, 1fr); justify-items: start; column-gap: 14px; row-gap: 2px; padding: 12px 14px; text-align: left; }
  #settings .mode .ico { grid-row: span 2; align-self: center; font-size: 2rem; }
  #settings .levels { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  #settings .lvl { grid-column: span 2; }
  #settings .lvl.difficile, #settings .lvl.impossible { grid-column: span 3; }
  #settings .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #settings .tile > span { gap: 8px; padding: 8px 10px; }
  #settings .tile .ico { font-size: 1.4rem; }
  #settings .tile b { font-size: .8rem; }
  #settings .optn { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  #settings .cycle { grid-template-columns: 34px minmax(0, 1fr) 34px; }
}
/* Le lobby prend plus de largeur que les autres écrans : les tuiles respirent */
main:has(> #lobby.active) { max-width: 1180px; }

/* Grilles : un texte long sur une ligne ne doit pas élargir la page (sinon le téléphone dézoome, « recadrage »). */
.recap, .board, .podium, .players { grid-template-columns: minmax(0, 1fr); }
.recap li, .board li, .players li { min-width: 0; }
.step { min-width: 0; }

/* ---------- Pause ---------- */
.actions { display: flex; gap: 8px; }
.pause-overlay { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(14, 4, 30, .82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pause-box { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 24px; }
.pause-icon { font-size: 3.4rem; color: var(--yellow); filter: drop-shadow(0 0 10px rgba(255, 210, 63, .5)); animation: pulse 1s infinite alternate; }
.pause-box strong { font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 7vw, 2.4rem); color: var(--yellow); text-shadow: 0 0 18px rgba(255, 210, 63, .5); }
.pause-box small:empty { display: none; }

/* ---------- Vidéo floutée pendant la manche ---------- */
.yt iframe { transition: filter .9s ease, transform .9s ease, opacity .6s ease; }
/* Entre deux manches, la vidéo s'efface en fondu (le son baisse en même temps), puis la suivante charge cachée. */
.screenbox:not(.playing):not(.shown) .yt iframe { opacity: 0; transition: opacity .8s ease, filter .9s ease, transform .9s ease; }
/* Noir et blanc et très flou : les couleurs et le décor de la vidéo n'aident plus à trouver. */
.screenbox.blur .yt iframe { filter: grayscale(1) blur(60px) brightness(.75); transform: scale(1.35); }
.screenbox.blur.shown .yt iframe { filter: none; transform: none; }
/* Le cache devient un voile : on devine le mouvement, pas l'image. */
.screenbox.blur .cover { background: radial-gradient(circle at 50% 40%, rgba(77, 23, 133, .45), rgba(26, 6, 54, .7) 70%); }

/* Choix « l'un ou l'autre » entre les deux étiquettes */
.fields .or { align-self: center; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Niveau du morceau en cours ---------- */
.tier { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tier:empty { display: none; }
.tier.tres-facile { background: rgba(255, 255, 255, .2); color: #fff; }
.tier.facile { background: rgba(61, 255, 162, .18); color: var(--ok); }
.tier.moyen { background: rgba(46, 230, 255, .18); color: var(--cyan); }
.tier.difficile { background: rgba(255, 210, 63, .2); color: var(--yellow); }
.tier.impossible { background: rgba(255, 77, 77, .2); color: var(--bad); }
.actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) {
  .actions { flex-wrap: nowrap; gap: 6px; }
  .actions .btn { min-width: 44px; min-height: 44px; padding: 8px 10px; }
  .actions .lbl { display: none; }
}

/* Boutons de l'hôte : petits ronds, symboles de lecture seulement (libellé en info-bulle). */
.actions { flex-wrap: nowrap; gap: 6px; }
.actions .lbl { display: none; }
.actions .btn { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 50%; font-size: .95rem; line-height: 1; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid var(--line); }
.actions .btn:hover { border-color: var(--yellow); }

/* Bouton Arrêter en attente de confirmation */
#stopBtn.confirm { background: var(--pink, #ff2e93); color: #fff; }
#stopBtn.confirm .lbl { display: inline !important; }

/* Réglage du volume (bouton en haut à droite) */
.vol-panel { position: fixed; top: calc(60px + env(safe-area-inset-top)); right: 10px; z-index: 20; display: grid; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
.vol-panel[hidden] { display: none; }
.vol-panel label { display: grid; gap: 4px; font-size: .85rem; font-weight: 700; }
.vol-panel input[type=range] { width: 180px; min-height: 0; padding: 0; accent-color: var(--yellow); }

/* ---------- Menu d'accueil, façon écran-titre de jeu ---------- */
.profile { display: flex; align-items: center; gap: 14px; max-width: 460px; margin: 0 auto 14px; padding: 10px 16px 10px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.profile .who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.profile small { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); }
.profile input { min-height: 40px; padding: 6px 12px; font-weight: 800; font-size: 1.05rem; }
.profile strong { font-size: 1.2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { max-width: 460px; margin: 0 auto; display: grid; gap: 10px; }
.langs { display: grid; gap: 10px; }
.mbtn { --m: 255, 46, 147; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 18px; text-align: left; font: inherit; color: var(--text); background: rgba(10, 2, 24, .62); border: 2px solid rgba(var(--m), .4); border-radius: 18px; cursor: pointer; transition: transform .15s, border-color .2s, background .2s, box-shadow .2s; }
.mbtn:hover, .mbtn:focus-visible { transform: translateX(6px); border-color: rgb(var(--m)); background: linear-gradient(90deg, rgba(var(--m), .24), rgba(var(--m), .04) 70%); box-shadow: 0 0 24px rgba(var(--m), .28); outline: none; }
.mbtn:active { transform: translateX(6px) scale(.98); }
.mbtn .ico { font-size: 2.2rem; color: rgb(var(--m)); filter: drop-shadow(0 0 5px rgba(var(--m), .5)); }
.mbtn:hover .ico, .mbtn:focus-visible .ico { animation: pop .35s; }
.mbtn span { display: grid; gap: 2px; min-width: 0; }
.mbtn strong { font-family: var(--display); font-weight: 400; font-size: 1.2rem; letter-spacing: .03em; }
.mbtn small { color: var(--muted); font-size: .85rem; }
.mbtn.c-yellow { --m: 255, 210, 63; }
.mbtn.c-cyan { --m: 46, 230, 255; }
.mbtn.c-green { --m: 61, 255, 162; }
.mbtn.c-violet { --m: 190, 140, 255; }
.mbtn.c-white { --m: 255, 255, 255; min-height: 56px; }
.mbtn.c-white .ico { font-size: 1.7rem; }
#joinBtn { box-shadow: 0 0 26px rgba(255, 210, 63, .3); }
.menu-head { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; }
.menu-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.5rem; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, .45); }
.btn.icon { width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none; display: grid; place-items: center; border-radius: 12px; font-size: 1.15rem; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pair .mbtn { grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; min-height: 128px; }
.codebox { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; background: rgba(10, 2, 24, .6); border: 1px solid var(--line); border-radius: 16px; transition: border-color .2s; }
.codebox:focus-within { border-color: var(--yellow); }
.codebox .ico { font-size: 1.4rem; color: var(--yellow); }
.codebox input { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; border: 0; background: none; font-weight: 800; }
.codebox input:focus-visible { outline: none; }
.plist-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.plist-head h3 { margin: 0; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--ok); }
.plist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.plist li { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 10px 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; animation: in .25s; }
.plist .pi { flex: 1; min-width: 0; display: grid; }
.plist .pi :is(strong, small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .pi small { color: var(--muted); font-size: .8rem; }
.plist .btn { min-height: 40px; padding: 8px 14px; font-size: .8rem; box-shadow: 0 4px 0 #a3105d; }
.plist li.empty { justify-content: center; padding: 18px; color: var(--muted); font-size: .9rem; background: none; border-style: dashed; }
.link .ico { vertical-align: -.2em; }
.opts { display: grid; gap: 14px; }
.opts label { display: grid; gap: 6px; }
.opts input[type=range] { min-height: 0; padding: 0; accent-color: var(--yellow); }
.opts .btn small { color: var(--muted); font-weight: 400; }
.opts .hint { margin: 0; }
@media (max-width: 520px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
  .pair .mbtn { grid-template-columns: auto minmax(0, 1fr); min-height: 72px; }
}

/* ---------- Images de profil (Steam) ou initiale sur une couleur néon ---------- */
.av { --c: var(--pink); flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 22%, #1a0636); color: var(--c); font-family: var(--display); font-size: .8rem; line-height: 1; object-fit: cover; }
img.av { border-color: rgba(255, 255, 255, .25); background: #1a0636; }
.av.sm { width: 24px; height: 24px; border-radius: 8px; font-size: .7rem; }
.av.md { width: 40px; height: 40px; border-radius: 12px; font-size: 1.05rem; margin: 0 auto 6px; }
.av.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 1.5rem; box-shadow: 0 0 18px color-mix(in srgb, var(--c) 40%, transparent); }

/* ---------- Lobby : retour au menu, invitations, solo ---------- */
.bar .lobby-id { flex: 1; min-width: 0; }
.invites { display: flex; gap: 8px; }
.invites .ico { vertical-align: -.2em; }
/* Solo : ni liste de joueurs, ni invitations ; le décor 3D garde la scène (le perso seul) et le bouton « Mon perso ». */
#lobby.solo :is(#steamBtn, #shareBtn, .optn-vis, .optn-max, .qui-choisit, #lobbyCode) { display: none; }
body:not(.d3) #lobby.solo .side { display: none; }
#lobby.solo .grid { grid-template-columns: minmax(0, 1fr); }
#lobby.solo #lobbyKind { font-family: var(--display); font-size: 1.3rem; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, .45); }
@media (max-width: 520px) {
  .invites .lbl { display: none; }
  .invites .btn { width: 44px; padding: 0; display: grid; place-items: center; }
}
.players li .av, .board li .av { flex: none; }
/* Barre de défilement discrète, aux couleurs du jeu (l'appli de bureau montre sinon celle de Windows). */
html { scrollbar-width: thin; scrollbar-color: rgba(255, 46, 147, .45) transparent; }
@media (max-height: 820px) { .logo { margin-top: 2vh; margin-bottom: 18px; } }
/* Présentation du jeu sous les menus de l'accueil (site public) : texte sobre, pour les nouveaux venus et les moteurs. */
.apropos { display: grid; gap: 12px; margin: 30px 0 4px; font-size: .9rem; color: var(--muted); }
.apropos .card { padding: 14px 16px; }
.apropos h2 { display: block; font-family: var(--display); font-weight: 400; color: var(--cyan); font-size: .95rem; letter-spacing: .03em; margin: 0 0 8px; }
.apropos h3 { font-size: .9rem; color: var(--text); margin: 10px 0 2px; }
.apropos p { margin: 0 0 6px; line-height: 1.45; }
/* Lien discret vers les mentions légales, en bas de l'accueil (site public). */
.legal { text-align: center; margin: 6px 0 0; font-size: .78rem; }
.legal a { color: var(--muted); text-decoration: none; }
.legal a:hover, .legal a:focus-visible { color: var(--text); text-decoration: underline; }

/* ---------- Persos 3D : la scène (public/3d) derrière l'interface ---------- */
/* body.scene-on : une vue 3D est dessinée ; body.d3 : décor 3D sur grand écran (sinon l'interface 2D d'avant). */
.scene3d { position: fixed; inset: 0; z-index: 0; display: none; width: 100%; height: 100%; touch-action: none; outline: none; }
body.scene-on .scene3d { display: block; }
body.scene-on .stage-bg { display: none; }
main { z-index: 1; }
.scene-zone, .noms3d, .recap-btn, #end .recap-close { display: none; } /* #end : plus fort que .btn.icon */
img.av.perso { background: radial-gradient(circle at 50% 40%, #3a1670, #160634); border-color: rgba(255, 255, 255, .25); }

/* Écran Perso : rubriques à gauche, le perso au centre (on tourne autour en le faisant glisser), choix à droite */
#perso.screen.active { position: fixed; inset: 0; display: grid; grid-template-columns: 132px minmax(0, 1fr) minmax(300px, 440px); grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); pointer-events: none; }
#perso > * { pointer-events: auto; }
#perso .scene-zone { display: block; grid-column: 2; grid-row: 2; pointer-events: none; }
.perso-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-right: 52px; }
.perso-titre { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, .45); }
.perso-actions { margin-left: auto; display: flex; gap: 10px; }
.perso-actions .btn { display: flex; align-items: center; gap: 6px; }
.perso-rail { grid-column: 1; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.perso-rail button { flex: 1; max-height: 78px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .12); background: rgba(10, 2, 24, .74); color: #d9ccef; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; transition: border-color .2s, background .2s; }
.perso-rail .ico { font-size: 1.6rem; }
.perso-rail button:hover { border-color: rgba(46, 230, 255, .5); }
.perso-rail button[aria-pressed="true"] { border-color: var(--cyan); background: rgba(46, 230, 255, .16); color: var(--text); }
.perso-fiche { grid-column: 2; grid-row: 3; justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
.perso-expr { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 5px; border-radius: 99px; background: rgba(10, 2, 24, .74); border: 1px solid var(--line); }
.perso-expr button { min-height: 38px; padding: 0 12px; border-radius: 99px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; }
.perso-expr button[aria-pressed="true"] { background: var(--yellow); color: var(--bg); }
.perso-legende { margin: 0; padding: 6px 14px; border-radius: 12px; background: rgba(10, 2, 24, .62); color: #d9ccef; font-size: .88rem; text-align: center; }
.perso-legende:empty { display: none; }
.perso-legende strong { display: block; color: var(--yellow); }
.perso-astuce { margin: 0; color: var(--muted); font-size: .75rem; }
.perso-panneau { grid-column: 3; grid-row: 2 / 4; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 16px; border-radius: 20px; background: rgba(30, 12, 58, .9); border: 1px solid var(--line); }
.perso-haut { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.perso-haut h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.2rem; }
.perso-filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.perso-filtres:empty { display: none; }
.perso-filtres button { min-height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #d9ccef; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; }
.perso-filtres button[aria-pressed="true"] { border-color: var(--yellow); background: rgba(255, 210, 63, .18); color: var(--yellow); }
.perso-grille { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 10px; padding-right: 4px; }
.carte { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 8px 6px 10px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .12); background: rgba(10, 2, 24, .55); color: var(--text); font: inherit; text-align: center; cursor: pointer; transition: border-color .2s, transform .15s; }
.carte:hover { border-color: rgba(46, 230, 255, .5); transform: translateY(-2px); }
.carte[aria-pressed="true"] { border-color: var(--cyan); background: rgba(46, 230, 255, .14); }
.carte img { width: 100%; max-width: 104px; height: auto; aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #2a0f55, #160634); }
.carte strong { font-size: .8rem; line-height: 1.2; }
.carte .famille { padding: 1px 8px; border-radius: 99px; background: rgba(255, 210, 63, .16); color: var(--yellow); font-size: .68rem; font-weight: 800; }
.carte .cadenas { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--yellow); font-size: .95rem; }
.carte .condition { color: #d9ccef; font-size: .68rem; line-height: 1.25; }
.carte.verrou img { opacity: .6; }
.carte.mystere { cursor: default; }
.carte.mystere:hover { transform: none; border-color: rgba(255, 255, 255, .12); }
.perso-grille.couleurs { display: flex; flex-direction: column; gap: 14px; }
.nuancier-bloc > span { font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--cyan); }
.nuancier { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.nuancier button { height: 44px; border-radius: 12px; border: 3px solid rgba(255, 255, 255, .12); background: var(--c); box-shadow: inset -6px -7px 0 rgba(0, 0, 0, .18); cursor: pointer; }
.nuancier button[aria-pressed="true"] { border-color: var(--text); }
/* Téléphone : le perso en haut, puis expressions, rubriques en ruban et choix ; tout sur une ligne qui défile. */
@media (max-width: 760px) {
  #perso.screen.active { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(150px, 1fr) auto auto 36vh; gap: 8px; }
  .perso-bar { gap: 8px; }
  .perso-titre { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .perso-actions { gap: 6px; }
  .perso-actions .lbl { display: none; }
  .perso-actions .btn { min-height: 44px; padding: 8px 12px; }
  .perso-rail { grid-column: 1; grid-row: 4; flex-direction: row; overflow-x: auto; }
  .perso-rail button { flex: 0 0 auto; min-width: 78px; min-height: 56px; max-height: none; }
  #perso .scene-zone { grid-column: 1; grid-row: 2; }
  .perso-fiche { grid-column: 1; grid-row: 3; gap: 4px; }
  .perso-expr { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; max-width: 100%; border-radius: 16px; }
  .perso-expr button { flex: none; }
  .perso-legende { font-size: .78rem; padding: 4px 10px; }
  .perso-astuce { display: none; }
  .perso-panneau { grid-column: 1; grid-row: 5; padding: 12px; gap: 8px; }
}
@media (max-width: 420px) { .perso-titre { display: none; } }

/* Accueil en 3D : le menu à gauche, le perso sur sa scène dans la place qui reste à droite */
body.d3 main:has(> #home.active) { margin: 0; max-width: 540px; padding-left: max(32px, 5vw); }

/* Lobby en 3D : les joueurs sur les gradins à gauche (nom sous chacun), les réglages à droite */
body.d3 main:has(> #lobby.active) { max-width: 1680px; }
body.d3 #lobby .grid, body.d3 #lobby.solo .grid { grid-template-columns: minmax(0, 1fr) minmax(520px, 44%); }
body.d3 #lobby .side, body.d3 #lobby.solo .side { position: sticky; top: 14px; height: calc(100dvh - 104px); display: flex; flex-direction: column; gap: 10px; }
body.d3 #lobby .side > .card:first-child { padding: 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.d3 #lobby .side > .card:first-child h2 { margin: 0; }
body.d3 #lobby .players { display: none; }
body.d3 #lobby .scene-zone { display: block; flex: 1; min-height: 160px; }
body.d3 #lobby .qr { display: flex; align-items: center; gap: 14px; align-self: flex-start; text-align: left; padding: 10px 16px 10px 10px; }
body.d3 #lobby .qr img { width: 96px; height: 96px; margin: 0; padding: 5px; }
body.d3 #lobby .qr p { margin: 0; }
body.d3 #lobby.solo .side > .card { display: none; }
body.d3 #lobby .noms3d { display: block; position: fixed; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
body.d3 #lobby.foule .noms3d { display: none; }
body.d3 #lobby.foule .players { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; max-height: 30vh; overflow-y: auto; margin-top: 8px; }
body.d3 #lobby.foule .players li { padding: 4px 8px; background: rgba(10, 2, 24, .72); }
.nom3d { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; max-width: 180px; padding: 3px 12px; border-radius: 99px; background: rgba(10, 2, 24, .84); border: 1px solid rgba(255, 255, 255, .18); font-size: .85rem; font-weight: 800; white-space: nowrap; pointer-events: auto; }
.nom3d span { overflow: hidden; text-overflow: ellipsis; }
.nom3d.moi { border-color: var(--pink); box-shadow: 0 0 12px rgba(255, 46, 147, .45); }
.nom3d.off { opacity: .5; }
.nom3d .x { min-width: 28px; min-height: 28px; margin-right: -8px; font-size: .85rem; }

/* Partie en 3D : l'arène plein écran, la vidéo posée sur l'écran géant (--ex… données par app.js), la réponse en bas */
body.d3 #game.active { position: fixed; inset: 0; animation: none; pointer-events: none; }
body.d3 #game > * { pointer-events: auto; }
body.d3 #game .bar { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 16px; right: 68px; margin: 0; padding: 0; align-items: flex-start; }
body.d3 #game .bar > div:first-child { padding: 8px 16px; border-radius: 16px; background: rgba(10, 2, 24, .78); border: 1px solid var(--line); }
body.d3 #game .screenbox { position: absolute; left: var(--ex, 33%); top: var(--ey, 16%); width: var(--ew, 34%); height: var(--eh, 33%); max-width: none; margin: 0; aspect-ratio: auto; border: 0; border-radius: var(--er, 18px); box-shadow: none; background: #07020f; }
body.d3 #game .timer { position: absolute; left: var(--ex, 33%); top: calc(var(--ey, 16%) + var(--eh, 33%) + 16px); width: var(--ew, 34%); height: 8px; margin: 0; }
body.d3 #game .sound { position: absolute; left: 0; right: 0; width: max-content; margin: 0 auto; top: calc(var(--ey, 16%) + var(--eh, 33%) / 2 - 24px); z-index: 1; }
body.d3 #game .fields { position: absolute; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); margin: 0; flex-wrap: wrap; }
body.d3 #game .field:not(.ok), body.d3 #game .fields .or { background: rgba(10, 2, 24, .85); }
body.d3 #game .fields .or { padding: 4px 10px; border-radius: 99px; }
body.d3 #game .guess { position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom)); width: min(620px, calc(100% - 32px)); margin: 0 auto; }
body.d3 #game .guess input { background: rgba(10, 2, 24, .88); }
body.d3 #game .feed { position: absolute; left: 0; right: 0; bottom: calc(140px + env(safe-area-inset-bottom)); width: min(620px, calc(100% - 32px)); margin: 0 auto; justify-content: center; }
body.d3 #game .feed li { background: rgba(10, 2, 24, .78); }
body.d3 #game .board { position: absolute; right: 16px; top: 76px; width: 240px; max-height: calc(100% - 330px); overflow-y: auto; margin: 0; gap: 4px; }
body.d3 #game .board li { padding: 6px 10px; background: rgba(10, 2, 24, .78); }

/* Fin de partie en 3D : le podium, le classement à droite, les boutons en bas, les morceaux en panneau */
body.d3 #end.active { position: fixed; inset: 0; animation: none; pointer-events: none; }
body.d3 #end > * { pointer-events: auto; }
body.d3 #end .title { position: absolute; top: max(24px, 3vh); left: 0; right: 0; margin: 0; pointer-events: none; }
body.d3 #end .podium { display: none; }
body.d3 #end .rest { position: absolute; right: 16px; top: 130px; width: 260px; max-height: calc(100% - 290px); overflow-y: auto; margin: 0; }
body.d3 #end .rest:empty { display: none; }
body.d3 #end .end-actions { position: absolute; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom)); width: min(780px, calc(100% - 32px)); margin: 0 auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.d3 #end .recap-btn { display: block; }
body.d3 #end .recap-box { display: none; }
body.d3 #end.recap-on .recap-box { display: block; position: absolute; top: 96px; bottom: 116px; left: 0; right: 0; width: min(680px, calc(100% - 32px)); margin: 0 auto; overflow-y: auto; padding: 16px; border-radius: var(--radius); background: rgba(30, 12, 58, .95); border: 1px solid var(--line); }
body.d3 #end .recap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
body.d3 #end .recap-head .recap-title { margin: 0; }
body.d3 #end .recap-close { display: grid; }

/* ---------- Succès : les rubriques à gauche (barre de progression), une carte par succès à droite ---------- */
main:has(> #succes.active) { max-width: 1280px; }
.succes-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-right: 52px; }
.succes-h { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, .45); }
.succes-total { padding: 4px 14px; border-radius: 99px; background: rgba(61, 255, 162, .16); color: var(--ok); font-weight: 800; }
.succes-corps { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.succes-rail { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 8px; }
.succes-rail button { display: grid; gap: 7px; padding: 12px 14px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .1); background: rgba(10, 2, 24, .6); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.succes-rail button:hover { border-color: rgba(255, 210, 63, .5); }
.succes-rail button[aria-pressed="true"] { border-color: var(--yellow); background: rgba(255, 210, 63, .14); }
.succes-rail button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.succes-rail span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.succes-rail small { color: #d9ccef; font-weight: 800; }
.succes-rail i, .succes-barre i { display: block; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--ok) calc(var(--p, 0) * 100%), rgba(255, 255, 255, .08) 0); }
.succes-titre { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.succes-grille { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.succes-carte { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 12px 12px 14px; border-radius: 18px; background: rgba(30, 12, 58, .86); border: 2px solid rgba(255, 255, 255, .12); text-align: center; }
.succes-carte.fait { border-color: var(--ok); box-shadow: 0 0 18px rgba(61, 255, 162, .25); }
.succes-carte.cours { border-color: rgba(46, 230, 255, .45); }
.succes-etat, .succes-cache { position: absolute; top: 8px; padding: 2px 8px; border-radius: 99px; font-size: .7rem; font-weight: 800; }
.succes-etat { right: 8px; background: rgba(255, 255, 255, .08); color: var(--muted); }
.succes-carte.fait .succes-etat { background: rgba(61, 255, 162, .18); color: var(--ok); }
.succes-carte.cours .succes-etat { background: rgba(46, 230, 255, .16); color: var(--cyan); }
.succes-cache { left: 8px; background: rgba(201, 162, 255, .18); color: #c9a2ff; }
.succes-img { width: 120px; height: 120px; margin-top: 18px; display: grid; place-items: center; }
.succes-img img { width: 100%; height: 100%; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #2a0f55, #160634); }
.succes-carte:not(.fait) .succes-img img { opacity: .55; filter: grayscale(.5); }
.succes-img > .ico { font-size: 3rem; color: var(--muted); }
.succes-mystere { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; border: 3px dashed rgba(201, 162, 255, .5); color: #c9a2ff; font-family: var(--display); font-size: 2.6rem; }
.succes-carte h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.succes-carte p { margin: 0; color: #d9ccef; font-size: .8rem; line-height: 1.3; }
.succes-barre { width: 100%; display: flex; align-items: center; gap: 8px; }
.succes-barre i { flex: 1; background: linear-gradient(90deg, var(--cyan) calc(var(--p, 0) * 100%), rgba(255, 255, 255, .08) 0); }
.succes-barre small { font-weight: 800; color: #d9ccef; }
.succes-recompense { margin-top: auto; color: var(--yellow); font-weight: 700; }
.succes-carte .btn { min-height: 36px; padding: 6px 14px; font-size: .82rem; }
@media (max-width: 760px) {
  .succes-corps { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .succes-rail { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .succes-rail button { flex: 0 0 auto; min-width: 128px; }
  .succes-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .succes-img { width: 96px; height: 96px; }
  .succes-carte { padding: 10px 8px 12px; }
}

/* Fin de partie : les succès obtenus pendant la partie (à gauche du podium en 3D) */
.fin-succes { max-width: 600px; margin: 0 auto 18px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); border: 1px solid rgba(61, 255, 162, .45); box-shadow: 0 0 22px rgba(61, 255, 162, .2); }
.fin-succes h2 { justify-content: center; margin-bottom: 10px; font-family: var(--display); font-weight: 400; color: var(--ok); }
.fin-succes ul { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.fin-succes li { display: flex; align-items: center; gap: 12px; }
.fin-succes li .ico { font-size: 1.8rem; color: var(--yellow); }
.fin-succes li span { display: grid; min-width: 0; }
.fin-succes li small { color: var(--yellow); }
.fin-succes .btn { width: 100%; }
body.d3 #end .fin-succes { position: absolute; left: 16px; top: 130px; width: 300px; max-height: calc(100% - 290px); overflow-y: auto; margin: 0; background: rgba(30, 12, 58, .92); }
