/* quizz — thème de Noël sobre (vert sapin, rouge, or). Lisible sur téléphone et en projection. */
:root {
  --bg: #0f2a1d;
  --bg2: #163a29;
  --card: #fdf8ef;
  --ink: #1d1d1b;
  --muted: #6b6b63;
  --gold: #f2c14e;
  --red: #c0392b;
  --blue: #2563a8;
  --green: #2e8b57;
  --ok: #1f8a4c;
  --ko: #b23a2f;
  --radius: 16px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: radial-gradient(circle at 50% 0%, var(--bg2), var(--bg) 70%) fixed;
  color: #fff;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  line-height: 1.4;
}
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}
h1,
h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.2;
}
.card {
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 25%);
}
.card.center {
  text-align: center;
}
.card.good {
  border-top: 8px solid var(--ok);
}
.card.bad {
  border-top: 8px solid var(--ko);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.big {
  font-size: 1.6rem;
  font-weight: 700;
}
.error {
  color: var(--ko);
  min-height: 1.2em;
  margin: 8px 0;
}
.loading {
  text-align: center;
  opacity: 0.8;
}
label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
}
input {
  width: 100%;
  font-size: 1.25rem;
  padding: 12px 14px;
  border: 2px solid #c9c2b2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
input:focus {
  outline: 3px solid var(--gold);
  border-color: var(--gold);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  background: #e8e1d2;
  color: var(--ink);
  touch-action: manipulation;
}
.btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--gold);
  color: var(--ink);
  width: 100%;
  margin-top: 12px;
}
.btn.danger {
  background: var(--ko);
  color: #fff;
}
.btn.small {
  padding: 6px 10px;
  font-size: 0.9rem;
}

/* Barre joueur */
.bar {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-weight: 700;
  background: rgb(0 0 0 / 25%);
}
.bar:empty {
  display: none;
}
.bar .score {
  color: var(--gold);
}

/* Question */
.qhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.timer {
  min-width: 2.2em;
  text-align: center;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-variant-numeric: tabular-nums;
}
.question img,
.qimg {
  display: block;
  max-width: 100%;
  max-height: 40vh;
  margin: 12px auto;
  border-radius: 12px;
}
.choices {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.choices.n4,
.choices.n2 {
  grid-template-columns: 1fr 1fr;
}
.choice {
  position: relative;
  overflow: hidden;
  min-height: 88px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: left;
  justify-content: flex-start;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.choice .shape {
  font-size: 1.4rem;
}
.c0 {
  background: var(--red);
}
.c1 {
  background: var(--blue);
}
.c2 {
  background: #b8860b;
}
.c3 {
  background: var(--green);
}
.choice.dim {
  opacity: 0.35;
}
.choice.good {
  outline: 5px solid var(--gold);
}
.choice .count {
  margin-left: auto;
  font-size: 1.5rem;
}
.choice .meter {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 8px;
  background: rgb(255 255 255 / 70%);
  padding: 0;
}
.free {
  margin-top: 16px;
}
.sent {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-top: 20px;
}

/* Compteurs */
.counter {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 8px 0;
}
.progress {
  height: 14px;
  background: #e3dccb;
  border-radius: 999px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--ok);
  transition: width 0.3s ease-out;
}

/* Animateur */
body.admin main {
  max-width: 900px;
}
.adminhead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.adminhead .phase {
  margin: 0;
  color: var(--gold);
  font-weight: 700;
}
.join-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.join-info a {
  color: var(--gold);
}
.answer {
  font-weight: 700;
  color: var(--ok);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.actions .btn {
  flex: 1 1 200px;
  margin: 0;
}
.actions .btn:not(.primary):not(.danger) {
  background: #fff;
}
.actions.secondary {
  margin-top: 24px;
}
.groups,
.players {
  list-style: none;
  padding: 0;
  margin: 0;
}
.groups li,
.players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e3dccb;
}
.groups li > span:first-child,
.players .pseudo {
  flex: 1;
  overflow-wrap: anywhere;
}
.groups li.ko {
  background: #fbeceb;
}
.print-only {
  display: none;
}

/* Projection */
body.screen main {
  max-width: none;
  min-height: 100vh;
  padding: 3vh 4vw;
  font-size: 2.2vh;
}
body.screen .title {
  font-size: 7vh;
  text-align: center;
  color: var(--gold);
}
.lobby-grid {
  display: flex;
  gap: 5vw;
  align-items: center;
  justify-content: center;
}
.lobby .qr {
  width: 40vh;
  height: 40vh;
  background: #fff;
  border-radius: 16px;
  padding: 8px;
}
.lobby .big {
  font-size: 5vh;
}
.lobby .url {
  font-size: 4vh;
  font-weight: 700;
}
.lobby .code {
  font-size: 4vh;
  color: var(--gold);
  letter-spacing: 0.15em;
}
.lobby .counter {
  font-size: 5vh;
}
.cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1vh 1.5vw;
  justify-content: center;
  padding: 0;
  margin-top: 4vh;
  font-size: 3vh;
}
.cloud li {
  background: rgb(255 255 255 / 12%);
  border-radius: 999px;
  padding: 0.3em 0.9em;
}
.stage {
  max-width: 85vw;
  margin: 0 auto;
}
.stage .qhead {
  color: #fff;
  font-size: 3.5vh;
}
.stage .timer.big {
  font-size: 5vh;
}
.stage .closed {
  color: var(--gold);
}
.qtext {
  font-size: 6vh;
  text-align: center;
  margin: 3vh 0;
}
.stage .choice {
  min-height: 12vh;
  font-size: 4vh;
}
.stage .live {
  margin-top: 4vh;
  text-align: center;
}
.stage .counter {
  font-size: 5vh;
}
.stage .progress {
  height: 2.5vh;
}
.reveal-answer {
  text-align: center;
  font-size: 6vh;
  font-weight: 800;
  color: var(--gold);
}
.top {
  margin-top: 3vh;
  text-align: center;
}
.top h2 {
  font-size: 4.5vh;
  color: var(--gold);
}
.top ol {
  display: inline-block;
  text-align: left;
  font-size: 4vh;
  margin: 0;
}
.top li span + span {
  margin-left: 1em;
  color: #cfd8d2;
}
.corner {
  position: fixed;
  right: 2vw;
  bottom: 2vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.8vh;
}
.corner .qr {
  width: 14vh;
  height: 14vh;
  background: #fff;
  padding: 4px;
  border-radius: 8px;
}
.ranking {
  list-style: none;
  padding: 0;
  max-width: 70vw;
  margin: 2vh auto;
  font-size: 4vh;
}
.ranking li {
  display: flex;
  gap: 2vw;
  padding: 1vh 2vw;
  border-radius: 12px;
  margin-bottom: 1vh;
  background: rgb(255 255 255 / 8%);
}
.ranking .pseudo {
  flex: 1;
}
.ranking .rank {
  min-width: 3em;
}
.ranking .p1 {
  background: var(--gold);
  color: var(--ink);
  font-size: 1.25em;
}
.ranking .p2 {
  background: #d9d9d9;
  color: var(--ink);
}
.ranking .p3 {
  background: #d79b62;
  color: var(--ink);
}
.board .big {
  text-align: center;
  font-size: 5vh;
}
.fs {
  position: fixed;
  left: 1vw;
  bottom: 1vh;
  opacity: 0.4;
}

/* État réseau et notifications */
.offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--ko);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-weight: 700;
}
body.offline .offline-banner {
  display: block;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  background: #222;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  max-width: 90vw;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
@media print {
  body {
    background: #fff;
    color: #000;
  }
  body > *:not(main),
  main > *:not(.print-only) {
    display: none !important;
  }
  .print-only {
    display: block;
    text-align: center;
    color: #000;
  }
  .print-only img {
    width: 12cm;
    height: 12cm;
  }
  .print-only h1 {
    font-size: 32pt;
  }
  .print-only p {
    font-size: 20pt;
  }
}
.choice > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  body.player .choices.n4,
  body.player .choices.n3 {
    grid-template-columns: 1fr;
  }
  body.player .choice {
    min-height: 64px;
  }
}
body.admin .team {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 24px;
}
.invite {
  margin-top: 16px;
}
@media print {
  .team {
    display: none !important;
  }
}
