/* ============================================================
   PROMPTWIS(C)E : app.css
   Vue joueur : écrans, atelier hybride, feuilles, chrono, chat
   ============================================================ */

html, body { height: 100%; }
body { overscroll-behavior: none; }

/* ---------- Écrans ------------------------------------------ */
[hidden] { display: none !important; }
.scr { display: none; min-height: 100dvh; position: relative; z-index: 1; }
/* fill-mode backwards, PAS both : une animation de transform qui « remplit »
   fait de l'écran le containing block des position:fixed internes, et le
   bouton du rail se retrouvait ancré au bas du document (V5 §5). */
.scr.is-on { display: flex; flex-direction: column; animation: scr-in .38s var(--ease) backwards; }
@keyframes scr-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* L'écran de jeu tient dans le viewport : rail et atelier scrollent chacun
   pour soi, la page ne fait plus 1 800 px de haut (V5 §5). */
#scr-game.is-on { height: 100dvh; overflow: hidden; }

.center-col {
  width: min(560px, 100% - 32px);
  margin: 0 auto;
  padding: clamp(24px, 6vh, 64px) 0 48px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ---------- Accueil / rejoindre ------------------------------ */
.join-mark { font-size: clamp(34px, 7vw, 46px); }
.join-mark .c { color: var(--rose); }
.join-sub { color: var(--ink-soft); font-size: 14.5px; margin: -8px 0 4px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 700; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-soft); }
.field input[type="text"], .field textarea {
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--paper-3); }
.field .hint { font-size: 12px; color: var(--ink-faint); }

.code-input {
  font-family: var(--font-mono) !important;
  font-weight: 700;
  font-size: 26px !important;
  letter-spacing: .5em;
  text-transform: uppercase;
  text-align: center;
}

.team-pick { display: flex; flex-direction: column; gap: 10px; }
.team-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform var(--t-fast) var(--spring), border-color var(--t-fast), box-shadow var(--t-fast);
  min-height: 52px;
  text-align: left;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  width: 100%;
}
.team-row:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-soft); }
.team-row:active { transform: scale(.99); }
.team-row .avatar { font-size: 22px; }
.team-row .t-name { font-weight: 700; }
.team-row .t-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.team-row.is-full { opacity: .45; pointer-events: none; }

.consent {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--paper-2); border: 1.5px dashed var(--line-strong);
  border-radius: 14px; padding: 12px 14px;
  font-size: 13px; color: var(--ink-soft); line-height: 1.45;
  cursor: pointer;
}
.consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--ink); }

.err-line { color: #C4180C; font-size: 13.5px; font-weight: 600; min-height: 20px; }

/* ---------- Créer une partie (V4 §5) -------------------------- */
.or-sep {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-faint);
  font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  margin-top: 4px;
}
.or-sep::before, .or-sep::after { content: ''; flex: 1; border-top: 1.5px dotted var(--line-strong); }

.create-pane {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .mode-cards { grid-template-columns: 1fr; } }
.mode-card {
  display: flex; flex-direction: column; gap: 4px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: var(--font-ui);
  color: var(--ink);
  transition: border-color var(--t-fast), transform var(--t-fast) var(--spring);
}
.mode-card:hover { transform: translateY(-1px); }
.mode-card strong { font-size: 14.5px; }
.mode-card span { font-size: 12px; color: var(--ink-soft); line-height: 1.35; }
.mode-card em { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); }
.mode-card.is-on { border-color: var(--ink); background: var(--paper-3); }

.seg {
  display: inline-flex;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  overflow: hidden;
  width: max-content; max-width: 100%;
}
.seg button {
  font-family: var(--font-ui); font-weight: 600; font-size: 13.5px;
  padding: 8px 16px; min-height: 38px;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-soft);
}
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button.is-on { background: var(--ink); color: var(--paper-2); }
.cp-topic-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }

/* ---------- Lobby hostless ------------------------------------ */
.hostless-tools { display: flex; flex-direction: column; gap: 10px; }
.share-row { display: flex; gap: 8px; }
.share-link {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 10px 14px;
  outline: none;
}
.startzone { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 6px; }
.startzone .pw-btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.startzone .hint { font-size: 12.5px; color: var(--ink-faint); }

/* ---------- Lobby -------------------------------------------- */
.lobby-code { text-align: center; }
.lobby-code .big {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(40px, 9vw, 58px);
  letter-spacing: .35em; text-indent: .35em;
}
.lobby-code .pw-label { display: block; margin-bottom: 4px; }
.mates { display: flex; flex-wrap: wrap; gap: 8px; }
.mate {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--paper-2); border: 1.5px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 14px;
  font-weight: 600; font-size: 13.5px;
}
.mate .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lens-bold); }
.mate.is-off .dot { background: var(--ink-faint); }
.waiting-pulse {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink-soft); font-size: 14px;
}
.waiting-pulse i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose);
  animation: pw-breathe-dot 1.6s ease-in-out infinite;
}
@keyframes pw-breathe-dot { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.5); opacity: 1; } }

/* ---------- Coquille de jeu ---------------------------------- */
.game-shell { flex: 1; display: flex; flex-direction: column; min-height: 0; height: 100%; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--paper) 82%, #fff 0%);
  border-bottom: 1.5px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}
.topbar .team-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--paper-2); border: 1.5px solid var(--line);
}
.team-chip .score { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); }

.phasebar { display: flex; align-items: center; gap: 2px; margin-inline: auto; }
.phasebar .pw-phase { min-width: 58px; padding: 4px 6px 6px; border-radius: 12px; }
.phasebar .pw-phase__coin { width: 28px; height: 28px; }
.phasebar .pw-phase__coin .ic { width: 14px; height: 14px; }
.phasebar .pw-phase__name { font-size: 10.5px; }
.phasebar .pw-phase__time { font-size: 9px; padding: 1px 6px; }
.phasebar .pw-phase + .pw-phase::before { left: -8px; top: 18px; width: 16px; }

.top-timer {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-weight: 700; font-size: 20px;
  font-variant-numeric: tabular-nums;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--paper-2); border: 1.5px solid var(--line);
}
.top-timer .ic { width: 16px; height: 16px; }
.top-timer.is-warn { color: var(--chall-bold); border-color: var(--chall-soft); background: var(--chall-tint); }
.top-timer.is-crit { color: #C4180C; border-color: #F0B3AD; background: var(--chall-tint); animation: pw-beat 1s var(--ease) infinite; }
.top-timer.is-paused { color: var(--ink-faint); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--paper-2); border: 1.5px solid var(--line-strong);
  cursor: pointer; color: var(--ink);
  transition: transform var(--t-fast) var(--spring), background var(--t-fast);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
  content: ''; position: absolute; top: 4px; right: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose);
}

/* ---------- Consensus de phase (V4 §5) ------------------------- */
.consensus-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  padding: 7px 14px; min-height: 38px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast), border-color var(--t-fast);
}
.consensus-btn .ic { width: 15px; height: 15px; }
.consensus-btn:hover { transform: translateY(-1px); }
.consensus-btn:active { transform: scale(.96); }
.consensus-btn:disabled { opacity: .6; cursor: default; transform: none; }
.consensus-btn.is-done { background: var(--lens-tint); border-color: var(--lens-soft); color: var(--lens-deep); opacity: 1; }
.ready-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--paper-3);
  color: var(--ink-soft);
  white-space: nowrap;
}
.ready-chip .ic { width: 13px; height: 13px; }
.ready-chip.is-all { background: var(--lens-tint); color: var(--lens-deep); }

/* ---------- Corps du jeu : rail carte + atelier --------------- */
.game-body { flex: 1; display: flex; min-height: 0; }

.card-rail {
  width: 312px; flex: none;
  padding: 16px 16px 76px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  overflow-y: auto;
  border-right: 1.5px dotted var(--line);
  transition: margin-left var(--t-slow) var(--spring);
}
.game-body.rail-hidden .card-rail { margin-left: -312px; visibility: hidden; }
.rail-toggle {
  position: fixed; left: 12px; bottom: 12px; z-index: 45;
  box-shadow: var(--shadow-soft);
}
/* Format compact : les cartes sont un pense-bête, la consigne vit dans le
   panneau de mission de l'atelier (V5 §5). */
.card-rail .pw-card, .card-rail .pw-flip { --cw: 264px; width: 264px; }
.rail-extra { width: 264px; }

.workspace {
  flex: 1; min-width: 0;
  padding: 18px clamp(14px, 3vw, 34px) 120px;
  overflow-y: auto;
}
.ws-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.ws-head h2 { font-size: 21px; }
.ws-hint { color: var(--ink-soft); font-size: 13.5px; }

/* Bannière permanente : le sujet commun de la manche (V4 §4) */
.topic-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--prompt-tint);
  border: 1.5px solid var(--prompt-soft);
  color: var(--prompt-deep);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
  max-width: 860px;
}
.topic-banner .ic { width: 18px; height: 18px; flex: none; }

/* Onglets de l'atelier : L'équipe / Mes notes (V4 §6) */
.ws-tabs {
  display: inline-flex; gap: 4px;
  background: var(--paper-3);
  border-radius: var(--r-pill);
  padding: 4px;
  margin: 8px 0 2px;
}
.ws-tab {
  font-family: var(--font-ui); font-weight: 700; font-size: 13px;
  border: none; background: transparent;
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  padding: 7px 16px; min-height: 36px;
  cursor: pointer;
}
.ws-tab.is-on { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-soft); }

/* Mot imposé (challenge Constraint) dans l'atelier */
.word-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--chall-tint);
  border: 1.5px dashed var(--chall-soft);
  color: var(--chall-deep);
  font-weight: 700; font-size: 13.5px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  margin: 10px 10px 0 0;
}
.word-badge .ic { width: 15px; height: 15px; }

/* Badge mot imposé sur la carte Challenge elle-même */
.pw-word {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.75);
  border: 2px dashed var(--chall-soft);
  color: var(--chall-deep);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 10px 0 2px;
  font-size: 13px;
}
.pw-word .ic { width: 15px; height: 15px; flex: none; }
.pw-word b { font-size: 15px; }

/* Blocs structurés */
.blocks { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; max-width: 860px; }
.blk {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.blk.is-dragging { box-shadow: var(--shadow-lift); transform: scale(1.01) rotate(.4deg); z-index: 30; position: relative; }
.blk__head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px 0;
}
.blk__grip { cursor: grab; color: var(--ink-faint); touch-action: none; padding: 4px; margin: -4px 0 -4px -4px; }
.blk__grip:active { cursor: grabbing; }
.blk__grip .ic { width: 15px; height: 15px; }
.blk__kind {
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--paper-3); color: var(--ink-soft);
}
.blk__kind.k-human { background: var(--prompt-tint); color: var(--prompt-deep); }
.blk__kind.k-ai { background: var(--gold-tint); color: #7A5410; }
.blk__kind.k-lens { background: var(--lens-tint); color: var(--lens-deep); }
.blk__kind.k-final { background: var(--chall-tint); color: var(--chall-deep); }
.blk__kind.k-meta { background: var(--spec-tint); color: var(--spec-deep); }
.blk__author { font-size: 11px; color: var(--ink-faint); margin-left: auto; }
/* Les plumes de la case (V5.2) : attribution façon doc partagé */
.blk__eds {
  font-size: 11px; color: var(--ink-soft);
  max-width: 36%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 0 1 auto;
}
/* Récap enrichi (V5.2) : leçon de la manche + retours reçus */
.recap-extra { margin-top: 14px; display: grid; gap: 6px; }
.recap-extra .sub { margin: 0; }
.blk__del { color: var(--ink-faint); cursor: pointer; padding: 4px; border-radius: 8px; }
.blk__del:hover { color: #C4180C; background: var(--chall-tint); }
.blk__del .ic { width: 14px; height: 14px; }
.blk textarea {
  display: block; width: 100%;
  border: none; outline: none; resize: none;
  background: transparent;
  font-family: var(--font-ui); font-size: 15px; line-height: 1.5; color: var(--ink);
  padding: 8px 14px 12px;
  min-height: 30px;
}
.blk.is-ai textarea { color: var(--ink-soft); }
.blk__saved { font-size: 10px; color: var(--ink-faint); padding: 0 14px 8px; text-align: right; opacity: 0; transition: opacity var(--t-med); }
.blk__saved.show { opacity: 1; }

.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.add-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-pill);
  padding: 9px 16px;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 40px;
}
.add-btn:hover { color: var(--ink); border-color: var(--ink); background: var(--paper-2); }
.add-btn .ic { width: 15px; height: 15px; }

/* Brouillon : post-its */
.notes-zone { margin-top: 26px; max-width: 860px; }
.notes-zone > .pw-label { display: flex; align-items: center; gap: 10px; }
.notes-zone > .pw-label::after { content: ''; flex: 1; border-top: 2px dotted var(--line); }
.notes { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.note {
  width: 178px; min-height: 120px;
  border-radius: 4px 14px 14px 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-soft);
  position: relative;
  transform: rotate(var(--note-r, -1deg));
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast);
  display: flex; flex-direction: column;
}
/* Le doigt peut faire défiler la page depuis une note : seul le PIED (poignée
   de déplacement) bloque le scroll (V5 §5). */
.note__foot { touch-action: none; cursor: grab; }
.note.is-dragging .note__foot { cursor: grabbing; }
.note:nth-child(even) { --note-r: 1.2deg; }
.note.is-dragging { transform: scale(1.06) rotate(2deg); box-shadow: var(--shadow-lift); z-index: 30; }
.note--jaune { background: #FBF0C4; }
.note--rose { background: #FADDE8; }
.note--menthe { background: #D9F2E1; }
.note--ciel { background: #DCEBFA; }
.note--peche { background: #FCE4CE; }
.note--lavande { background: #E9E1F9; }
.note textarea {
  flex: 1; width: 100%;
  background: transparent; border: none; outline: none; resize: none;
  font-family: var(--font-ui); font-size: 13.5px; line-height: 1.45; color: var(--ink);
}
.note__foot { display: flex; align-items: center; font-size: 10px; color: rgba(38,34,25,.5); }
.note__del { margin-left: auto; cursor: pointer; padding: 3px; color: rgba(38,34,25,.45); }
.note__del:hover { color: #C4180C; }
.note__del .ic { width: 13px; height: 13px; }
.note-colors { display: inline-flex; gap: 6px; margin-left: 8px; }
.note-colors i {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 1.5px solid rgba(38,34,25,.15);
  transition: transform var(--t-fast) var(--spring);
}
.note-add { margin-top: 10px; }
.note-colors i:hover { transform: scale(1.15); }

/* « Verser à l'équipe » sur une note perso (V4 §6) */
.note__share {
  align-self: flex-start;
  font-family: var(--font-ui); font-weight: 700; font-size: 11px;
  color: var(--ink-soft);
  border: 1.5px solid rgba(38,34,25,.22);
  background: rgba(255,255,255,.55);
  border-radius: var(--r-pill);
  padding: 4px 10px; min-height: 26px;
  cursor: pointer;
  margin-top: 6px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.note__share:hover { color: var(--ink); border-color: var(--ink); }

/* Pastille d'auteur : une couleur stable par joueur (V4 §6) */
.author-dot {
  width: 10px; height: 10px; flex: none;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid rgba(255,255,255,.7);
  box-shadow: 0 0 0 1px rgba(38,34,25,.15);
}
.note__foot .author-dot { margin-right: 6px; }
.blk__head .author-dot { margin-left: 2px; }

/* Présence d'écriture : « Léa écrit... » (doc:typing, V4 §6) */
.blk.is-typing, .note.is-typing { box-shadow: 0 0 0 2.5px var(--typing-c, var(--rose)); }
.blk .typing-tag { display: block; font-size: 11px; font-weight: 700; padding: 0 14px 8px; }
.note .typing-tag { display: block; font-size: 10.5px; font-weight: 700; padding-top: 4px; }

/* ---------- Feuilles (présentation, vote, récap...) ----------- */
.veil {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(38, 34, 25, .38);
  display: none;
  align-items: flex-end; justify-content: center;
  animation: veil-in .3s var(--ease) both;
}
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
.veil.is-on { display: flex; }
.sheet {
  width: min(760px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: 22px 22px 0 0;
  padding: 22px clamp(16px, 4vw, 34px) 34px;
  box-shadow: 0 -18px 60px rgba(38,34,25,.3);
  animation: sheet-up .45s var(--spring) both;
}
@keyframes sheet-up { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet__grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 16px; }
.sheet h2 { font-size: 24px; margin-bottom: 4px; }
.sheet .sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 16px; }

/* Barre d'outils de la feuille : Réduire + X, TOUJOURS visibles (V5 §5) */
.sheet__bar {
  display: flex; justify-content: flex-end; gap: 8px; margin: -6px 0 8px;
  position: sticky; top: -22px; z-index: 6;
  background: linear-gradient(var(--paper) 78%, transparent);
  padding: 6px 0;
}
.sheet__tool {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-weight: 600; font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--paper-3);
  border: none;
  border-radius: var(--r-pill);
  padding: 7px 12px; min-height: 34px;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.sheet__tool:hover { color: var(--ink); background: var(--paper-2); }
.sheet__tool .ic { width: 14px; height: 14px; }
.sheet__x { padding: 7px 9px; }

/* Pastille flottante d'une feuille réduite */
.sheet-pill {
  position: fixed; right: 14px; bottom: 14px; z-index: 66;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-weight: 700; font-size: 13.5px;
  background: var(--ink); color: var(--paper-2);
  border: none;
  border-radius: var(--r-pill);
  padding: 12px 18px; min-height: 44px;
  box-shadow: var(--shadow-lift);
  cursor: pointer;
}
.sheet-pill .ic { width: 16px; height: 16px; }
.sheet-pill.pulse { animation: pill-pulse .6s var(--spring); }
@keyframes pill-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* Vote : galerie + notation en étoiles (V4 §§1-2) */
.vote-progress { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); margin-bottom: 10px; }
.gal-entry {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.gal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.gal-head .avatar { font-size: 22px; }
.gal-head strong { font-family: var(--font-display); font-size: 17px; }
.gal-block {
  background: var(--paper);
  border: 1.5px dotted var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
}
.gal-block p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; color: var(--ink-soft); max-height: 180px; overflow-y: auto; }
.gal-empty { color: var(--ink-faint); font-size: 13px; font-style: italic; }
.stars-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0 2px; }
.stars-label { display: inline-flex; flex-direction: column; gap: 1px; font-weight: 700; font-size: 12.5px; width: 168px; color: var(--ink-soft); }
.stars-label small { font-weight: 500; font-size: 10.5px; color: var(--ink-faint); }
.stars-label .ic { width: 15px; height: 15px; color: var(--gold); }
.stars { display: inline-flex; gap: 2px; }
.star {
  background: transparent; border: none; cursor: pointer;
  padding: 6px;
  color: var(--line-strong);
  display: inline-grid; place-items: center;
  min-width: 40px; min-height: 40px; /* cible tactile confortable (V5 §5) */
  transition: transform var(--t-fast) var(--spring), color var(--t-fast);
}
.star .ic { width: 27px; height: 27px; }
.star:hover { transform: scale(1.18) rotate(-6deg); }
.star:active { transform: scale(.9); }
.star.is-on { color: var(--gold); }
.stars-avg { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); margin-left: 4px; min-width: 72px; }

/* Présentation */
.present-stage { text-align: center; padding: 8px 0 4px; }
.present-stage .who { font-size: 30px; font-family: var(--font-display); font-weight: 800; }
.present-stage .avatar { font-size: 40px; display: block; margin-bottom: 6px; }
.fb-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.fb-form textarea { min-height: 64px; }

/* Vitrine de l'équipe qui présente (present:showcase, V4 §1) */
.show-box { margin-top: 10px; }
.show-topic {
  display: flex; align-items: center; gap: 8px;
  background: var(--prompt-tint);
  border: 1.5px solid var(--prompt-soft);
  color: var(--prompt-deep);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13.5px;
  margin-bottom: 8px;
}
.show-topic .ic { width: 16px; height: 16px; flex: none; }

/* Vrai ou faux (Fact or Fiction, V4 §3) */
.guess-box {
  background: var(--paper-2);
  border: 1.5px solid var(--chall-soft);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 16px;
  max-width: 860px;
  display: flex; flex-direction: column; gap: 10px;
}
.guess-box h3 { font-size: 17px; color: var(--chall-deep); }
.guess-box .sub { margin-bottom: 0; }
.guess-opt {
  display: flex; align-items: center; gap: 10px;
  text-align: left;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px; min-height: 50px;
  font-family: var(--font-ui); font-size: 14.5px; color: var(--ink);
  cursor: pointer; width: 100%;
  transition: border-color var(--t-fast), transform var(--t-fast) var(--spring);
}
.guess-opt:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.guess-opt.is-mine { border-color: var(--chall-bold); background: var(--chall-tint); }
.guess-n {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  background: var(--paper-3);
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
}
.guess-ok { font-size: 12.5px; font-weight: 700; color: var(--lens-deep); }

/* Comparaison v1 / v2 en phase Analyze (V4 §6) */
.compare {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 14px;
  max-width: 1100px;
  align-items: stretch;
}
.compare__col {
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 0;
}
.compare__txt {
  font-size: 14px; line-height: 1.5;
  color: var(--ink-soft);
  white-space: pre-wrap;
  max-height: 260px; overflow-y: auto;
  margin-top: 8px;
}
.compare__lens {
  width: 210px;
  display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center;
  text-align: center;
  background: var(--lens-tint);
  border: 1.5px solid var(--lens-soft);
  color: var(--lens-deep);
  border-radius: 16px;
  padding: 14px 12px;
  font-size: 13.5px; font-weight: 600;
}
.compare__lens .ic { width: 20px; height: 20px; }
.compare__lens p { margin: 0; }
@media (max-width: 900px) {
  .compare { grid-template-columns: 1fr; }
  .compare__lens { width: 100%; }
}
.annot-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 1100px; }
.annot {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--gold-tint);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
}
.annot mark { background: transparent; color: inherit; }
.annot .blk__del { margin-left: auto; }
.annot .author-dot { margin-top: 4px; }

/* Ligne ouverte (Collab, V4 §3) */
.blk__collab {
  font-size: 12px; font-weight: 600;
  color: var(--spec-deep);
  background: var(--spec-tint);
  margin: 6px 14px 0;
  padding: 5px 10px;
  border-radius: 8px;
  display: inline-block;
}
.collab-ta {
  display: block; width: 100%;
  min-height: 110px;
  font-family: var(--font-ui); font-size: 15px; line-height: 1.5; color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  background: var(--paper-2);
  resize: vertical;
  margin-bottom: 14px;
}
.collab-ta:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--paper-3); }

/* Récap / podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 26px 0 10px; }
.podium .step {
  width: 120px; text-align: center;
  background: var(--paper-2); border: 1.5px solid var(--line);
  border-radius: 16px 16px 0 0; padding: 14px 8px 10px;
}
.podium .step .avatar { font-size: 30px; }
.podium .step .nm { font-weight: 700; font-size: 14px; }
.podium .step .sc { font-family: var(--font-mono); font-size: 13px; color: var(--ink-soft); }
.podium .p1 { border-top: 4px solid var(--gold); padding-bottom: 42px; }
.podium .p2 { border-top: 4px solid #ABA593; padding-bottom: 22px; }
.podium .p3 { border-top: 4px solid #C89B7B; padding-bottom: 12px; }

.score-line { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1.5px dotted var(--line); font-size: 15px; }
.score-line .sc { margin-left: auto; font-family: var(--font-mono); font-weight: 700; }

/* ---------- Toasts / bannières -------------------------------- */
.toasts {
  /* En bas au centre : la topbar (variable en hauteur) n'est plus masquée (V5 §5) */
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column-reverse; gap: 8px;
  width: min(560px, calc(100% - 24px));
  pointer-events: none;
}
.toasts .pw-banner { box-shadow: var(--shadow-lift); animation: toast-in .5s var(--spring) both; pointer-events: auto; }
@keyframes toast-in { from { transform: translateY(-16px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.toasts .pw-banner.bye { transition: opacity .4s, transform .4s; opacity: 0; transform: translateY(-10px); }

/* ---------- Chat --------------------------------------------- */
.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(360px, 92vw);
  background: var(--paper);
  border-left: 1.5px solid var(--line);
  box-shadow: -18px 0 50px rgba(38,34,25,.18);
  display: flex; flex-direction: column;
  transform: translateX(105%);
  transition: transform var(--t-slow) var(--spring);
}
.chat-drawer.is-on { transform: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1.5px dotted var(--line); }
.chat-list { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.chat-msg { max-width: 85%; background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 12px; font-size: 13.5px; }
.chat-msg .who { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); display: block; }
.chat-msg.mine { align-self: flex-end; background: var(--prompt-tint); border-color: var(--prompt-soft); border-radius: 14px 4px 14px 14px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1.5px dotted var(--line); }
.chat-form input {
  flex: 1; font-family: var(--font-ui); font-size: 16px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-pill);
  padding: 9px 14px; outline: none; background: var(--paper-2);
}

/* ---------- Cérémonie de tirage -------------------------------- */
/* Voile OPAQUE (V5.1 §1) : la carte déjà rendue derrière (rail, mission)
   gâchait l'effet de surprise du retournement. */
.draw-stage {
  position: fixed; inset: 0; z-index: 65;
  background: color-mix(in srgb, var(--paper) 96%, #2A2619 4%);
  display: none; flex-direction: column;
  align-items: center; justify-content: safe center; gap: 16px;
  padding: 24px 20px;
  overflow-y: auto;
}
.draw-stage.is-on { display: flex; animation: veil-in .35s var(--ease) both; }
/* Bornée aussi par la hauteur : pastille et bouton restent visibles */
.draw-stage .pw-flip, .draw-stage .pw-card { --cw: min(320px, 78vw, 44dvh); }
.draw-stage .pw-flip { width: var(--cw); }
.draw-pill {
  background: var(--paper-2); border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 18px; box-shadow: var(--shadow-soft);
  flex: none; max-width: min(92vw, 720px); text-align: center;
}
/* Sur voile clair désormais : texte encre, lisible (V5.1 §1) */
.draw-hint { color: var(--ink-soft); font-size: 13.5px; flex: none; }

/* ---------- Splash de phase ------------------------------------ */
.phase-splash {
  position: fixed; inset: 0; z-index: 85;
  display: grid; place-items: center;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}
.phase-splash.is-on { visibility: visible; }
.phase-splash__wash {
  position: absolute; inset: -20%;
  background: linear-gradient(100deg, var(--fam-bold, var(--ink)) 0 30%, var(--fam-tint, var(--paper-3)) 30.5% 100%);
  opacity: .96;
  transform: translateX(-118%) skewX(-10deg);
}
.phase-splash.is-on .phase-splash__wash { animation: pw-wash 1.35s cubic-bezier(.6, 0, .3, 1) both; }
@keyframes pw-wash {
  0%   { transform: translateX(-118%) skewX(-10deg); }
  34%  { transform: translateX(0) skewX(-10deg); }
  64%  { transform: translateX(0) skewX(-10deg); }
  100% { transform: translateX(118%) skewX(-10deg); }
}
.phase-splash__txt { position: relative; text-align: center; }
.phase-splash__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(46px, 9vw, 80px);
  letter-spacing: -.02em;
  color: var(--fam-deep, var(--ink));
  opacity: 0;
}
.phase-splash__sub {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--fam-deep, var(--ink));
  opacity: 0;
}
.phase-splash.is-on .phase-splash__name { animation: pw-splash-txt 1.35s var(--ease) both; }
.phase-splash.is-on .phase-splash__sub { animation: pw-splash-txt 1.35s var(--ease) .08s both; }
@keyframes pw-splash-txt {
  0%   { opacity: 0; transform: translateY(26px) scale(.94); }
  30%  { opacity: 1; transform: translateY(0) scale(1); }
  68%  { opacity: 1; transform: translateY(0) scale(1.015); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.02); }
}

/* ---------- Podium théâtral -------------------------------------- */
#scr-end .podium .step { animation: pw-podium-in .65s var(--spring) both; }
#scr-end .podium .p3 { animation-delay: .25s; }
#scr-end .podium .p2 { animation-delay: .65s; }
#scr-end .podium .p1 { animation-delay: 1.1s; }
@keyframes pw-podium-in {
  from { opacity: 0; transform: translateY(46px) scale(.9); }
  to   { opacity: 1; transform: none; }
}
#scr-end .end-crown { animation: pw-crown .8s var(--spring) 1.55s both; }
@keyframes pw-crown {
  from { opacity: 0; transform: translateY(-46px) rotate(-14deg) scale(.6); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .phase-splash { display: none !important; }
  #scr-end .podium .step, #scr-end .end-crown { animation: none !important; }
}

/* ---------- Réflexion & fin ------------------------------------ */
.mood-row { display: flex; gap: 10px; justify-content: center; }
.mood {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 26px;
  background: var(--paper-2); border: 2px solid var(--line);
  cursor: pointer;
  transition: transform var(--t-fast) var(--spring), border-color var(--t-fast);
}
.mood:hover { transform: scale(1.1) rotate(-4deg); }
.mood.is-on { border-color: var(--ink); background: var(--gold-tint); transform: scale(1.12); }

.end-title { text-align: center; font-size: clamp(26px, 6vw, 40px); }
.end-crown { text-align: center; font-size: 46px; }

/* ---------- Responsive / tactile -------------------------------- */
@media (max-width: 900px) {
  .game-body { flex-direction: column; }
  .card-rail {
    width: 100%; flex-direction: row; align-items: flex-start;
    overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1.5px dotted var(--line);
    padding: 12px;
  }
  .game-body.rail-hidden .card-rail { display: none; }
  .card-rail .pw-card, .card-rail .pw-flip { --cw: 240px; width: 240px; }
  .phasebar { order: 3; width: 100%; justify-content: center; }
  .workspace { padding-bottom: 160px; }
  .consensus-btn { font-size: 12px; padding: 6px 11px; }
  .stars-label { width: 100%; }
  .sheet-pill { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .scr.is-on, .sheet, .toasts .pw-banner { animation: none !important; }
}

/* ================================================================
   V5 : panneau de mission, pouls des équipes, cases numérotées,
   chrono indicatif / absent (docs/V5.md)
   ================================================================ */

/* Le panneau de mission : LA consigne de la phase, en étapes */
.mission {
  --fam-bold: var(--prompt-bold); --fam-tint: var(--prompt-tint);
  --fam-soft: var(--prompt-soft); --fam-deep: var(--prompt-deep);
  background: var(--paper-2);
  border: 1.5px solid var(--fam-soft);
  border-left: 5px solid var(--fam-bold);
  border-radius: 16px;
  padding: 14px 18px 12px;
  margin: 0 0 16px;
  max-width: 860px;
}
.mission__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mission__head .ic { width: 20px; height: 20px; color: var(--fam-bold); flex: none; }
.mission__head h2 { font-size: 18.5px; color: var(--fam-deep); }
.mission__steps { margin: 0; padding: 0 0 0 4px; list-style: none; counter-reset: mstep; }
.mission__steps li {
  counter-increment: mstep;
  position: relative;
  padding: 5px 0 5px 34px;
  font-size: 14px; line-height: 1.5; color: var(--ink-soft);
}
.mission__steps li::before {
  content: counter(mstep);
  position: absolute; left: 0; top: 5px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--fam-tint); color: var(--fam-deep);
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
}
.mission__ask { color: var(--ink); font-weight: 700; }
.mission__ask .pw-ph { background: var(--fam-tint); color: var(--fam-deep); border-radius: 4px; padding: 0 4px; font-style: normal; }
.mission__row { display: inline-flex; gap: 8px; vertical-align: middle; margin-left: 2px; }
.mission__row .pw-btn { min-height: 32px; padding: 4px 12px; font-size: 12px; }

/* Le pouls des autres équipes : chips discrètes sous le sujet */
.pulse-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: -4px 0 12px;
  max-width: 860px;
}
.pulse-strip .pw-label { margin: 0; }
.pulse-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 10px;
}
.pulse-chip b { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.pulse-chip.is-ready { background: var(--lens-tint); border-color: var(--lens-soft); color: var(--lens-deep); }
.pulse-chip.is-ready b, .pulse-chip .ok { color: var(--lens-deep); font-style: normal; }

/* Numéro d'étape des cases essentielles */
.blk__step {
  width: 22px; height: 22px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-weight: 700; font-size: 11.5px;
}

/* Chrono indicatif dépassé (+m:ss) et mode sans chrono */
.top-timer.is-over { color: var(--lens-deep); border-color: var(--lens-soft); background: var(--lens-tint); }
.top-timer.is-off { font-size: 12.5px; font-family: var(--font-ui); font-weight: 600; color: var(--ink-faint); }

/* Présentations : ordre de passage et contexte de lecture */
.present-order {
  display: inline-block;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700;
  color: var(--ink-faint);
  background: var(--paper-3);
  border-radius: var(--r-pill);
  padding: 3px 10px; margin-top: 4px;
}
.present-ctx { font-size: 12.5px; color: var(--ink-faint); margin-top: 6px; }

/* L'amorce de la Lens au centre de la comparaison */
.compare__hook { font-weight: 700; color: var(--lens-deep); margin-bottom: 6px; }

/* La barre de phases peut défiler plutôt que pousser la topbar (V5 §5) */
.phasebar { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.phasebar::-webkit-scrollbar { display: none; }

/* ================================================================
   V5.1 : la zone « Les réponses de vos IA » (un bloc par joueur,
   l'équipe en retient une) : docs/V5.md §V5.1
   ================================================================ */
.ai-zone {
  max-width: 860px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  padding: 12px 14px 14px;
  margin: 4px 0 14px;
  background: color-mix(in srgb, var(--paper-2) 55%, transparent);
}
.ai-zone__head { display: flex; align-items: center; gap: 10px; }
.ai-zone__title { font-family: var(--font-display); font-size: 16px; }
.ai-zone__count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.ai-zone__hint { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 10px; line-height: 1.45; }
.ai-zone__list { display: flex; flex-direction: column; gap: 10px; }
.ai-zone__add { margin-top: 10px; }
.ai-resp { margin: 0; }
.ai-resp.is-chosen { border-color: var(--prompt-bold); box-shadow: 0 0 0 2px var(--prompt-soft); }
.ai-resp textarea[readonly] { color: var(--ink-soft); cursor: default; }
.resp-star {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-ui); font-weight: 700; font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 5px 11px; min-height: 30px;
  cursor: pointer;
  margin-left: auto;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.resp-star .ic { width: 13px; height: 13px; }
.resp-star:hover { color: var(--ink); border-color: var(--ink); }
.resp-star.is-on { background: var(--prompt-tint); border-color: var(--prompt-soft); color: var(--prompt-deep); }

/* Pendant la cérémonie (voile opaque), la pastille de feuille (z66 > z65)
   flottait au-dessus : on la masque le temps du tirage (V5.1 §1). */
#draw-stage.is-on ~ .sheet-pill { visibility: hidden; }
