/* HeadsUp Live — feuille de style partagée (étudiant + console + projection) */

:root {
  --brand:   #4f46e5;
  --brand-d: #4338ca;
  --brand-l: #eef2ff;
  --ink:     #0f172a;
  --muted:   #64748b;
  --line:    #e2e8f0;
  --bg:      #f1f5f9;
  --card:    #ffffff;
  --ok:      #16a34a;
  --ok-l:    #dcfce7;
  --warn:    #d97706;
  --danger:  #dc2626;
  --radius:  16px;
  --shadow:  0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; }
p { margin: 0 0 .6em; }
button { font-family: inherit; }

/* Layout -------------------------------------------------------------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap-r { flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* App bar ------------------------------------------------------------- */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.appbar .wrap { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.brand { font-weight: 800; letter-spacing: -.02em; color: var(--brand-d); }
.brand span { color: var(--ink); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-l); color: var(--brand-d);
  font-weight: 700; font-size: .82rem; padding: 4px 10px; border-radius: 999px;
}
.chip.gray { background: #f1f5f9; color: var(--muted); }

/* Cards --------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card h2 { font-size: 1.15rem; }

/* Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-weight: 650; font-size: 1rem; padding: 12px 16px; border-radius: 12px;
  cursor: pointer; transition: transform .04s ease, background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 20px; font-size: 1.08rem; border-radius: 14px; }
.btn-sm { padding: 7px 11px; font-size: .85rem; border-radius: 9px; }

/* Fields -------------------------------------------------------------- */
.field, textarea.field {
  width: 100%; font-size: 1.05rem; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus, textarea.field:focus {
  border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.15);
}
textarea.field { resize: vertical; min-height: 84px; line-height: 1.45; }
.label { font-weight: 700; font-size: .9rem; margin-bottom: 6px; display: block; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-weight: 800; text-align: center; }

.error { color: var(--danger); font-size: .9rem; font-weight: 600; }
.notice { color: var(--muted); font-size: .9rem; }

/* Connection dot ------------------------------------------------------ */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-l); }
.dot.off { background: var(--warn); box-shadow: 0 0 0 3px #fef3c7; }
.dot.wait { background: #94a3b8; box-shadow: 0 0 0 3px #e2e8f0; }

/* Waiting screen ------------------------------------------------------ */
.waiting { text-align: center; padding: 48px 16px; }
.waiting .pulse {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--brand-l);
  display: grid; place-items: center; color: var(--brand); font-size: 30px;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }

/* Post-its ------------------------------------------------------------ */
.postit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.postit {
  border-radius: 12px; padding: 13px 14px; min-height: 72px;
  box-shadow: 0 2px 6px rgba(15,23,42,.10); border: 1px solid rgba(0,0,0,.05);
  word-break: break-word; white-space: pre-wrap;
  display: flex; flex-direction: column; gap: 8px;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.postit .txt { font-size: 1rem; font-weight: 550; }
.postit .who { font-size: .74rem; font-weight: 700; opacity: .55; }
.pi-yellow { background: #fef9c3; } .pi-pink { background: #fce7f3; }
.pi-green  { background: #dcfce7; } .pi-blue { background: #dbeafe; }
.pi-orange { background: #ffedd5; } .pi-purple { background: #ede9fe; }
.color-pick { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--ink); }

/* Pastilles pleines (indicateur de couleur / colonne) */
.cdot-yellow { background: #eab308; } .cdot-blue { background: #3b82f6; }
.cdot-green  { background: #22c55e; } .cdot-pink { background: #ec4899; }
.cdot-orange { background: #f97316; } .cdot-purple { background: #8b5cf6; }

/* Tableau à colonnes (projection + étudiants) ------------------------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col { flex: 0 0 auto; width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.col-head { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.col-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px rgba(15,23,42,.05); }
.col-name { font-weight: 700; font-size: .95rem; color: var(--ink); letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-body { display: flex; flex-direction: column; gap: 9px; min-height: 26px; padding: 11px; }
.col-empty { height: 8px; }
.col .postit { min-height: 0; box-shadow: 0 1px 3px rgba(15,23,42,.10); }

/* Accent de couleur en haut de chaque colonne (thème) */
.col { border-top-width: 3px; border-top-color: #e2e8f0; }
.ct-yellow { border-top-color: #eab308; } .ct-blue { border-top-color: #3b82f6; }
.ct-green  { border-top-color: #22c55e; } .ct-pink { border-top-color: #ec4899; }
.ct-orange { border-top-color: #f97316; } .ct-purple { border-top-color: #8b5cf6; }

/* Console : pastilles de classement sous chaque post-it (clic = classer) */
.rc-dots { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.rc-dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.20);
  transition: transform .08s ease;
}
.rc-dot:hover { transform: scale(1.18); }
.rc-dot.sel { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.05); }

/* Quiz : énoncé + classement (partagé élève / console / projection) */
.quiz-q { font-size: 1.05rem; font-weight: 700; margin: 2px 0 10px; }
.lb { display: flex; flex-direction: column; gap: 4px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #f8fafc; color: var(--ink); }
.lb-rank { font-weight: 800; color: var(--muted); min-width: 28px; }
.lb-name { flex: 1; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { font-weight: 800; color: var(--brand-d); }
.lb-row.top1 { background: #fef9c3; } .lb-row.top2 { background: #eef2ff; } .lb-row.top3 { background: #ffedd5; }

/* Tirage au sort : gagnants */
.draw-winners { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.draw-win { background: var(--brand-l); color: var(--brand-d); font-weight: 800; font-size: 1.4rem;
  padding: 12px 22px; border-radius: 14px; border: 2px solid var(--brand); }
.draw-win.me { background: var(--ok-l); color: var(--ok); border-color: var(--ok); }
.draw-win.reveal { animation: pop .3s ease; }
.draw-winners.big .draw-win { font-size: clamp(2rem, 6vw, 4.2rem); padding: 18px 34px; border-radius: 18px; }
.present-body .draw-win { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.45); }

/* Tirage au sort : roue de la fortune (écran projeté) */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; }
.wheel-box { position: relative; display: inline-block; width: min(60vh, 66vw); max-width: 540px; }
.wheel-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.wheelspin { transform-box: view-box; transform-origin: center; }
.wheel-pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0;
  border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 34px solid var(--ink);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); z-index: 3; }
.present-body .wheel-pointer { border-top-color: #fff; }
.wheel-hub { position: absolute; top: 50%; left: 50%; width: 13%; height: 13%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.35); z-index: 2; }
.wheel-winner { margin-top: 22px; min-height: 70px; display: flex; justify-content: center; align-items: center; }
.wheel-winner .draw-win { font-size: clamp(1.8rem, 5vw, 3.4rem); padding: 14px 30px; }
/* Version compacte dans la console */
.wheel-wrap.mini .wheel-box { width: 232px; }
.wheel-wrap.mini .wheel-pointer { border-left-width: 14px; border-right-width: 14px; border-top-width: 24px; top: -4px; }
.wheel-wrap.mini .wheel-winner { margin-top: 12px; min-height: 44px; }
.wheel-wrap.mini .wheel-winner .draw-win { font-size: 1.4rem; padding: 8px 18px; }

/* Console : éditeur des noms de colonnes */
.themes-ed { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px;
  padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.theme-row { display: flex; align-items: center; gap: 8px; }
.theme-row .col-dot { width: 14px; height: 14px; }
.theme-name { padding: 7px 10px; font-size: .88rem; }

/* Console : liste des post-its à classer à la main */
.plist { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.pcard { border: 1px solid var(--line); border-left: 5px solid #e2e8f0; border-radius: 12px; padding: 11px 14px; background: #fff; }
.pcard.pi-yellow { border-left-color: #eab308; } .pcard.pi-blue { border-left-color: #3b82f6; }
.pcard.pi-green { border-left-color: #22c55e; } .pcard.pi-pink { border-left-color: #ec4899; }
.pcard.pi-orange { border-left-color: #f97316; } .pcard.pi-purple { border-left-color: #8b5cf6; }
.pcard .txt { font-weight: 550; word-break: break-word; margin-bottom: 8px; }
.pcard-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pcard .who { font-size: .75rem; color: var(--muted); font-weight: 700; }
.pcat { font-size: .72rem; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.mover { display: flex; gap: 7px; margin-left: auto; }
.move-btn { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--line); padding: 0; transition: transform .08s; }
.move-btn:hover { transform: scale(1.12); }
.move-btn.sel { box-shadow: 0 0 0 2.5px var(--ink); }

/* QCM bars ------------------------------------------------------------ */
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 1.5px solid var(--line); background: #fff; border-radius: 12px;
  padding: 14px 16px; font-size: 1.05rem; font-weight: 600; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s;
}
.opt:hover { border-color: #c7d2fe; }
.opt.sel { border-color: var(--brand); background: var(--brand-l); }
.opt.correct { border-color: var(--ok); background: var(--ok-l); }
.opt.wrong { border-color: #fecaca; background: #fef2f2; }
.opt .key { width: 28px; height: 28px; border-radius: 8px; background: #f1f5f9; display: grid; place-items: center; font-weight: 800; flex: none; }
.opt.sel .key { background: var(--brand); color: #fff; }
.opt.correct .key { background: var(--ok); color: #fff; }

.bar-row { margin-bottom: 12px; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-weight: 650; margin-bottom: 5px; }
.bar-track { background: #eef2f7; border-radius: 8px; height: 30px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 8px; transition: width .5s cubic-bezier(.2,.7,.2,1); min-width: 2px; }
.bar-fill.correct { background: var(--ok); }

/* Questions ----------------------------------------------------------- */
.qlist { display: flex; flex-direction: column; gap: 10px; }
.qitem {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}
.qitem.answered { opacity: .55; }
.qitem.answered .qtext { text-decoration: line-through; }
.qtext { flex: 1; font-weight: 550; word-break: break-word; }
.qwho { font-size: .74rem; color: var(--muted); font-weight: 700; margin-top: 3px; }
.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; font-weight: 800; color: var(--muted);
}
.vote.on { border-color: var(--brand); background: var(--brand-l); color: var(--brand-d); }
.vote .arrow { font-size: .8rem; line-height: 1; }

/* Eval ---------------------------------------------------------------- */
.axis { margin-bottom: 16px; }
.axis .label { margin-bottom: 8px; }
.scale { display: flex; gap: 8px; }
.scale .pip {
  flex: 1; text-align: center; padding: 11px 0; border: 1.5px solid var(--line);
  border-radius: 10px; font-weight: 800; cursor: pointer; background: #fff; color: var(--muted);
}
.scale .pip.sel { border-color: var(--brand); background: var(--brand); color: #fff; }
.avg-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.avg-num { font-size: 1.6rem; font-weight: 800; color: var(--brand-d); min-width: 58px; }
.comment { border-left: 3px solid var(--brand-l); padding: 4px 0 4px 12px; margin: 8px 0; color: #334155; }

/* Toast --------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ============ ÉCRAN PROJETÉ (present) ============ */
.present-body { background: #0b1220; color: #fff; min-height: 100vh; }
.present-body .join-band {
  display: flex; align-items: center; gap: 28px; justify-content: center;
  padding: 18px; background: rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.08);
}
.present-body .join-band .qr { background: #fff; padding: 10px; border-radius: 14px; }
.present-body .join-band .qr img { display: block; width: 150px; height: 150px; }
.present-body .join-band .code { font-size: 3rem; font-weight: 900; letter-spacing: .18em; }
.present-body .join-band .url { font-size: 1.15rem; opacity: .8; }
.present-stage { padding: 32px 40px; }
.present-stage h1 { font-size: 2.4rem; }
.present-body .postit { color: #0f172a; }
.present-body .bar-track { background: rgba(255,255,255,.12); height: 46px; }
.present-body .bar-row .bar-head { font-size: 1.5rem; }
.present-body .card { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); color: #fff; }
.present-body .muted { color: #94a3b8; }
.present-body .big-code { text-align: center; padding: 6vh 20px; }
.present-body .big-code .code { font-size: 6rem; font-weight: 900; letter-spacing: .2em; }
.present-body .qitem { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #fff; }
.present-body .qwho { color: #94a3b8; }
.present-body .comment { color: #cbd5e1; border-color: rgba(255,255,255,.2); }
.present-body .col { width: 260px; }
.present-body .col-name { font-size: 1.15rem; }
.present-body .col-body { padding: 13px; gap: 11px; }
.present-body .col .postit .txt { font-size: 1.05rem; }

/* Responsive ---------------------------------------------------------- */
@media (max-width: 520px) {
  .present-stage { padding: 20px; }
  .postit-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
