:root {
  --foret: #12382f;
  --foret-2: #1d5446;
  --canopee: #2f7d5b;
  --creme: #f6f1e7;
  --papier-fond: #fffdf8;
  --encre: #1c2521;
  --gris: #5d6964;
  --ligne: #ddd5c4;
  --papier: #c9651b;       /* groupe papier : ocre */
  --papier-clair: #f8e3cf;
  --numerique: #0d7f8c;    /* groupe numérique : turquoise */
  --numerique-clair: #d3eef0;
  --ok: #2f8a4c;
  --ko: #b83a2e;
  --ombre: 0 2px 10px rgba(18, 56, 47, .10);
  --r: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--encre);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--creme); min-height: 100vh; line-height: 1.45; }
button, input, select { font: inherit; }
a { color: var(--numerique); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }

.hidden { display: none !important; }
.muted { color: var(--gris); }
.center { text-align: center; }
.small { font-size: .88rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card {
  background: var(--papier-fond);
  border: 1px solid var(--ligne);
  border-radius: var(--r);
  padding: 1.25rem;
  box-shadow: var(--ombre);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 0; border-radius: 10px; padding: .75em 1.2em; cursor: pointer;
  background: var(--foret); color: #fff; font-weight: 600; text-decoration: none;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:hover { background: var(--foret-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.ghost { background: transparent; color: var(--foret); border: 1.5px solid var(--foret); }
.btn.ghost:hover { background: rgba(18, 56, 47, .06); }
.btn.small { padding: .4em .8em; font-size: .88rem; }
.btn.big { padding: 1em 1.6em; font-size: 1.1rem; width: 100%; }
.btn.papier { background: var(--papier); }
.btn.numerique { background: var(--numerique); }

.tag {
  display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: #ebe5d8; color: var(--gris);
}
.tag.papier { background: var(--papier-clair); color: #8a4210; }
.tag.numerique { background: var(--numerique-clair); color: #075962; }

/* ------------------------------------------------------------------ participant */

.p-shell { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.p-top {
  display: flex; align-items: center; gap: .6rem; padding: .6rem 0 1rem;
  color: var(--foret); font-weight: 700;
}
.p-top .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--foret); display: grid; place-items: center; color: #fff; font-size: 16px; }
.p-top .timer { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 1.1rem; background: #fff; border: 1px solid var(--ligne); border-radius: 8px; padding: .15em .6em; }
.p-top .timer.urgent { color: var(--ko); border-color: var(--ko); }

.input { width: 100%; padding: .8em 1em; border-radius: 10px; border: 1.5px solid var(--ligne); background: #fff; }
.input:focus { outline: 2px solid var(--numerique); border-color: transparent; }

/* carte de tirage */
.draw-card { perspective: 900px; width: 220px; height: 300px; margin: 1.5rem auto; }
.draw-card .inner { position: relative; width: 100%; height: 100%; transition: transform .8s cubic-bezier(.3,.7,.3,1); transform-style: preserve-3d; }
.draw-card.flipped .inner { transform: rotateY(180deg); }
.draw-card .face { position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden; display: grid; place-items: center; text-align: center; padding: 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.draw-card .back {
  background: repeating-linear-gradient(45deg, var(--foret) 0 12px, var(--foret-2) 12px 24px);
  color: #fff; font-weight: 700; font-size: 1.2rem;
}
.draw-card .front { transform: rotateY(180deg); color: #fff; }
.draw-card .front.papier { background: var(--papier); }
.draw-card .front.numerique { background: var(--numerique); }
.draw-card .front .big { font-size: 2rem; font-weight: 800; }

.group-banner { border-radius: var(--r); padding: 1rem 1.2rem; color: #fff; }
.group-banner.papier { background: var(--papier); }
.group-banner.numerique { background: var(--numerique); }
.group-banner .lbl { opacity: .85; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.group-banner .val { font-size: 1.4rem; font-weight: 800; }

/* quiz */
.quiz-head { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; color: var(--gris); }
.progress { height: 8px; background: #e7e0d1; border-radius: 99px; overflow: hidden; margin: .5rem 0 1rem; }
.progress > div { height: 100%; background: var(--numerique); transition: width .3s; }
.q-kind { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--numerique); font-weight: 700; }
.q-text { font-size: 1.25rem; font-weight: 700; margin: .4rem 0 1rem; }
.options { display: grid; gap: .6rem; }
.opt {
  text-align: left; border: 2px solid var(--ligne); background: #fff; border-radius: 12px; padding: .85em 1em;
  cursor: pointer; font-size: 1rem; color: var(--encre); transition: border-color .15s, background .15s;
}
.opt:hover:not(:disabled) { border-color: var(--numerique); }
.opt.selected { border-color: var(--foret); background: #eef3ef; }
.opt.correct { border-color: var(--ok); background: #e3f3e7; }
.opt.wrong { border-color: var(--ko); background: #f8e2df; }
.opt:disabled { cursor: default; }
.opt.vf { text-align: center; font-weight: 700; }
.options.two { grid-template-columns: 1fr 1fr; }
.feedback { margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; font-size: .95rem; }
.feedback.ok { background: #e3f3e7; color: #1e5e33; }
.feedback.ko { background: #f8e2df; color: #7d231a; }

.lb { list-style: none; padding: 0; margin: 0; }
.lb li { display: flex; align-items: center; gap: .75rem; padding: .6rem .2rem; border-bottom: 1px solid var(--ligne); }
.lb li.mine { font-weight: 700; color: var(--numerique); }
.lb .rank { width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: #ebe5d8; font-weight: 700; font-size: .9rem; }
.lb li:first-child .rank { background: #f2c14e; }
.lb .bar { flex: 1; height: 8px; border-radius: 99px; background: #e7e0d1; overflow: hidden; }
.lb .bar > div { height: 100%; background: var(--numerique); }

/* échelles 1-5 */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-top: .6rem; }
.scale button { padding: .8em 0; border-radius: 10px; border: 2px solid var(--ligne); background: #fff; font-weight: 700; font-size: 1.1rem; cursor: pointer; color: var(--encre); }
.scale button.selected { background: var(--foret); color: #fff; border-color: var(--foret); }
.scale-legend { display: flex; justify-content: space-between; font-size: .78rem; color: var(--gris); margin-top: .3rem; }

.big-score { font-size: 3.5rem; font-weight: 800; color: var(--foret); line-height: 1; }
.phrase { font-size: 1.3rem; font-weight: 700; color: var(--foret); border-left: 5px solid var(--canopee); padding-left: 1rem; }

.offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--ko); color: #fff;
  padding: .7em 16px; text-align: center; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--encre); color: #fff;
  padding: .7em 1.2em; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); font-size: .95rem;
}

/* ------------------------------------------------------------------ animateur */

.h-shell { min-height: 100vh; display: flex; flex-direction: column; }
.h-bar { background: var(--foret); color: #fff; padding: .6rem 1.2rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.h-bar .brand { font-weight: 800; letter-spacing: .02em; }
.h-bar .btn { background: rgba(255,255,255,.12); }
.h-bar .btn:hover { background: rgba(255,255,255,.22); }
.h-bar .btn.ghost { border-color: rgba(255,255,255,.4); color: #fff; }

.steps { display: flex; gap: 4px; padding: .8rem 1.2rem; background: #fff; border-bottom: 1px solid var(--ligne); overflow-x: auto; }
.step {
  flex: 1; min-width: 130px; border: 0; background: #f1ece1; border-radius: 10px; padding: .55rem .8rem; text-align: left; cursor: pointer;
  color: var(--gris); display: flex; flex-direction: column; gap: 2px;
}
.step .t { font-size: .75rem; font-variant-numeric: tabular-nums; }
.step .n { font-weight: 700; font-size: .92rem; color: var(--encre); }
.step.active { background: var(--foret); color: #cfe3da; }
.step.active .n { color: #fff; }
.step.done { background: #e1ece5; }

.h-main { flex: 1; padding: 1.2rem; max-width: 1400px; width: 100%; margin: 0 auto; }
.h-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; }
@media (max-width: 900px) { .h-grid { grid-template-columns: 1fr; } }

.clock { font-size: clamp(3rem, 9vw, 7rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--foret); line-height: 1; }
.clock.urgent { color: var(--ko); }
.clock-sub { color: var(--gris); }

.consigne { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; color: var(--foret); }

.join-box { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.join-box .qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--ligne); width: 196px; height: 196px; display: grid; place-items: center; }
.join-box .qr img, .join-box .qr svg { width: 180px; height: 180px; image-rendering: pixelated; }
.join-url { font-size: clamp(1.1rem, 2.4vw, 1.8rem); font-weight: 800; color: var(--foret); word-break: break-all; }

.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.count { border-radius: var(--r); padding: 1rem; color: #fff; }
.count.papier { background: var(--papier); }
.count.numerique { background: var(--numerique); }
.count .v { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.count .l { opacity: .9; font-size: .9rem; }

table.plist { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.plist th, table.plist td { padding: .45rem .5rem; border-bottom: 1px solid var(--ligne); text-align: left; }
table.plist th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); }
.table-wrap { max-height: 360px; overflow: auto; }

/* résultats côte à côte */
.versus { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.vs-col { border-radius: var(--r); padding: 1.2rem; background: #fff; border-top: 8px solid; box-shadow: var(--ombre); }
.vs-col.papier { border-color: var(--papier); }
.vs-col.numerique { border-color: var(--numerique); }
.vs-col h3 { display: flex; align-items: center; gap: .5rem; }
.vs-col .n { font-weight: 400; color: var(--gris); font-size: .9rem; }
.metric { margin: 1rem 0; }
.metric .lbl { font-size: .85rem; color: var(--gris); display: flex; justify-content: space-between; }
.metric .val { font-size: 2.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .track { height: 14px; background: #eee8dc; border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.metric .track > div { height: 100%; border-radius: 99px; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.papier .track > div { background: var(--papier); }
.numerique .track > div { background: var(--numerique); }
.metric.locked .val { color: #cfc6b3; }

.reveal-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.reveal-bar .btn.active { background: var(--canopee); }

.qgrid { display: grid; grid-template-columns: auto 1fr 1fr; gap: .3rem .8rem; align-items: center; font-size: .9rem; }
.qgrid .mini { height: 10px; background: #eee8dc; border-radius: 99px; overflow: hidden; }
.qgrid .mini > div { height: 100%; }
.qgrid .mini.papier > div { background: var(--papier); }
.qgrid .mini.numerique > div { background: var(--numerique); }

.calib { width: 100%; max-width: 640px; display: block; margin: 0 auto; }

.hist { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: .5rem; }
.hist > div { flex: 1; border-radius: 3px 3px 0 0; min-height: 2px; }
.papier .hist > div { background: var(--papier); }
.numerique .hist > div { background: var(--numerique); }
.hist-axis { display: flex; gap: 3px; font-size: .7rem; color: var(--gris); }
.hist-axis > span { flex: 1; text-align: center; }

details.debrief { background: #fff; border: 1px solid var(--ligne); border-radius: var(--r); padding: .8rem 1rem; }
details.debrief summary { cursor: pointer; font-weight: 700; color: var(--foret); }
details.debrief[open] summary { margin-bottom: .6rem; }
details.debrief li { margin: .35rem 0; }

.projection .host-only { display: none !important; }

.big-phrase { font-size: clamp(1.8rem, 4.5vw, 3.4rem); font-weight: 800; color: var(--foret); text-align: center; max-width: 1000px; margin: 1rem auto; line-height: 1.2; }

.login { max-width: 420px; margin: 12vh auto; padding: 0 16px; }

@media print {
  .no-print { display: none !important; }
}
