/* À Table ! — Hub central — Sebdesign Studio */
:root {
  --blanc: #F3F7FF;
  --blanc-doux: rgba(222, 233, 255, 0.72);
  --trait: rgba(160, 196, 255, 0.24);
  --or: #FFD45C;
  --police: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh; color: var(--blanc); font-family: var(--police);
  background: #04207F; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .4; cursor: default; }
svg { display: block; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; z-index: 0; transition: opacity .6s; }

.page {
  position: relative; z-index: 1; max-width: 460px; margin: 0 auto; height: 100dvh; overflow: hidden;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.page > * { flex-shrink: 0; }
.page.libre { height: auto; min-height: 100dvh; overflow: visible; }
.page.centre { justify-content: center; text-align: center; }
.page.avec-barre { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.verre { position: relative; }

/* ---------- Textes */
h1 { margin: 0; font-weight: 800; font-size: 30px; letter-spacing: -0.02em; }
h1.h-jeu { font-size: 26px; }
.logo { font-size: 52px; text-align: center; }
.sous-titre { margin: 2px 0 0; font-size: 14px; font-weight: 500; color: var(--blanc-doux); }
.titre-bloc { margin: 12px 0 0; font-size: 24px; font-weight: 700; }
.etiquette { margin: 4px 0 -8px 6px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--blanc-doux); }
.etiq-aide { text-transform: none; letter-spacing: 0; font-weight: 500; }
.aide { margin: 0; font-size: 14px; color: var(--blanc-doux); line-height: 1.4; }
.centre { text-align: center; }
.erreur { margin: 0; color: #FFB4A8; font-weight: 700; }
.lien { align-self: center; padding: 8px; font-size: 14px; font-weight: 600; color: var(--blanc-doux); text-decoration: underline; text-underline-offset: 3px; }
.lien.petit { font-size: 13px; padding: 4px 0; align-self: flex-start; }
.pied { margin-top: auto; padding-top: 8px; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--blanc-doux); }
.bandeau-demo { margin: 0; padding: 10px 14px; border-radius: 14px; font-size: 13px; color: var(--blanc-doux); border: 1px dashed rgba(170, 205, 255, .5); }

/* ---------- En-tête */
.entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.pastille { height: 42px; padding: 0 16px; border-radius: 21px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; white-space: nowrap; letter-spacing: .06em; }
.pastille svg { width: 18px; height: 18px; }

/* ---------- Accueil, formulaires */
.accueil-haut { margin-top: 18vh; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.actions-bas { display: grid; gap: 12px; margin-top: 8px; }
.bouton { height: 58px; border-radius: 22px; font-size: 17px; font-weight: 700; }
.bouton.principal { font-size: 18px; }
.champ { width: 100%; height: 60px; border: 0; background: transparent; caret-color: #A8E6FF; -webkit-appearance: none; appearance: none; border-radius: 22px; padding: 0 20px; font: 600 22px var(--police); color: var(--blanc); outline: none; }
.champ::placeholder { color: rgba(222, 233, 255, .45); }
.champ:focus { box-shadow: inset 0 0 0 2px rgba(170, 220, 255, .8); }
.champ-code { text-align: center; letter-spacing: .4em; font-size: 34px; text-transform: uppercase; }

/* ---------- Segments */
.segments { display: grid; padding: 5px; border-radius: 24px; gap: 2px; }
.segments.s3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segments.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.segment { height: 44px; border-radius: 19px; font-weight: 600; font-size: 14px; color: var(--blanc-doux); transition: color .25s, background .25s, box-shadow .25s; }
.segment.sel { color: var(--blanc); background: rgba(140, 180, 255, .26); box-shadow: inset 0 0 0 1px rgba(170, 210, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .25); }
.humour .segment { height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.humour .segment.sel { box-shadow: inset 0 0 0 1.5px var(--or), 0 0 16px rgba(255, 212, 92, .25); }
.pieces-seg { display: flex; gap: 3px; min-height: 8px; }
.pieces-seg i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(4, 32, 127, .5); }

/* ---------- Jetons (avatars) */
.jeton {
  --c: #8EC5FF;
  width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 800; font-size: 17px; color: #061A5C;
  background: radial-gradient(circle at 35% 30%, #fff8 0, transparent 45%), var(--c);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55), 0 4px 12px rgba(0, 10, 60, .35);
}
.jeton.moi { outline: 2.5px solid var(--blanc); outline-offset: 2px; }
.jeton.deplacable { touch-action: none; cursor: grab; }
.jeton.flottant { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; box-shadow: 0 12px 28px rgba(0, 10, 60, .55); transition: none; }
.jeton.piece { width: 22px; height: 22px; font-size: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 0 0 1.5px rgba(4, 32, 127, .6); }
.jeton.piece.moi { outline: 1.5px solid var(--or); outline-offset: 1px; }

/* ---------- Configuration */
.invitation { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center; padding: 14px; border-radius: 24px; }
.invitation .qr { width: 112px; border-radius: 12px; }
.inv-titre { margin: 0 0 4px; font-weight: 700; font-size: 17px; }
.inv-compte { margin: 8px 0 0; font-weight: 700; font-size: 14px; color: #A8E6FF; }
.panneau-table { border-radius: 28px; padding: 6px; }
.table-zone { position: relative; width: 100%; aspect-ratio: 340 / 440; }
.panneau-table .table-zone { width: auto; height: min(50vh, 440px); margin: 0 auto; }
.table-zone svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.plateau-table { fill: rgba(130, 175, 255, .16); stroke: rgba(175, 215, 255, .7); stroke-width: 1.5; }
.joueur-table { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 1; }
.joueur-table em { position: absolute; top: 48px; font-style: normal; font-size: 11px; font-weight: 700; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0, 10, 60, .7); }
.joueur-table.fantome { opacity: .3; }
.table-zone.vise .plateau-table { stroke: var(--or); }
.panneau-table { display: flex; flex-direction: column; align-items: center; }
.repartir { align-self: center !important; margin: 2px 0 6px; }
.siege { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.siege.vide > span {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  color: rgba(222, 233, 255, .55); border: 1.5px dashed rgba(175, 215, 255, .55);
}
.siege em { position: absolute; top: 48px; font-style: normal; font-size: 11px; font-weight: 700; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0, 10, 60, .7); }
.siege.vise > span { transform: scale(1.15); box-shadow: 0 0 0 3px var(--or), 0 0 18px rgba(255, 212, 92, .6); }
.siege > span { transition: transform .15s, box-shadow .15s; }
.plateau-attente { border-radius: 24px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 84px; transition: box-shadow .2s; }
.plateau-attente.vise { box-shadow: inset 0 0 0 2px var(--or); }
.pa-titre { margin: 0; font-size: 14px; font-weight: 700; }
.pa-jetons { display: flex; flex-wrap: wrap; gap: 12px; }
.pa-joueur { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; }
.pa-joueur em { font-style: normal; font-size: 11px; font-weight: 600; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blanc-doux); }

/* ---------- Attente joueurs */
.attente-config { border-radius: 28px; padding: 28px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; margin-top: 6vh; }
.att-titre { margin: 0; font-size: 22px; font-weight: 700; }
.points { display: flex; gap: 8px; }
.points span { width: 10px; height: 10px; border-radius: 50%; background: #A8E6FF; animation: point 1.2s infinite ease-in-out; }
.points span:nth-child(2) { animation-delay: .15s; } .points span:nth-child(3) { animation-delay: .3s; }
@keyframes point { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.1); } }
.liste-arrives { border-radius: 24px; padding: 14px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Hub */
.table-hub { border-radius: 22px; padding: 6px 12px 6px 4px; display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; }
.table-zone.petite .joueur-table .jeton { width: 22px; height: 22px; font-size: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6); }
.table-zone.petite .jeton.moi { outline-width: 2px; outline-offset: 1px; }
.table-zone.petite .siege.vide > span { width: 20px; height: 20px; font-size: 0; }
.th-titre { margin: 0 0 2px; font-weight: 700; font-size: 16px; }
.grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 158px; gap: 12px; }
.carte { display: flex; flex-direction: column; justify-content: flex-start; gap: 8px; padding: 14px 14px 12px; border-radius: 24px; text-align: left; transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), box-shadow .25s; }
.carte:active { transform: scale(.96); }
.carte .haut { display: flex; justify-content: space-between; align-items: center; }
.carte svg { width: 26px; height: 26px; }
.carte .info { font-size: 12px; font-weight: 600; color: var(--blanc-doux); }
.carte .nom { font-size: 16px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.carte .desc { font-size: 12.5px; font-weight: 500; color: var(--blanc-doux); line-height: 1.3; }
.carte.mon-vote { box-shadow: inset 0 0 0 2px var(--or), 0 0 22px rgba(255, 212, 92, .28); }
.pieces-carte { margin-top: auto; display: flex; align-items: center; min-height: 22px; }
.pieces-carte .jeton { margin-right: -6px; }
.pieces-carte .plus { margin-left: 10px; font-size: 12px; font-weight: 700; }
.liens-bas { display: flex; justify-content: center; gap: 18px; }
.barre-etat {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(424px, calc(100% - 36px)); height: 58px; border-radius: 29px; padding: 0 18px 0 12px;
  display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600;
}
.be-pieces { display: flex; gap: 4px; }
.piece-vide { width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed rgba(222, 233, 255, .5); display: inline-block; }

/* ---------- Jeu provisoire */
.jeu-provisoire { border-radius: 28px; padding: 30px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 4vh; }
.jeu-provisoire h2 { margin: 0; font-size: 22px; text-align: center; }
.jp-icone svg { width: 56px; height: 56px; }

/* ---------- Fenêtres */
.voile { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: rgba(2, 10, 50, .55); }
.modal { width: 100%; max-width: 420px; max-height: calc(100dvh - 36px); overflow: auto; border-radius: 28px; padding: 22px; display: grid; gap: 14px; }
.modal h2 { margin: 0; text-align: center; font-size: 22px; }
.modal .qr { width: min(220px, 64vw); justify-self: center; border-radius: 14px; }
.code-geant { margin: 0; text-align: center; font-size: 44px; font-weight: 800; letter-spacing: .3em; padding-left: .3em; }
.classement { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.classement li { display: grid; grid-template-columns: 24px 44px 1fr auto; gap: 10px; align-items: center; min-height: 54px; padding: 0 6px; border-bottom: 1px solid var(--trait); }
.rang { font-weight: 800; color: var(--blanc-doux); text-align: center; }
.cl-nom { font-weight: 700; }
.cl-pts { font-weight: 800; }

/* ---------- Décompte, pièce 3D */
#overlay.actif { position: fixed; inset: 0; z-index: 40; }
.voile-lancement { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2, 10, 50, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.decompte { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; text-align: center; }
.bulle-chiffre { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: rgba(90, 130, 240, .25); box-shadow: inset 0 0 0 1.5px rgba(170, 215, 255, .7), 0 0 40px rgba(90, 170, 255, .35); }
.bulle-chiffre span { font-size: 76px; font-weight: 800; animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: scale(1.5); opacity: 0; } 30% { transform: scale(1); opacity: 1; } 100% { transform: scale(.92); opacity: .9; } }
.sous-decompte { margin: 0; font-size: 18px; font-weight: 700; }
.titre-egalite { margin: 0; font-size: 22px; font-weight: 800; }
.pieces { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; padding-top: 80px; }
.piece-scene { width: 150px; height: 150px; perspective: 700px; }
.piece3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: lancer 2.6s cubic-bezier(.2, .7, .2, 1) forwards; }
.face {
  position: absolute; inset: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; color: #4A3300; font-weight: 800; font-size: 13px; text-align: center;
  background: radial-gradient(circle at 35% 30%, #FFF4C2 0, #FFD45C 45%, #E0A92A 100%);
  box-shadow: inset 0 0 0 5px #F0BE3C, inset 0 0 0 7px #C9922086, 0 10px 30px rgba(0, 0, 0, .35);
}
.face svg { width: 34px; height: 34px; }
.face.arriere { transform: rotateY(180deg); }
@keyframes lancer {
  0% { transform: translateY(0) rotateY(0); }
  40% { transform: translateY(-70px) rotateY(1080deg); }
  100% { transform: translateY(0) rotateY(1800deg); }
}
.carte-lancement { border-radius: 30px; padding: 26px 30px; display: flex; flex-direction: column; align-items: center; gap: 8px; animation: pop 0.9s ease-out; }
.carte-lancement svg { width: 52px; height: 52px; }
.carte-lancement strong { font-size: 22px; }
.carte-lancement span { color: var(--blanc-doux); font-weight: 600; }

/* ---------- Notifications */
#toasts { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { max-width: 440px; padding: 12px 16px; border-radius: 16px; background: rgba(8, 24, 90, .92); box-shadow: inset 0 0 0 1px rgba(170, 210, 255, .4); font-size: 14px; font-weight: 600; transition: opacity .4s, transform .4s; }
.toast.sortie { opacity: 0; transform: translateY(-8px); }

/* ---------- Verre CSS pour ce qui flotte au-dessus du contenu (barre du bas, fenêtres) */
.verre-css {
  background: rgba(28, 62, 170, .72); -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(160, 205, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .25), 0 12px 32px rgba(0, 10, 60, .35);
}

/* ---------- Barre de test (mode démo) */
.barre-test {
  position: fixed; z-index: 45; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(440px, calc(100% - 16px)); height: 46px; border-radius: 23px; padding: 0 6px 0 14px;
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
}
.bt-titre { letter-spacing: .12em; color: #FFD45C; }
.bt-vues { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.bt-vue { padding: 3px; border-radius: 50%; }
.bt-vue.sel { box-shadow: 0 0 0 2px #FFD45C; }
.bt-bouton { flex: none; height: 34px; padding: 0 10px; border-radius: 17px; background: rgba(255, 255, 255, .12); white-space: nowrap; }
.bt-bouton.actif { background: rgba(255, 212, 92, .25); box-shadow: inset 0 0 0 1px #FFD45C; }
body.avec-test #toasts { top: calc(62px + env(safe-area-inset-top)); }
body.avec-test .page { padding-top: calc(70px + env(safe-area-inset-top)); }

/* ---------- Repli sans WebGL : verre en CSS */
.sans-3d { background: linear-gradient(115deg, #021A78 0%, #0A2E96 45%, #1B79B8 80%, #6CC6C8 100%) fixed; }
.sans-3d #scene { opacity: 0; }
.sans-3d .verre, .sans-3d .champ { background: rgba(70, 110, 230, .24); -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3); box-shadow: inset 0 0 0 1px rgba(150, 200, 255, .45), 0 10px 30px rgba(0, 10, 60, .25); }
.sans-3d .carte.mon-vote { box-shadow: inset 0 0 0 2px var(--or), 0 0 22px rgba(255, 212, 92, .28); }

@media (prefers-reduced-motion: reduce) { .piece3d { animation-duration: 1.2s; } .points span { animation: none; opacity: .8; } }

.entete-boutons { display: flex; gap: 8px; align-items: center; }
.pastille.rond { width: 42px; padding: 0; justify-content: center; }
.pastille.rond svg { width: 22px; height: 22px; }

/* ---------- Roulette du café */
.cafe-carte-hub { border: 1.5px dashed rgba(255, 212, 92, .7); }
.cafe-ico { font-size: 24px; line-height: 1; }
.cafe-ecran { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(6, 10, 30, .94); color: #FFF; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; transition: background .08s; }
.cafe-ecran.allume { background: #FFD45C; color: #2B1A0E; }
.cafe-ecran.gagne { background: radial-gradient(circle at 50% 35%, #FFE7A0, #C8862E); color: #2B1A0E; }
.cafe-ecran .cafe-carte { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(100%, 380px); text-align: center; }
.cafe-sur { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; opacity: .8; }
.cafe-titre { margin: 0; font-size: clamp(30px, 9vw, 42px); font-weight: 800; line-height: 1.1; }
.cafe-sous { margin: 0; font-size: 15px; opacity: .85; }
.cafe-tasse { font-size: 90px; line-height: 1; animation: pop .8s ease-out; }
.cafe-table { position: relative; width: 70%; aspect-ratio: 340 / 440; max-height: 40vh; border-radius: 50%; border: 2px solid currentColor; opacity: .95; }
.cafe-jeton { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .15); border: 2px solid currentColor; font-weight: 800; font-size: 14px; }
.cafe-jeton.on { background: #FFD45C; color: #2B1A0E; box-shadow: 0 0 22px #FFD45C; transform: translate(-50%, -50%) scale(1.25); }
.cafe-ecran.allume .cafe-jeton.on { background: #2B1A0E; color: #FFD45C; box-shadow: none; }
.cafe-jeton.cible { background: #2B1A0E; color: #FFD45C; transform: translate(-50%, -50%) scale(1.35); }
.cafe-btn { min-height: 52px; padding: 0 30px; border: 0; border-radius: 26px; background: #2B1A0E; color: #FFD45C; font-family: inherit; font-weight: 800; font-size: 17px; }
.cafe-ecran:not(.gagne) .cafe-btn { background: #FFD45C; color: #2B1A0E; }
