/* ============================================================
   host.css — Espace animateur (desktop) + éditeur
   ============================================================ */

/* ---------- Connexion ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 {
  margin: 4px 0 0;
}
.login-err {
  color: #fca5a5;
  font-weight: 700;
  min-height: 1.2em;
  margin: 0;
}

/* ---------- En-tête ---------- */
.host-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.host-head .brand-logo {
  font-size: 1.5rem;
}
.host-head-actions {
  display: flex;
  gap: 10px;
}
.lib-title {
  font-size: 2rem;
  margin: 6px 0 2px;
}

/* ---------- Grille de quiz ---------- */
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin: 18px 0 36px;
}
.quiz-card {
  --accent: var(--brand);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.qc-bar {
  height: 8px;
  background: var(--accent);
}
.qc-body {
  padding: 18px 18px 8px;
  flex: 1;
}
.qc-body h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}
.qc-body p {
  margin: 0 0 10px;
  min-height: 1.2em;
}
.qc-actions {
  display: flex;
  gap: 8px;
  padding: 14px 18px 18px;
}
.qc-actions .play {
  flex: 1;
}
.qc-actions .edit,
.qc-actions .del {
  padding: 12px 14px;
}
.empty {
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

/* ---------- Historique ---------- */
.hist-title {
  font-size: 1.3rem;
  margin-top: 10px;
}
.history {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.hist-row {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.hist-win {
  font-weight: 800;
  white-space: nowrap;
}

/* ============================================================
   PILOTAGE DE PARTIE
   ============================================================ */
.live {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: rgba(24, 20, 15, 0.92);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.live-head-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.live-quiz {
  font-weight: 900;
  font-size: 1.2rem;
}
.live-pin {
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.live-pin b {
  letter-spacing: 0;
  color: #fff;
}
.live-conn {
  color: var(--good);
}
.live-head-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.bonus-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.bonus-toggle input {
  width: auto;
}

.live-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  padding: 18px 22px;
  min-height: 0;
}
.live-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}
.live-stage {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow: auto;
}
.live-controls {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.live-controls .btn-lg {
  min-width: 280px;
}

/* ---- Lobby (host) ---- */
.stage-lobby {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  height: 100%;
  align-items: center;
}
.lobby-join {
  text-align: center;
}
.join-url-h {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand);
  word-break: break-all;
}
.pin-h {
  font-size: 1.4rem;
  margin: 8px 0;
}
.pin-h b {
  font-size: 2rem;
  letter-spacing: 0;
}
.qr-h {
  display: inline-block;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
  margin: 8px 0;
}
.qr-h img {
  width: 160px;
  height: 160px;
  display: block;
}
.small {
  font-size: 0.85rem;
}
.lobby-wait {
  text-align: center;
}
.lobby-wait h2 {
  font-size: 1.6rem;
}

/* ---- Question (host) ---- */
.stage-q-top {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.stage-q-enonce {
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 20px;
}
.h-answers {
  display: grid;
  gap: 12px;
}
.h-answers.a-2 {
  grid-template-columns: 1fr 1fr;
}
.h-answers.a-3,
.h-answers.a-4 {
  grid-template-columns: 1fr 1fr;
}
.h-ans {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  transition: opacity 0.3s, outline 0.3s;
}
.h-ans.dim {
  opacity: 0.35;
}
/* L'animateur (juge) voit la bonne réponse dès la question (vue privée). */
.h-ans.is-correct {
  outline: 3px solid #86efac;
  outline-offset: 2px;
}
.stage-q.revealed .h-ans.is-correct {
  outline: 4px solid #fff;
  outline-offset: 2px;
}
.h-shape {
  font-size: 1.4rem;
}
.h-ans-txt {
  flex: 1;
}
.h-count {
  font-weight: 900;
  font-size: 1.3rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 12px;
  border-radius: 999px;
  min-width: 36px;
  text-align: center;
}
.h-correct-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  background: #16a34a;
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
}

/* Réponses libres / ouvertes (host) */
.h-free-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.85rem;
}
.h-free-val {
  font-size: 2rem;
  font-weight: 900;
  color: #86efac;
  margin-bottom: 16px;
}
.open-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.oa-row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
}
.oa-row.ok {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.14);
}
.oa-row.no {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  opacity: 0.7;
}
.oa-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.oa-rep {
  font-style: italic;
}
.oa-actions button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  font-size: 1.1rem;
}

/* ---- Classement (host) ---- */
.stage-board h2 {
  margin-top: 0;
}
.sb-row {
  display: grid;
  grid-template-columns: 40px 1fr 3fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.sb-rank {
  font-weight: 900;
  text-align: center;
}
.sb-name {
  font-weight: 800;
}
.sb-bar {
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.sb-bar i {
  display: block;
  height: 100%;
  background: var(--brand);
}
.sb-score {
  font-weight: 900;
  color: var(--brand);
}

/* ---- Podium (host) ---- */
.stage-podium {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.champ {
  font-size: 1.4rem;
}

/* ---- Aside joueurs ---- */
.live-aside {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.aside-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  margin-bottom: 10px;
}
.players-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pl-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.pl-row.off {
  opacity: 0.4;
}
.pl-rank {
  font-weight: 900;
  color: var(--brand);
  text-align: center;
}
.pl-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl-score {
  font-weight: 800;
  font-size: 0.9rem;
}
.pl-actions {
  display: flex;
  gap: 3px;
}
.pl-actions button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--card-strong);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 0.85rem;
}

/* ---- Responsive : sur petit écran on empile ---- */
@media (max-width: 880px) {
  .live-body {
    grid-template-columns: 1fr;
  }
  .stage-lobby {
    grid-template-columns: 1fr;
  }
  .live-controls .btn-lg {
    min-width: 0;
    flex: 1;
  }
}

/* Passe animateur v2 */
.host-head {
  padding-top: 4px;
}

.quiz-card {
  transition: transform 0.12s ease, border-color 0.18s ease;
}

.quiz-card:hover {
  transform: translateY(-2px);
  border-color: rgba(243, 180, 63, 0.28);
}

.live-head {
  background: rgba(20, 16, 11, 0.96);
}

.live-stage {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 35%),
    var(--card);
}

.lobby-mark {
  width: 112px;
  height: 112px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff8e7;
  border: 5px solid var(--brand);
  color: #1b160f;
  font-size: 4rem;
  box-shadow: var(--shadow);
  animation: pop 0.35s ease both;
}

.host-timer {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  gap: 8px;
  min-height: 54px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(243, 180, 63, 0.13);
  border: 1px solid rgba(243, 180, 63, 0.36);
}

.host-timer span,
.host-timer small {
  color: var(--ink-soft);
  font-weight: 800;
}

.host-timer b {
  min-width: 54px;
  text-align: center;
  color: var(--brand);
  font-size: 2rem;
  line-height: 1;
}

.host-timer.paused {
  background: rgba(31, 138, 112, 0.18);
  border-color: rgba(31, 138, 112, 0.5);
}

.host-timer.paused b {
  min-width: 84px;
  color: #8ee6cd;
  font-size: 1.35rem;
}

.host-timer.danger b {
  color: #fca5a5;
}

.private-hint {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  color: #8ee6cd;
  background: rgba(31, 138, 112, 0.14);
  border: 1px solid rgba(31, 138, 112, 0.35);
  font-size: 0.82rem;
  font-weight: 800;
}

.h-free-hidden {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
}

.hidden-answer {
  color: var(--ink-soft);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 18px 24px;
  background: rgba(0, 0, 0, 0.22);
}

.oa-pending {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.btn-paused {
  border-color: rgba(31, 138, 112, 0.5);
  background: rgba(31, 138, 112, 0.22);
}

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.board-head h2,
.stage-podium-rich h2 {
  margin: 0;
  font-size: 2.2rem;
}

.sb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sb-row {
  min-height: 54px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.sb-row.top {
  border-color: rgba(243, 180, 63, 0.38);
  background: rgba(243, 180, 63, 0.09);
}

.sb-rank {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card-strong);
  color: var(--brand);
}

.stage-podium-rich {
  justify-content: center;
  gap: 18px;
}

.host-podium {
  width: min(920px, 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin: 8px auto 0;
}

.host-pod-col {
  flex: 1;
  max-width: 250px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.host-pod-place {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card-strong);
  border: 1px solid var(--border);
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 900;
}

.host-pod-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.15rem;
  font-weight: 900;
}

.host-pod-block {
  width: 100%;
  min-height: 160px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  border-radius: 8px 8px 0 0;
  color: var(--brand-ink);
  background: var(--brand);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.12);
}

.host-pod-col.first .host-pod-block {
  min-height: 240px;
}

.host-pod-col.second .host-pod-block {
  min-height: 190px;
  background: #c9c4b8;
}

.host-pod-col.third .host-pod-block {
  min-height: 150px;
  background: #b56a3c;
}

.host-pod-block span {
  font-size: 2rem;
  font-weight: 900;
}

.host-pod-block small {
  font-weight: 900;
}

.host-rest {
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto;
}

.host-rest-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  font-weight: 800;
}
