/* ============================================================
   OLB PARTY — Base mobile-first (tap natif, une main, 10 s)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0d0d16; color: #eceaff;
  overscroll-behavior: none; touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top) 14px calc(env(safe-area-inset-bottom) + 16px); }
.boot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #9a93c9; }
.boot-ball { font-size: 52px; animation: bounce 1.2s ease infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ---------- Typo & blocs ---------- */
h1 { font-size: 26px; letter-spacing: .5px; }
h2 { font-size: 19px; margin: 14px 0 8px; }
.sub { color: #9a93c9; font-size: 13px; line-height: 1.45; }
.card {
  background: linear-gradient(160deg, rgba(139,92,246,.10), rgba(236,72,153,.05));
  border: 1px solid rgba(139,92,246,.25); border-radius: 18px;
  padding: 14px; margin: 10px 0;
}
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.hidden { display: none !important; }
.grow { flex: 1; }

/* ---------- Boutons : gros, tap, une main ---------- */
.btn {
  display: block; width: 100%; border: 0; cursor: pointer;
  padding: 15px 18px; border-radius: 16px;
  font-size: 16px; font-weight: 800; letter-spacing: .4px; color: #fff;
  transition: transform .08s ease, filter .15s;
}
.btn:active { transform: scale(.965); }
.btn.ghost { background: rgba(139,92,246,.12); border: 1px solid rgba(139,92,246,.4); box-shadow: none; }
.btn.small { width: auto; padding: 9px 13px; font-size: 13px; border-radius: 12px; }
.btn.danger { background: linear-gradient(135deg,#ef4444,#991b1b); box-shadow: 0 8px 24px rgba(239,68,68,.3); }
.btn:disabled { opacity: .45; filter: grayscale(.4); }
.btn.ok { background: linear-gradient(135deg,#10b981,#065f46); box-shadow: 0 8px 24px rgba(16,185,129,.3); }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

input.field {
  width: 100%; padding: 15px 16px; border-radius: 16px; font-size: 17px;
  background: #16161f; border: 1px solid rgba(139,92,246,.35); color: #fff; outline: none;
}
input.field:focus { border-color: #8b5cf6; }
input.code-input { text-transform: uppercase; letter-spacing: 10px; text-align: center; font-weight: 900; font-size: 24px; }

/* ---------- Header de session ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 2px 6px; }
.codechip {
  font-weight: 900; letter-spacing: 3px; font-size: 18px; padding: 8px 14px; border-radius: 12px;
  background: rgba(139,92,246,.15); border: 1px dashed rgba(139,92,246,.6); color: #c4b5fd;
}
.phasepill {
  padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 800;
  border: 1px solid rgba(139,92,246,.45); color: #d6c9ff;
  box-shadow: 0 0 26px -8px #8b5cf6;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 22px; color: #a78bfa; }
.timer.urgent { color: #f87171; animation: pulse .8s ease infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Lobby ---------- */
.playerlist { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.prow {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
}
.prow .avatar { width: 34px; height: 34px; border-radius: 50%; background: #26263a; display: flex; align-items: center; justify-content: center; font-weight: 900; overflow: hidden; flex: none; }
.prow .avatar img { width: 100%; height: 100%; object-fit: cover; }
.prow .pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pscore { margin-left: auto; font-weight: 900; color: #fbbf24; font-variant-numeric: tabular-nums; }
.prow .pstate { font-size: 11px; color: #9a93c9; }
.prow.me { border-color: rgba(139,92,246,.55); background: rgba(139,92,246,.10); }
.prow.dead { opacity: .45; }
.prow.falling { animation: fall .8s ease-in forwards; }
@keyframes fall { to { transform: translateY(70px) rotate(8deg); opacity: 0; } }
.readydot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }

/* ---------- CHISEL ---------- */
.chisel-stage { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
/* HAUTEUR FIXE, identique en MÉMORISEZ et en GRAVEZ : c'est le seul moyen
   d'avoir UN seul cube, placé au même endroit et de la même taille dans
   l'écran d'exemple et l'écran de jeu (sinon la carte de consigne, static
   en memorize et overlay en carve, modifie la taille du wrap → deux cubes
   différents — retour fondateur session 9). */
.canvas-wrap { position: relative; flex: none; height: clamp(300px, 54vh, 560px); border-radius: 18px; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, #1c1830, #0d0d16 75%); border: 1px solid rgba(139,92,246,.2); }
.canvas-wrap.invert { filter: invert(1) hue-rotate(180deg); }
.canvas-wrap.frozen { filter: saturate(.3) brightness(1.15); }
canvas.cube { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 3; }
.hud .tag { background: rgba(13,13,22,.72); border: 1px solid rgba(139,92,246,.35); padding: 5px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.hud .tag.code { color: #fbbf24; letter-spacing: 1px; }
.bigmsg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 20px; z-index: 4; pointer-events: none;
}
.bigmsg .t1 { font-size: 30px; font-weight: 900; letter-spacing: 1px; text-shadow: 0 4px 24px rgba(0,0,0,.7); }
.bigmsg .t2 { font-size: 14px; color: #cfc8f5; text-shadow: 0 2px 12px rgba(0,0,0,.8); }
/* carte MÉMORISEZ en overlay HAUT du canvas-wrap (session 10) : le cube garde
   la MÊME position absolue et la MÊME taille en MÉMORISEZ et en GRAVEZ —
   un seul cube indiscernable entre les deux écrans. Voile dégradé derrière
   le texte : le cube reste intégralement visible. */
.bigmsg.top { position: absolute; inset: 0 0 auto 0; justify-content: flex-start; padding: 12px 10px 30px; background: linear-gradient(180deg, rgba(13,13,22,.9) 0%, rgba(13,13,22,.5) 62%, rgba(13,13,22,0) 100%); }
.bigmsg.top .t1 { font-size: 24px; }

/* Sol qui s'ouvre + flèche de verdict */
.floorcrack {
  position: absolute; left: 50%; bottom: 12%; width: 120px; height: 22px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(8,6,18,.95) 25%, rgba(76,29,149,.55) 72%, rgba(139,92,246,.18) 100%);
  border-radius: 50%; box-shadow: 0 0 22px 6px rgba(139,92,246,.30);
  animation: crack .5s ease forwards; z-index: 2;
}
@keyframes crack { from { transform: translateX(-50%) scale(.2); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.verdict-arrow {
  position: absolute; left: 50%; top: 8%; transform-origin: 50% 130px; z-index: 5;
  font-size: 44px; filter: drop-shadow(0 0 14px rgba(251,191,36,.8));
  transition: transform .45s cubic-bezier(.2,.8,.3,1.1);
}
.verdict-name {
  position: absolute; left: 0; right: 0; bottom: 20%; text-align: center; z-index: 5;
  font-size: 20px; font-weight: 900; text-shadow: 0 2px 14px #000;
}
.verdict-badge {
  position: absolute; left: 50%; top: 34%; transform: translateX(-50%); z-index: 6;
  font-size: 56px; animation: pop .45s cubic-bezier(.2,1.6,.4,1);
}
@keyframes pop { from { transform: translateX(-50%) scale(.2); opacity: 0; } }

.carve-actions { display: flex; gap: 10px; padding: 12px 0 2px; }
.carve-actions .btn { padding: 17px; }

/* ---------- Console hôte (directeur) ---------- */
.dirgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dirbtn {
  border: 1px solid rgba(236,72,153,.45); background: rgba(236,72,153,.12); color: #fff;
  padding: 13px 8px; border-radius: 14px; font-weight: 800; font-size: 13px; cursor: pointer;
}
.dirbtn:active { transform: scale(.95); }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 10px 4px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05); color: #cfc8f5; font-weight: 800; font-size: 12px; cursor: pointer;
}
.seg button.on.calme { background: rgba(96,165,250,.25); border-color: #60a5fa; color: #fff; }
.seg button.on.chaos { background: rgba(251,191,36,.25); border-color: #fbbf24; color: #fff; }
.seg button.on.enfer { background: rgba(239,68,68,.25); border-color: #ef4444; color: #fff; }
.logbox { max-height: 130px; overflow-y: auto; font-size: 11.5px; color: #a49dcf; display: flex; flex-direction: column; gap: 3px; }
.logbox div { border-left: 2px solid rgba(139,92,246,.35); padding-left: 6px; }

/* ---------- Debrief / tableau ---------- */
.podium { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.podium .prow:first-child { border-color: #fbbf24; background: rgba(251,191,36,.10); }
.podium .rank { width: 28px; font-weight: 900; color: #fbbf24; text-align: center; }
.banner { text-align: center; padding: 22px 10px; }
.banner .emoji { font-size: 58px; }
.banner .win { font-size: 22px; font-weight: 900; margin-top: 6px; }

/* ---------- Toasts / FX ---------- */
#toasts { position: fixed; left: 0; right: 0; top: env(safe-area-inset-top); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding-top: 10px; }
.toast { background: rgba(20,20,32,.94); border: 1px solid rgba(139,92,246,.5); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 13.5px; font-weight: 700; opacity: 0; transform: translateY(-8px); transition: all .25s; max-width: 88vw; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.t-err { border-color: rgba(239,68,68,.6); }
#fxlayer { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.confetti { position: absolute; top: -12px; width: 9px; height: 14px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(720deg); } }
.poof { position: absolute; font-size: 34px; transform: translate(-50%,-50%); animation: poof .85s ease-out forwards; }
@keyframes poof { 0% { transform: translate(-50%,-50%) scale(.4); opacity: 1; } 100% { transform: translate(-50%,-90%) scale(1.6); opacity: 0; } }

/* ---------- Mod panel ⚖️ ---------- */
.modbar { display: flex; gap: 6px; margin-top: 6px; }
.modbar button { flex: 1; font-size: 11px; padding: 8px 2px; border-radius: 10px; border: 1px solid rgba(251,191,36,.4); background: rgba(251,191,36,.1); color: #fde68a; font-weight: 800; }

@media (min-width: 561px) {
  #app { border-left: 1px solid rgba(139,92,246,.12); border-right: 1px solid rgba(139,92,246,.12); }
}
