/* ============================================
   Qui a dit ça ? — Editorial Punchy
   Magazine chic + neo-brutalism énergique
   ============================================ */

:root {
  --bg: #f2ece0;
  --ink: #1a1028;
  --primary: #5a2db0;
  --primary-soft: #ede1f7;
  --accent: #ffb800;
  --accent-deep: #e5a200;
  --green: #3d8858;
  --green-soft: #e8f4ec;
  --red: #d63854;
  --card: #fff;
  --muted: #9b8ea8;
  --soft-border: #e8dfd4;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); }

#g {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  height: 100vh; height: 100dvh;
  color: var(--ink);
  position: relative;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* Finkielkraut en fond */
#fink-bg {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none; opacity: 0;
  transition: opacity .5s;
  background-size: cover; background-position: center top; background-repeat: no-repeat;
}
#fink-bg.on { opacity: .08; }

/* ============================================
   Screens — slide in from right with bounce
   ============================================ */
.sc {
  display: none; flex-direction: column; flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  padding-bottom: env(safe-area-inset-bottom, 24px);
  position: relative; z-index: 1;
}
.sc.on {
  display: flex;
  animation: slideIn .4s cubic-bezier(.2, 1.2, .3, 1) both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

/* Cartes/badges qui montent avec un léger stagger quand l'écran s'ouvre */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.sc.on .card,
.sc.on .catbadge,
.sc.on .row-progress,
.sc.on .rauthor-wrap,
.sc.on .reveal-grid,
.sc.on .winner-block {
  animation: fade-up .35s cubic-bezier(.2, 1.1, .3, 1) both;
}
.sc.on .row-progress { animation-delay: 0ms; }
.sc.on .catbadge      { animation-delay: 60ms; }
.sc.on .card          { animation-delay: 120ms; }
.sc.on .rauthor-wrap  { animation-delay: 80ms; }
.sc.on .winner-block  { animation-delay: 100ms; }
.sc.on .reveal-grid   { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) {
  .sc.on .card, .sc.on .catbadge, .sc.on .row-progress,
  .sc.on .rauthor-wrap, .sc.on .reveal-grid, .sc.on .winner-block {
    animation: none;
  }
}
.sc > .btn-zone {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  padding-top: 12px;
  flex-shrink: 0;
}

/* Bouton sticky pour les écrans où l'on tape (clavier mobile remonte le viewport).
   Le fond reproduit la couleur du body pour cacher ce qui scrolle dessous. */
#s-answer > .btn-zone,
#s-propose > .btn-zone,
#s-create > .btn-zone,
#s-join > .btn-zone {
  position: sticky;
  bottom: 0;
  background: var(--bg, #f2ece0);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  z-index: 5;
}
body.balance-mode #s-answer > .btn-zone,
body.balance-mode #s-propose > .btn-zone {
  background: #fff4ed;
}

.flex1 { flex: 1; }
.center { text-align: center; }

/* ============================================
   Typography
   ============================================ */
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 30px; font-weight: 700;
  color: var(--primary);
  letter-spacing: -.5px; line-height: 1.1;
}
.logo.sm { font-size: 22px; }
.logo em { font-style: italic; font-weight: 400; color: var(--accent); }

.sub {
  font-size: 11px; color: var(--muted);
  margin-top: 6px; letter-spacing: 1.5px;
  text-transform: uppercase; font-weight: 600;
}

.lbl {
  font-size: 11px; color: var(--muted);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 8px; margin-top: 16px; font-weight: 600;
}
.lbl.first { margin-top: 0; }

.mute { color: var(--muted); font-size: 13px; }

.catbadge {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px; color: var(--primary);
  letter-spacing: 2px; text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 4px 10px;
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
  border-radius: 20px;
}

/* Question number (giga Playfair) */
.qnum {
  font-family: 'Playfair Display', serif;
  font-size: 64px; font-weight: 700; font-style: italic;
  color: var(--primary); line-height: .9;
  letter-spacing: -2px;
}
.qnum-total {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 1px;
  margin-left: 4px;
}

/* Question text */
.qtext {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  font-style: normal;
  color: var(--ink); line-height: 1.4;
}

/* ============================================
   Buttons — solid shadow + press translate
   ============================================ */
.gbtn {
  background: var(--primary); color: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 16px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 700;
  letter-spacing: .3px;
  width: 100%; cursor: pointer;
  flex-shrink: 0; display: block;
  box-shadow: var(--shadow);
  transition: transform .08s ease-out, box-shadow .08s ease-out;
  position: relative;
}
.gbtn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink);
}
.gbtn:disabled {
  opacity: .4; cursor: default;
  box-shadow: var(--shadow-sm);
}

/* Reveal button states */
.gbtn.reveal-idle {
  background: var(--card); color: var(--primary);
  border: 2px solid var(--ink);
}
.gbtn.reveal-ready {
  background: var(--primary); color: #fff;
  animation: pulse-btn 1.4s infinite;
}
@keyframes pulse-btn {
  0%, 100% { box-shadow: var(--shadow); transform: translate(0,0); }
  50%      { box-shadow: var(--shadow-lg); transform: translate(-1px,-1px); }
}

/* Secondary button */
.xbtn {
  background: var(--card); color: var(--primary);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 14px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  width: 100%; cursor: pointer;
  margin-top: 10px; flex-shrink: 0;
  display: block;
  box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.xbtn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* Back button — subtle */
.back-btn {
  background: none; border: none;
  color: var(--muted); font-size: 13px;
  cursor: pointer; text-align: left;
  margin-bottom: 16px; padding: 4px 0;
  font-family: 'DM Sans', sans-serif; font-weight: 500;
  transition: color .2s;
}
.back-btn:active { color: var(--primary); }

/* Share pill */
.share-pill {
  margin-top: 12px;
  background: var(--card);
  border: 2px solid var(--ink);
  color: var(--primary);
  border-radius: 24px;
  padding: 8px 20px;
  font-size: 13px;
  font-family: inherit; font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.share-pill:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }

/* ============================================
   Inputs
   ============================================ */
.inp {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px; color: var(--ink);
  width: 100%; outline: none;
  transition: box-shadow .1s;
  box-shadow: var(--shadow-sm);
}
.inp:focus { box-shadow: var(--shadow); }
.inp::placeholder { color: var(--muted); }
.inp.code-inp {
  text-transform: uppercase; letter-spacing: 8px;
  font-size: 24px; text-align: center; font-weight: 800;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-style: normal;
}

/* ============================================
   Code display (lobby)
   ============================================ */
.code-block {
  text-align: center; margin-bottom: 20px;
  padding: 20px 10px;
  border: 2px dashed var(--ink);
  border-radius: 14px;
  background: var(--primary-soft);
}
.code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 56px; font-weight: 800; font-style: normal;
  color: var(--primary);
  letter-spacing: 8px; text-align: center;
  line-height: 1;
}

/* ============================================
   Chips / avatars / players
   ============================================ */
.chip {
  display: inline-flex; align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 24px;
  padding: 4px 14px 4px 4px;
  font-size: 13px; color: var(--ink);
  margin: 4px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.chip.me { background: var(--primary); color: #fff; }
.chip.me .ava { background: #fff; color: var(--primary); }

.ava {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  border: 1.5px solid var(--ink);
}
.ava.sm { width: 20px; height: 20px; font-size: 9px; border-width: 1px; }
.ava.lg { width: 40px; height: 40px; font-size: 14px; border-width: 2px; }

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: var(--shadow-sm); }
.card.soft { border-color: var(--soft-border); box-shadow: none; }

/* Reconnect card — special */
.reconnect-card {
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow);
}
.reconnect-card .inner-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: .85;
  margin-bottom: 8px;
  font-weight: 600;
}
.reconnect-card .inner-code {
  font-family: 'Playfair Display', serif;
  font-weight: 700; font-style: italic;
  font-size: 20px; letter-spacing: 4px;
  color: var(--accent);
}
.reconnect-card .gbtn {
  background: var(--accent); color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  margin-top: 4px;
}
.reconnect-card .xbtn {
  background: transparent; color: #fff;
  border-color: #fff;
  box-shadow: 2px 2px 0 rgba(255,255,255,.5);
}

/* ============================================
   Category picker (create)
   ============================================ */
.catbtn {
  display: inline-flex; align-items: center;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 12px; margin: 3px;
  cursor: pointer; font-size: 13px;
  color: var(--ink); font-family: inherit; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, background .15s, color .15s;
}
.catbtn.on { background: var(--primary); color: #fff; }
.catbtn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }

/* nbQ chips */
.vchip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 24px;
  padding: 8px 18px; margin: 3px;
  cursor: pointer; font-size: 14px;
  color: var(--ink); font-family: inherit; font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, background .15s, color .15s;
}
.vchip.on { background: var(--primary); color: #fff; }
.vchip:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }

/* Toggle card (propose mode) */
.toggle-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.toggle-card input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: var(--primary); cursor: pointer;
  flex-shrink: 0;
}
.toggle-card-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.toggle-card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ============================================
   Vote options
   ============================================ */
.vbig {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 18px; margin-bottom: 10px;
  cursor: pointer; font-size: 16px; font-weight: 600;
  color: var(--ink);
  width: 100%; text-align: left; font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, background .15s, color .15s;
}
.vbig:active { transform: translate(2px,2px); box-shadow: 0 0 0 var(--ink); }
.vbig.on { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.vbig.on .vava { background: #fff; color: var(--primary); }
.vbig .vava {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--ink);
}

/* Vote answer card emphasis */
.vote-answer-card {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.vote-answer-card .vansidx {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px; color: var(--primary);
  font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 8px;
}
.vote-answer-card .vanstext {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  color: var(--ink); line-height: 1.3;
  margin-bottom: 10px;
  font-style: italic;
}
.vote-answer-card .vqref {
  font-size: 12px; color: var(--muted);
  font-style: italic;
}

/* My answer notice */
.my-answer-notice {
  background: var(--accent);
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 600;
}

.vcntlbl { font-size: 12px; color: var(--muted); margin-top: 8px; font-weight: 500; }
.vote-registered { color: var(--green); font-weight: 700; font-size: 13px; }

/* ============================================
   Progress bar — thick, striped, animated
   ============================================ */
.pbar {
  height: 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 8px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.pfill {
  height: 100%;
  background:
    repeating-linear-gradient(
      -45deg,
      var(--accent),
      var(--accent) 7px,
      var(--accent-deep) 7px,
      var(--accent-deep) 14px
    );
  background-size: 20px 20px;
  transition: width .5s cubic-bezier(.2, 1.1, .3, 1);
  animation: stripes 1.2s linear infinite;
}
@keyframes stripes {
  from { background-position: 0 0; }
  to   { background-position: 20px 0; }
}

.ctr-num {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-style: italic; font-weight: 700;
  color: var(--ink);
}

/* Timer pill */
.timer-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 48px;
  padding: 6px 12px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 24px;
  font-family: 'Playfair Display', serif;
  font-size: 15px; font-style: italic; font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
}
.timer-pill.urgent {
  background: var(--red);
  color: #fff;
  animation: timer-urgent .5s ease-in-out infinite alternate;
}
@keyframes timer-urgent {
  from { transform: scale(1); box-shadow: var(--shadow-sm); }
  to   { transform: scale(1.08); box-shadow: var(--shadow); }
}

/* ============================================
   Reveal author — typewriter
   ============================================ */
.rauthor-wrap {
  text-align: center;
  margin: 14px 0 18px;
  padding: 20px 10px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.rauthor-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 10px; font-weight: 700;
}
.rauthor {
  font-family: 'Playfair Display', serif;
  font-size: 44px; font-weight: 700;
  font-style: italic;
  color: var(--primary);
  line-height: 1;
  min-height: 48px;
  letter-spacing: -1px;
}
.rauthor.typing::after {
  content: '|';
  animation: blink .7s step-end infinite;
  color: var(--accent);
  margin-left: 4px;
  font-weight: 400;
}
@keyframes blink {
  from, to { opacity: 0; }
  50% { opacity: 1; }
}

/* GG banner */
.gg-banner {
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  animation: bounce-in .5s cubic-bezier(.2, 1.4, .3, 1);
}
.gg-banner .gg-emoji { font-size: 30px; margin-bottom: 4px; display: block; }
.gg-banner .gg-text { font-size: 16px; font-weight: 700; }

@keyframes bounce-in {
  0%   { opacity: 0; transform: scale(.7); }
  60%  { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}

/* Reveal dual cards (found + ranking) */
.reveal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.reveal-col-title {
  font-size: 11px; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 10px; font-weight: 700;
}

/* ============================================
   Scores — winner block + list
   ============================================ */
.winner-block {
  text-align: center;
  padding: 26px 16px 22px;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-lg);
  animation: bounce-in .6s cubic-bezier(.2, 1.4, .3, 1);
  position: relative;
  overflow: hidden;
}
.winner-label {
  font-size: 11px; letter-spacing: 2.5px;
  text-transform: uppercase; font-weight: 700;
  opacity: .85; margin-bottom: 10px;
}
.winner-crown { font-size: 34px; margin-bottom: 6px; }
.winner-name {
  font-family: 'Playfair Display', serif;
  font-size: 56px; font-weight: 700; font-style: italic;
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -1px;
}
.winner-score {
  display: inline-block;
  font-size: 14px; font-weight: 700;
  padding: 4px 14px;
  background: var(--accent);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 2px 2px 0 var(--ink);
}

.srow {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.srow > div:first-child { min-width: 0; flex: 1; }
.srow.me { background: var(--primary-soft); }
.snum {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700; font-style: italic;
  color: var(--primary);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================
   Scores finaux — palette par rang (moins de violet)
   ============================================ */
#s-scores .srow { background: #fff; }
#s-scores .srow .ava { background: var(--ink); color: #fff; }
#s-scores .srow .snum { color: var(--ink); }

/* 1er — gold */
#s-scores .srow.rank-1 {
  background: linear-gradient(135deg, #fff8d6 0%, #ffe27a 100%);
  border-color: #d9a300;
  box-shadow: 3px 3px 0 #d9a300;
}
#s-scores .srow.rank-1 .ava { background: #d9a300; border-color: #7a5500; }
#s-scores .srow.rank-1 .snum { color: #7a5500; }

/* 2e — silver */
#s-scores .srow.rank-2 {
  background: linear-gradient(135deg, #f4f4f8 0%, #d8dde6 100%);
  border-color: #8b94a3;
  box-shadow: 3px 3px 0 #8b94a3;
}
#s-scores .srow.rank-2 .ava { background: #8b94a3; border-color: #4a5161; }
#s-scores .srow.rank-2 .snum { color: #4a5161; }

/* 3e — bronze */
#s-scores .srow.rank-3 {
  background: linear-gradient(135deg, #fbe8d6 0%, #e8b07a 100%);
  border-color: #a86a3a;
  box-shadow: 3px 3px 0 #a86a3a;
}
#s-scores .srow.rank-3 .ava { background: #a86a3a; border-color: #5e3a1f; }
#s-scores .srow.rank-3 .snum { color: #5e3a1f; }

/* Au-delà du podium — neutre */
#s-scores .srow.rank-other {
  background: #fff;
  border-color: var(--ink);
}

/* "Moi" — effet pressé/enfoncé : on remplace l'ombre portée par une
   ombre interne, et on assombrit la bordure par rapport au fond. */
#s-scores .srow.me {
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, .1);
  border-color: #2a1d3a; /* défaut : un poil plus foncé que blanc */
}
#s-scores .srow.me.rank-1 { border-color: #b88a00; }    /* gold foncé */
#s-scores .srow.me.rank-2 { border-color: #6f7785; }    /* silver foncé */
#s-scores .srow.me.rank-3 { border-color: #8b552c; }    /* bronze foncé */
#s-scores .srow.me.rank-other { border-color: #d8d0c4; } /* sable */

/* Live scores (reveal compact) */
.live-score-row {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 6px; font-size: 13px;
  padding: 4px 0;
}
.live-score-row .name { color: var(--ink); font-weight: 500; }
.live-score-row .name.me { color: var(--primary); font-weight: 700; }
.live-score-row .pts { color: var(--primary); font-weight: 700; font-family: 'Playfair Display', serif; font-style: italic; font-size: 16px; }

/* Vote details row */
.vd-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
  font-size: 13px;
}
.vd-arrow { color: var(--muted); font-size: 12px; }
.vd-correct { color: var(--green); font-weight: 700; margin-left: auto; }

/* Correct voter chip */
.correct-chip {
  display: inline-flex; align-items: center;
  gap: 5px;
  background: var(--green-soft);
  border: 1.5px solid var(--green);
  color: var(--green);
  border-radius: 18px;
  padding: 3px 10px 3px 3px;
  margin: 3px;
  font-size: 12px; font-weight: 700;
}
.correct-chip .ava { background: var(--green); color: #fff; width: 20px; height: 20px; font-size: 9px; border-color: var(--green); }
.correct-chip.fastest {
  background: #fff8d6;
  border-color: #d9a300;
  color: #7a5500;
  box-shadow: 0 0 0 2px #ffd84a inset;
  animation: fastest-pulse 1.4s ease-out 1;
}
.correct-chip.fastest .ava { background: #d9a300; border-color: #d9a300; }
@keyframes fastest-pulse {
  0% { transform: scale(1); }
  30% { transform: scale(1.08); }
  60% { transform: scale(.98); }
  100% { transform: scale(1); }
}

/* ============================================
   Player rows (lobby, hostwait, propwait)
   ============================================ */
.prow {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--soft-border);
}
.prow:last-child { border-bottom: none; }
.prow .pname { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 500; }
.prow .pstatus { font-size: 13px; font-weight: 700; }
.pstatus.done { color: var(--green); }
.pstatus.pending { color: var(--muted); }
.pstatus.skipped { color: var(--muted); font-weight: 500; }

.hw-label { font-size: 13px; color: var(--primary); font-weight: 700; margin-bottom: 10px; }

/* ============================================
   Connection dot
   ============================================ */
.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 6px;
  border: 1.5px solid var(--ink);
}
.conn-dot.off { background: var(--muted); }
.conn-status { text-align: center; margin-bottom: 10px; font-size: 13px; color: var(--muted); font-weight: 500; }

/* ============================================
   Waiting screens — big emoji wobble
   ============================================ */
.wait-wrap {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; text-align: center;
}
.big-emoji {
  font-size: 54px;
  margin-bottom: 18px;
  animation: wobble 2.4s ease-in-out infinite;
  display: inline-block;
}
@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}
.wait-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-style: italic; font-weight: 700;
  color: var(--ink); margin-bottom: 6px;
}
.wait-sub { color: var(--muted); font-size: 14px; font-weight: 500; }

/* ============================================
   Toast
   ============================================ */
#toast {
  position: fixed;
  bottom: 40px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 24px;
  border: 2px solid var(--ink);
  font-size: 14px; font-weight: 600;
  z-index: 100;
  opacity: 0;
  transition: opacity .2s, transform .25s cubic-bezier(.2, 1.4, .3, 1);
  pointer-events: none;
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================
   Confetti particles
   ============================================ */
.confetti {
  position: fixed;
  width: 10px; height: 16px;
  top: -30px;
  pointer-events: none;
  z-index: 200;
  will-change: transform, opacity;
  animation: confetti-fall 2.5s cubic-bezier(.1, .6, .4, 1) forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ============================================
   Utils
   ============================================ */
.divl { border: none; border-top: 2px solid var(--ink); margin: 14px 0; opacity: .25; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-14 { margin-bottom: 14px; } .mb-18 { margin-bottom: 18px; }
.row-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hidden { display: none !important; }

/* ============================================
   Mode picker compact (3 boutons sur 1 ligne)
   ============================================ */
.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.mode-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
  line-height: 1.1;
}
.mode-chip:active { transform: translate(2px, 2px); box-shadow: none; }
.mode-chip.on {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
body.balance-mode .mode-chip.on { background: #e94f37; }
.mode-chip span { font-size: 12px; font-weight: 600; }

/* ============================================
   Balance flash — éclat rouge au passage en balance
   ============================================ */
@keyframes balance-flash {
  0%   { background: #e94f37; }
  30%  { background: #ff7a59; }
  100% { background: #fff4ed; }
}
body.balance-flash { animation: balance-flash .6s ease-out; }

/* Bouton "moi" faded dans le picker balance */
.balance-picker-me { opacity: .5; filter: saturate(.6); }
.balance-picker-me.on { opacity: 1; filter: none; }

/* Spinner inline pour boutons en chargement */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Révélation Balance — mise en forme structurée */
.balance-reveal {
  padding: 2px 0;
}
.balance-reveal-line {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 6px;
}
.balance-reveal-line strong { font-weight: 800; color: #e94f37; }
.balance-reveal-reason {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
  opacity: .85;
  line-height: 1.4;
  padding-top: 6px;
  border-top: 1px dashed rgba(233, 79, 55, .4);
}

/* ============================================
   Balance mode — thème rouge/orange pour les questions de balance
   ============================================ */
body.balance-mode { background: #fff4ed; }
body.balance-mode #g { background: #fff4ed; }
body.balance-mode .catbadge {
  background: #e94f37;
  color: #fff;
  border-color: #1a1028;
}
body.balance-mode .pfill { background: #e94f37; }
body.balance-mode .card {
  border-color: #1a1028;
  box-shadow: 4px 4px 0 #e94f37;
}
body.balance-mode .inp:focus {
  border-color: #e94f37;
  box-shadow: 4px 4px 0 #e94f37;
}
body.balance-mode .gbtn {
  background: #e94f37;
  color: #fff;
  border-color: #1a1028;
}
body.balance-mode .gbtn:hover { background: #d84227; }
body.balance-mode .vbig.on,
body.balance-mode .vchip.on {
  background: #e94f37;
  color: #fff;
  border-color: #1a1028;
}
body.balance-mode #balance-picker .vchip .ava {
  background: #fce4de;
  color: #9c2e1e;
  border-color: #1a1028;
}
body.balance-mode #balance-picker .vchip.on .ava {
  background: #fff;
  color: #e94f37;
}
body.balance-mode .timer-pill.urgent { background: #e94f37; color: #fff; }
body.balance-mode .rauthor-label { color: #e94f37; }
body.balance-mode .rauthor { color: #e94f37; }
body.balance-mode .rauthor.typing::after { color: #e94f37; }

/* Vote balance — hiérarchie : raison grosse en quote, accusé discret en bas */
.balance-vote {
  text-align: center;
  padding: 6px 4px;
}
.balance-vote-reason {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 12px;
}
.balance-vote-target {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.balance-vote-target strong {
  color: #e94f37;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  font-size: 14px;
}

/* Shake feedback pour validation invalide */
@keyframes shake-invalid {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.shake-invalid {
  animation: shake-invalid .45s cubic-bezier(.36, .07, .19, .97);
  outline: 2px solid #e94f37;
  outline-offset: 4px;
  border-radius: 8px;
}
.mute.warn, #awlabel.warn {
  color: #e94f37 !important;
  font-weight: 700;
  opacity: 1;
}

/* Auto-advance progress bar (reveal screen) */
.next-bar {
  height: 8px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: 2px 2px 0 var(--ink);
}
.next-fill {
  height: 100%;
  background: var(--primary, #ff7a59);
  width: 0;
}
body.balance-mode .next-fill { background: #e94f37; }

/* État verrouillé pour les boutons d'action hôte (anti-clic accidentel) */
.gbtn.locked {
  background: #d8d4ca !important;
  color: #6f6a5e !important;
  cursor: not-allowed;
  box-shadow: 2px 2px 0 #b8b4aa !important;
  pointer-events: none;
}

/* Bandeau d'aide en mode balance — pour que les joueurs comprennent ce qu'on
   leur demande (écrire une accusation / deviner l'accusateur) */
.balance-hint {
  background: #fff4ed;
  border: 1.5px dashed #e94f37;
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.4;
  color: #5a2618;
}
.balance-hint strong { color: #e94f37; font-weight: 800; }
.balance-hint em { font-style: italic; font-weight: 700; }
.next-label {
  font-size: 13px;
  color: var(--ink);
  opacity: .75;
  text-align: center;
  margin-bottom: 6px;
}
