/* L'Aura en 3D : mobile d'abord (360 px), marges de 16 px, aucun défilement horizontal. */
:root { --mau:hsl(125 70% 70%); --z:hsl(45 88% 62%); --nuit:#0b1630; --encre:#f1f4f6; --verre:rgb(11 22 48 / .86); --bord:rgb(255 255 255 / .2); --m:16px; }
* { box-sizing:border-box; margin:0; }
html { -webkit-text-size-adjust:100%; background:var(--nuit); }
html, body { overflow-x:hidden; }
body {
  min-height:100vh; min-height:100dvh; color:var(--encre); background:var(--nuit);
  font:16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.mau { color:var(--mau); } .z { color:var(--z); }
a { color:var(--mau); }
[hidden] { display:none !important; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.app { position:fixed; inset:0; overflow:hidden; }
.app.sans3d { position:static; overflow:visible; padding:var(--m); }

.scene { position:absolute; inset:0; background:radial-gradient(ellipse at 50% 30%, #2a3f68 0, #16264a 55%, #0b1630 100%); }
canvas { display:block; width:100%; height:100%; touch-action:none; outline:none; -webkit-tap-highlight-color:transparent; }
canvas:focus-visible { box-shadow:inset 0 0 0 3px var(--z); }

/* barre du haut */
.barre {
  position:absolute; z-index:3; left:var(--m); right:var(--m); top:calc(var(--m) + env(safe-area-inset-top, 0px));
  display:flex; flex-wrap:wrap; align-items:center; gap:4px 12px; padding:8px 12px; border-radius:14px;
  background:var(--verre); border:1px solid var(--bord); backdrop-filter:blur(6px);
}
.sans3d .barre { position:static; margin-bottom:var(--m); }
h1 { font-size:1.15rem; font-weight:900; letter-spacing:.02em; white-space:nowrap; }
h1 a { color:inherit; text-decoration:none; }
.compteur { font-size:.95rem; }
.compteur b { color:var(--mau); font-variant-numeric:tabular-nums; }
.compteur span { opacity:.8; }
.qui-suis-je { font-size:.85rem; opacity:.9; flex-basis:100%; }
.pastille { font-size:.78rem; font-weight:800; padding:2px 8px; border-radius:99px; background:var(--z); color:#07090c; }

/* commandes */
.outils {
  position:absolute; z-index:3; left:var(--m); right:var(--m); bottom:calc(var(--m) + 22px + env(safe-area-inset-bottom, 0px));
  display:flex; flex-wrap:wrap; justify-content:center; gap:8px;
}
.sans3d .outils { display:none; }
button, .bouton {
  font:inherit; font-weight:800; cursor:pointer; border:0; border-radius:12px; padding:10px 14px; min-height:44px;
  background:var(--mau); color:#07090c; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
button:disabled { opacity:.45; cursor:default; }
button.jaune, .bouton.jaune { background:var(--z); }
button.discret, .bouton.discret { background:var(--verre); color:var(--encre); border:1px solid var(--bord); font-weight:700; }
button.rond { width:44px; padding:0; font-size:1.25rem; }
button[aria-pressed=true] { border-color:var(--z); background:rgb(242 201 76 / .25); }
button:focus-visible, a:focus-visible, select:focus-visible { outline:3px solid var(--z); outline-offset:2px; }

.mention {
  position:absolute; z-index:2; left:var(--m); right:var(--m); bottom:calc(4px + env(safe-area-inset-bottom, 0px));
  width:fit-content; max-width:calc(100% - 2 * var(--m)); margin:0 auto; padding:2px 8px; border-radius:8px; background:var(--verre);
  font-size:.72rem; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.sans3d .mention { position:static; white-space:normal; margin-top:var(--m); }

.chargement, .aide {
  position:absolute; left:var(--m); right:var(--m); text-align:center; pointer-events:none;
}
.chargement { top:45%; font-weight:800; font-size:1.05rem; }
.aide { bottom:calc(var(--m) + 140px); font-size:.9rem; opacity:.85; transition:opacity .6s; }
.aide.parti { opacity:0; }
.etiquette {
  position:absolute; z-index:2; left:0; top:0; pointer-events:none; max-width:calc(100vw - 2 * var(--m));
  transform:translate(-50%, calc(-100% - 18px)); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  font-size:.88rem; font-weight:700; padding:4px 10px; border-radius:8px; background:var(--verre); border:1px solid var(--z);
}
.viseur { display:none; }

/* fiche du sujet : panneau bas sur mobile, carte latérale sur ordinateur */
.fiche {
  position:absolute; z-index:4; left:var(--m); right:var(--m); bottom:calc(var(--m) + env(safe-area-inset-bottom, 0px));
  max-height:min(62vh, 520px); overflow:auto; overscroll-behavior:contain;
  padding:14px 16px 12px; border-radius:16px; background:var(--verre); border:1px solid var(--bord);
  box-shadow:0 10px 40px rgb(0 0 0 / .5); backdrop-filter:blur(8px);
}
.sans3d .fiche { position:fixed; }
.fiche h2 { font-size:1.2rem; line-height:1.25; margin:4px 32px 8px 0; color:var(--z); }
.fiche p { margin-bottom:8px; }
.fiche img { width:100%; height:auto; border-radius:10px; margin-bottom:8px; }
.fiche-tete { font-size:.85rem; opacity:.9; }
.cat { display:inline-block; padding:1px 8px; border-radius:99px; color:#07090c; font-weight:800; font-size:.78rem; }
.auteur { font-size:.92rem; }
.exemple, .petit { font-size:.8rem; opacity:.75; }
.source { font-size:.85rem; margin:4px 0 0; }
.fiche-actions { display:flex; flex-wrap:wrap; gap:8px; margin:8px 0 4px; }
.fiche-actions > * { flex:1 1 130px; }
.fermer { position:absolute; right:8px; top:8px; width:40px; min-height:40px; padding:0; background:transparent; color:var(--encre); font-size:1.6rem; }
@media (min-width:760px) {
  .fiche { left:auto; width:380px; top:calc(var(--m) + 70px); bottom:auto; max-height:calc(100vh - 200px); }
  .barre { right:auto; max-width:calc(100% - 2 * var(--m)); }
}

/* partage */
dialog.partage {
  margin:auto; max-height:calc(100dvh - 2 * var(--m)); overflow:auto;
  width:calc(100vw - 2 * var(--m)); max-width:440px; padding:16px; border-radius:16px; border:1px solid var(--bord);
  background:var(--nuit); color:var(--encre);
}
dialog::backdrop { background:rgb(0 0 0 / .6); }
dialog h2 { font-size:1.15rem; color:var(--z); margin-bottom:8px; }
dialog p { margin-bottom:10px; font-size:.92rem; }
#pNatif { width:100%; margin-bottom:10px; }
.reseaux { display:grid; grid-template-columns:repeat(auto-fill, minmax(120px, 1fr)); gap:8px; }
.reseaux a { text-align:center; }

/* repli sans WebGL */
.repli { max-width:980px; margin:0 auto; padding-bottom:50vh; }
.repli h2 { color:var(--z); margin-bottom:6px; }
.repli p { margin-bottom:10px; }
.choix { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-weight:700; margin-bottom:12px; }
.choix select { font:inherit; max-width:100%; min-height:44px; border-radius:10px; padding:6px 8px; }
.pieces { display:grid; grid-template-columns:repeat(auto-fill, minmax(72px, 1fr)); gap:6px; }
.piece { min-height:44px; padding:4px; background:#e9eef2; color:#07090c; font-weight:700; font-size:.85rem; font-variant-numeric:tabular-nums; }
.piece.retournee { outline:2px solid #fff; }
.pager { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:12px; }
.panne { padding:var(--m); text-align:center; }

@media (prefers-reduced-motion: reduce) { * { transition:none !important; } }

/* ---------- Panneau « En direct » ---------- */
.point-vert { color: var(--mau); }
.direct { position: fixed; z-index: 30; left: 12px; right: 12px; top: 84px; max-height: calc(100dvh - 180px); overflow: auto; background: rgba(11,22,48,.96); border: 1px solid #2c3d64; border-radius: 14px; padding: 14px 16px; color: var(--encre); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.direct[hidden] { display: none; }
.direct-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.direct-tete h2 { margin: 0; font-size: 1.1rem; color: var(--z); }
.direct-chiffres { margin: 6px 0 2px; }
.direct-etat { color: #ffb3b3; min-height: 0; margin: 4px 0; font-size: .9rem; }
.direct-colonnes { display: grid; grid-template-columns: 1fr; gap: 12px; }
.direct h3 { font-size: .95rem; margin: 10px 0 6px; color: var(--mau); }
.classement, .derniers { list-style: none; margin: 0; padding: 0; }
.classement li, .derniers li { display: grid; grid-template-columns: 26px 1.6em 1fr auto; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid #22345c; font-size: .92rem; }
.derniers li { grid-template-columns: 1.6em 1fr auto auto; }
.classement .rang { opacity: .7; font-variant-numeric: tabular-nums; }
.classement .score { font-weight: 800; color: var(--z); font-variant-numeric: tabular-nums; }
.classement .top1 .score { color: #ffd84d; }
.classement .top2 .score { color: #e6e6e6; }
.classement .top3 .score { color: #e0a15a; }
.derniers .piece, .derniers .heure { opacity: .75; font-size: .85rem; font-variant-numeric: tabular-nums; }
.direct .vide { display: block; opacity: .75; }
.direct-maj { font-size: .8rem; opacity: .7; margin: 10px 0 0; }
@media (min-width: 720px) { .direct { left: auto; right: 16px; width: 420px; } .direct-colonnes { grid-template-columns: 1fr 1fr; } }
.direct .piece { background: none; border: 0; padding: 0; box-shadow: none; }
.fiche-carte { margin: 10px 0; }
.fiche-carte iframe { width: 100%; height: 190px; border: 1px solid #2c3d64; border-radius: 10px; background: #0f1a33; }
.fiche-carte-liens { margin: 6px 0 2px; font-size: .92rem; }
.fiche-carte-liens a { color: var(--mau); font-weight: 700; }
.fiche-credit { font-size: .75rem; opacity: .7; margin: 4px 0 0; }
/* ---------- Formulaire du gagnant ---------- */
.gagnant { position: fixed; inset: 0; z-index: 40; background: rgba(5,10,24,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.gagnant[hidden] { display: none; }
.gagnant-carte { width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #15223f; border: 1px solid #2c3d64; border-radius: 14px; padding: 18px; color: var(--encre); box-shadow: 0 12px 36px rgba(0,0,0,.5); }
.gagnant h2 { margin: 0 0 8px; font-size: 1.2rem; color: var(--z); }
.gagnant label { display: block; font-weight: 700; margin: 10px 0 4px; }
.gagnant input[type=text], .gagnant input:not([type=checkbox]) { width: 100%; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid #2c3d64; background: #0f1a33; color: var(--encre); }
.gagnant .gconsent { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.gagnant .ginfo { font-size: .85rem; opacity: .85; margin: 10px 0; }
.gagnant .ginfo a { color: var(--mau); }
.gagnant .getat { color: #ffb3b3; min-height: 1.2em; margin: 6px 0; font-size: .9rem; }
.gagnant .gactions { display: flex; gap: 10px; flex-wrap: wrap; }
/* ---------- Bandeau LIVE façon chat ---------- */
.live { flex-basis:100%; display:flex; align-items:center; gap:10px; margin-top:4px; padding-top:8px; border-top:1px solid var(--bord); min-width:0; }
.live-badge { display:inline-flex; align-items:center; gap:6px; flex:none; background:#e91916; color:#fff; font-weight:900; font-size:.78rem; letter-spacing:.08em; padding:3px 9px; border-radius:6px; }
.live-badge.hors { background:#5b6478; }
.live-point { width:7px; height:7px; border-radius:50%; background:#fff; animation:live-pouls 1.2s ease-in-out infinite; }
@keyframes live-pouls { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.25; transform:scale(.7); } }
.live-piste { flex:1 1 auto; min-width:0; overflow:hidden; mask-image:linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image:linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.live-defile { display:inline-flex; white-space:nowrap; animation:live-defile linear infinite; }
.live-piste:hover .live-defile, .live-piste:focus-within .live-defile { animation-play-state:paused; }
@keyframes live-defile { from { transform:translateX(0); } to { transform:translateX(-50%); } }
.live-msg { display:inline-flex; align-items:center; gap:4px; padding:3px 12px 3px 0; margin-right:18px; color:var(--encre); text-decoration:none; font-size:.85rem; border-right:1px dashed #2c3d64; }
.live-msg:hover, .live-msg:focus-visible { text-decoration:underline; }
.live-pseudo { font-weight:800; }
.live-msg b { color:var(--z); font-variant-numeric:tabular-nums; }
.live-vide { opacity:.75; font-style:italic; }
.live-viewers { flex:none; font-size:.8rem; opacity:.9; font-variant-numeric:tabular-nums; white-space:nowrap; }
@media (prefers-reduced-motion: reduce) { .live-defile { animation:none; } .live-point { animation:none; } }
/* ---------- Bandeau LIVE : une seule ligne qui défile ---------- */
.live { flex-basis:100%; height:30px; margin-top:4px; padding-top:0; border-top:0; overflow:hidden; display:flex; align-items:center; gap:8px; }
.live-badge { font-size:.7rem; padding:2px 7px; }
.live-piste { display:flex; align-items:center; height:100%; flex:1 1 0; min-width:0; overflow:hidden; }
.live-defile { display:flex; flex-wrap:nowrap; width:max-content; align-items:center; height:100%; }
.live-msg { flex:none; white-space:nowrap; font-size:.8rem; padding:0 10px 0 0; margin-right:14px; text-decoration:none; }
.live-viewers { font-size:.72rem; }
@media (max-width:640px) { .live-viewers { display:none; } .live { gap:6px; } }
.live-neuf { animation: live-neuf 3s ease-out 1; border-radius:6px; }
@keyframes live-neuf { 0% { background:rgba(233,25,22,.55); transform:translateY(-6px); opacity:0; } 25% { opacity:1; transform:translateY(0); } 100% { background:transparent; } }
/* ---------- Bandeau : un message à la fois, qui monte ---------- */
.live-piste { position:relative; height:30px; flex:1 1 0; min-width:0; overflow:hidden; -webkit-mask-image:none; mask-image:none; }
.live-slot { position:absolute; inset:0; display:flex; align-items:center; }
.live-msg { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; margin:0; padding:0; border:0; font-size:.85rem; }
.live-monte { animation:live-monte .45s ease-out both; }
@keyframes live-monte { from { transform:translateY(100%); opacity:0; } to { transform:translateY(0); opacity:1; } }
@media (prefers-reduced-motion: reduce) { .live-monte { animation:none; } }
.mise-a-jour { position:fixed; left:50%; bottom:14px; transform:translateX(-50%); z-index:60; background:#15223f; border:1px solid #2c3d64; color:var(--z); padding:8px 14px; border-radius:10px; font-weight:700; font-size:.9rem; margin:0; }

/* ---------- Mobile : interface compacte, calée en bas ---------- */
@media (max-width: 640px) {
  :root { --m: 8px; }
  .barre { top: calc(6px + env(safe-area-inset-top, 0px)); padding: 5px 8px; gap: 2px 8px; border-radius: 12px; }
  h1 { font-size: .95rem; }
  .compteur { font-size: .8rem; }
  .qui-suis-je { font-size: .72rem; }
  .pastille { font-size: .65rem; padding: 1px 6px; }
  .live { height: 24px; margin-top: 2px; padding-top: 4px; gap: 6px; }
  .live-msg { font-size: .74rem; }
  .outils { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); gap: 5px; }
  button, .bouton { min-height: 32px; padding: 5px 9px; font-size: .78rem; border-radius: 9px; gap: 4px; }
  button.rond { width: 32px; font-size: 1rem; }
  .aide { bottom: calc(8px + 84px + env(safe-area-inset-bottom, 0px)); font-size: .78rem; }
  .fiche { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; max-height: min(58vh, 460px); padding: 10px 12px; }
  .fiche h2 { font-size: 1.05rem; }
  .direct { top: 64px; }
}
@media (max-width: 640px) { .fiche { bottom: calc(40px + env(safe-area-inset-bottom, 0px)); max-height: min(54vh, 440px); } }
