:root {
  --green: #02894A;
  --green-dark: #016236;
  --sage: #bed3ab;
  --sage-light: #e3ecd9;
  --beige: #e0ddd6;
  --cream: #f6f4ef;
  --ink: #1d2a22;
  --muted: #5d6b62;
  --white: #fff;
  --warn: #c26b12;
  --danger: #b3261e;
  --radius: 16px;
  font-family: 'Switzer', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); min-height: 100%; }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green-dark); }
.hidden { display: none !important; }

/* ---------- Commun ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 32px; height: 32px; }
.brand small { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 600; font-size: 17px;
  background: var(--green); color: var(--white); min-height: 52px; text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: transform .05s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.secondary { background: var(--white); color: var(--green-dark); box-shadow: inset 0 0 0 2px var(--sage); }
.btn.ghost { background: transparent; color: var(--green-dark); box-shadow: inset 0 0 0 2px var(--beige); }
.btn.danger { background: var(--white); color: var(--danger); box-shadow: inset 0 0 0 2px #e8c3c0; }
.btn.big { font-size: 22px; min-height: 72px; padding: 18px 28px; }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 var(--beige); }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--sage-light); color: var(--green-dark); font-weight: 600; font-size: 14px; }
.pill.test { background: #fde7c7; color: #7a4100; }
.err { color: var(--danger); font-weight: 500; }

/* ---------- Mobile (participant / pilote) ---------- */
.mobile { max-width: 640px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--cream);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px; border-bottom: 1px solid var(--beige); margin-bottom: 16px;
}
.sync { font-size: 13px; color: var(--muted); white-space: nowrap; }
.sync.off { color: var(--warn); font-weight: 600; }
h1 { font-size: 28px; line-height: 1.15; margin: 8px 0 12px; }
h2 { font-size: 22px; margin: 24px 0 8px; }
.field-input {
  width: 100%; border: 2px solid var(--beige); border-radius: 12px; background: var(--white);
  padding: 14px; font-size: 18px; line-height: 1.4; outline: none; -webkit-appearance: none;
}
.field-input:focus { border-color: var(--green); }
textarea.field-input { resize: vertical; min-height: 110px; }
textarea.field-input.long { min-height: 200px; }
textarea.field-input.short { min-height: 64px; }
.center-screen { min-height: 70dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.center-screen img { width: 88px; height: 88px; }
.center-screen .big-msg { font-size: 30px; font-weight: 700; }
.names { display: grid; gap: 12px; margin-top: 16px; }
.names .btn { font-size: 24px; min-height: 76px; }

.question { background: var(--white); border-radius: var(--radius); padding: 18px 16px 20px; margin-bottom: 16px; }
.question .qnum { font-size: 13px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .06em; }
.question .qlabel { font-size: 19px; font-weight: 600; line-height: 1.3; margin: 4px 0 12px; }
.question .hint { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.question .sub { font-weight: 600; margin: 12px 0 6px; }
.question.filled .qnum::after { content: ' ✓'; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--beige); background: var(--white); border-radius: 999px; padding: 10px 14px;
  font-size: 16px; display: inline-flex; align-items: center; gap: 8px; min-height: 46px;
}
.chip .rank { display: none; width: 26px; height: 26px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; font-size: 14px; align-items: center; justify-content: center; }
.chip.on { border-color: var(--green); background: var(--sage-light); font-weight: 600; }
.chip.on .rank { display: inline-flex; }
.ab { display: grid; gap: 10px; }
.ab .chip { border-radius: 14px; justify-content: flex-start; font-size: 18px; padding: 14px 16px; min-height: 58px; }
.number { display: flex; align-items: center; gap: 14px; }
.number button { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--sage); background: var(--white); font-size: 28px; font-weight: 600; color: var(--green-dark); }
.number .val { font-size: 40px; font-weight: 700; min-width: 64px; text-align: center; }
.portrait-part { margin-top: 12px; }
.portrait-part .field-input { margin-bottom: 8px; font-size: 17px; padding: 12px; }

.donebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(246, 244, 239, .96); border-top: 1px solid var(--beige);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.donebar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.donebar .inner > .btn { flex: 1; }
.donebar .status { font-size: 14px; color: var(--muted); }
.done-ok { background: var(--sage-light); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; font-weight: 600; color: var(--green-dark); }

/* Pilote */
.pilot-section { margin-bottom: 18px; }
.pilot-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pilot-row > .btn { flex: 1 1 140px; }
.block-line { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--beige); }
.block-line:last-child { border-bottom: 0; }
.block-line .t { flex: 1; font-weight: 600; }
.block-line .t small { display: block; font-weight: 400; color: var(--muted); }
.block-line input { width: 64px; text-align: center; padding: 8px; font-size: 16px; border: 2px solid var(--beige); border-radius: 10px; }
.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.who div { background: var(--cream); border-radius: 12px; padding: 10px; text-align: center; font-weight: 600; }
.who div small { display: block; font-weight: 400; color: var(--muted); }
.preview { border: 2px dashed var(--beige); border-radius: 12px; padding: 12px; font-size: 15px; line-height: 1.4; }
.preview b { color: var(--green-dark); }
.timer-mini { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Écran (projection) ---------- */
.screen { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--cream); }
.screen-head {
  display: flex; align-items: center; justify-content: space-between; padding: 1.6vw 3vw;
  background: var(--green-dark); color: var(--cream); font-size: 1.5vw;
}
.screen-head .brand img { width: 2.6vw; height: 2.6vw; }
.screen-head .brand small { color: var(--sage); }
.screen-main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 2vw 5vw 3vw; min-height: 0; }
.screen-foot { padding: 0 3vw 1.2vw; color: var(--muted); font-size: 1.1vw; display: flex; justify-content: space-between; }
.s-kicker { font-size: 1.6vw; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .08em; }
.s-title { font-size: 4.6vw; font-weight: 700; line-height: 1.08; margin: .6vw 0 1.4vw; }
.s-q { font-size: 2.3vw; font-weight: 600; line-height: 1.25; color: var(--green-dark); margin-bottom: 2.2vw; max-width: 80vw; }
.s-timer { font-size: 13vw; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: var(--green-dark); }
.s-timer.low { color: var(--warn); }
.s-timer.over { color: var(--danger); font-size: 7vw; }
.s-people { display: flex; gap: 2.5vw; margin-top: 3vw; }
.s-person { flex: 1; background: var(--white); border-radius: 1.4vw; padding: 1.6vw 2vw; font-size: 2.6vw; font-weight: 700; display: flex; justify-content: space-between; align-items: center; transition: background .3s; }
.s-person.done { background: var(--sage); }
.s-answer { background: var(--white); border-radius: 1.6vw; padding: 3vw 3.4vw; font-size: 3.2vw; line-height: 1.3; font-weight: 500; box-shadow: 0 .4vw 0 var(--beige); }
.s-answer .part-label { display: block; font-size: 1.5vw; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4vw; }
.s-answer .part + .part { margin-top: 2vw; }
.s-who { margin-top: 2.4vw; display: flex; align-items: center; gap: 2vw; font-size: 2.6vw; font-weight: 700; }
.s-who .tag { background: var(--green); color: var(--white); padding: .6vw 2vw; border-radius: 999px; animation: pop .35s ease-out; }
.s-who .ask { color: var(--green); }
.s-relance { margin-top: 1.4vw; font-size: 2vw; color: var(--muted); }
.s-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2vw; }
.s-col { background: var(--white); border-radius: 1.4vw; padding: 1.8vw; }
.s-col h3 { margin: 0 0 1vw; font-size: 2.4vw; }
.s-col ol { margin: 0; padding-left: 0; list-style: none; counter-reset: r; }
.s-col li { counter-increment: r; font-size: 2vw; padding: .8vw 1vw; border-radius: .8vw; margin-bottom: .6vw; display: flex; gap: 1vw; align-items: center; transition: background .3s; }
.s-col li::before { content: counter(r); font-weight: 700; color: var(--green); min-width: 1.6vw; }
.s-col li.common { background: var(--sage); font-weight: 700; }
.s-col li.uniq { background: var(--cream); }
.s-summary { margin-top: 2vw; display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; font-size: 1.7vw; }
.s-summary h4 { margin: 0 0 .6vw; font-size: 1.5vw; text-transform: uppercase; letter-spacing: .06em; color: var(--green); }
.s-ab { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5vw; }
.s-ab .opt { background: var(--white); border-radius: 1.6vw; padding: 2.4vw; min-height: 22vw; }
.s-ab .opt.win { box-shadow: inset 0 0 0 .4vw var(--green); }
.s-ab .opt h3 { margin: 0 0 1.6vw; font-size: 2.8vw; line-height: 1.2; }
.s-ab .opt .names { display: flex; flex-wrap: wrap; gap: 1vw; margin: 0; }
.s-ab .opt .names span { background: var(--green); color: #fff; padding: .6vw 1.8vw; border-radius: 999px; font-size: 2.4vw; font-weight: 700; }
.s-banner { margin-top: 2vw; font-size: 2.6vw; font-weight: 700; color: var(--green-dark); background: var(--sage); border-radius: 1.4vw; padding: 1.4vw 2.4vw; display: inline-block; }
.s-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5vw; text-align: center; }
.s-numbers div { background: var(--white); border-radius: 1.6vw; padding: 2.4vw; }
.s-numbers .v { font-size: 10vw; font-weight: 700; color: var(--green-dark); line-height: 1; }
.s-numbers .n { font-size: 2.6vw; font-weight: 700; margin-top: 1vw; }
.s-portrait { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5vw; }
.s-portrait .col { background: var(--white); border-radius: 1.6vw; padding: 2.4vw; }
.s-portrait h3 { margin: 0 0 1.4vw; font-size: 2vw; color: var(--muted); }
.s-portrait li { font-size: 2.6vw; margin-bottom: 1vw; line-height: 1.25; }
.s-join { font-size: 2.2vw; line-height: 1.5; }
.s-join b { color: var(--green-dark); font-size: 3vw; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.fade-in { animation: fade .35s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(1vw); } to { opacity: 1; transform: none; } }

/* ---------- Récap ---------- */
.recap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; }
.recap h2 { margin-top: 36px; color: var(--green-dark); }
.recap .rq { background: var(--white); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.recap .rq h3 { margin: 0 0 4px; font-size: 18px; }
.recap .rgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.recap .rgrid > div { background: var(--cream); border-radius: 12px; padding: 12px; white-space: pre-wrap; line-height: 1.45; font-size: 15px; }
.recap .rgrid b { display: block; margin-bottom: 4px; color: var(--green-dark); white-space: normal; }
.recap .rgrid small { display: block; color: var(--muted); margin-top: 6px; }
.recap .synth { margin-top: 10px; font-size: 15px; background: var(--sage-light); border-radius: 12px; padding: 10px 12px; }
@media (max-width: 760px) { .recap .rgrid { grid-template-columns: 1fr; } }

@media (max-width: 480px) { .topbar .brand > span { display: none; } .topbar .brand small { font-size: 16px; font-weight: 700; color: var(--ink); } }
