/* Charte Lideo (reprise du site événementiel) : framboise #d60b52 et ardoise #545967 du logo, encre #151627. */
@font-face {
  font-family: "Urbanist";
  src: url("/assets/urbanist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --brand: #d60b52;
  --brand-dark: #b00943;
  --brand-soft: #fbe7ef;
  --ink: #151627;
  --muted: #545967;
  --line: #e2e3ea;
  --bg: #f2f2f5;
  --surface: #ffffff;
  --ok: #17794a;
  --warn: #9a5b00;
  --danger: #b3261e;
  --track: #ebecf1;
  --w0: #d60b52; --w1: #545967; --w2: #151627; --w3: #b00943; --w4: #8b91a0;
}
:root.dark {
  --ink: #eef0f6;
  --muted: #a7abbd;
  --line: #2c2e41;
  --bg: #11121c;
  --surface: #1a1b29;
  --brand: #ff5a91;
  --brand-soft: #3a1527;
  --track: #2c2e41;
  --w0: #ff5a91; --w1: #eef0f6; --w2: #a7abbd; --w3: #ff8fb3; --w4: #d60b52;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Urbanist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: .92em; }
.brand { display: inline-flex; align-items: center; gap: .55em; font-weight: 800; letter-spacing: .02em; color: var(--brand); text-decoration: none; text-transform: uppercase; font-size: .8rem; }
.brand img { height: 28px; width: auto; display: block; }
.logo { display: inline-block; }
.logo img { height: 100%; width: auto; display: block; }
.logo .logo-dark, :root.dark .logo .logo-light { display: none; }
:root.dark .logo .logo-dark { display: block; }

/* ---------- Éléments de formulaire ---------- */
.input {
  width: 100%; padding: .7em .85em; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px;
}
.input:focus-visible, .btn:focus-visible, .option:focus-visible, .num:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px;
}
.input.big { font-size: 1.35rem; text-align: center; padding: .8em; }
textarea.input { resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .65em 1.1em; font: inherit; font-weight: 600; color: var(--ink); text-decoration: none;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .4em .7em; font-size: .86rem; border-radius: 8px; }
.btn.block { display: flex; width: 100%; }
.danger-text { color: var(--danger); }
.form-error { color: var(--danger); font-weight: 600; font-size: .92em; }
.form-error:empty { display: none; }
.field { display: flex; flex-direction: column; gap: .3em; font-size: .88rem; font-weight: 600; color: var(--muted); flex: 1; min-width: 0; }
.field .input { font-weight: 400; font-size: 1rem; }
.check { display: flex; align-items: center; gap: .55em; font-size: .95rem; }
.check input { width: 1.15em; height: 1.15em; accent-color: var(--brand); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; display: flex; flex-direction: column; gap: .9rem; }
.card.narrow { max-width: 380px; margin: 12vh auto 0; }
.row { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; }
.card.row { flex-direction: row; align-items: center; }
.card.row .input { flex: 1; min-width: 220px; }
.stack { display: flex; flex-direction: column; gap: .9rem; }

/* ---------- Résultats (partagés) ---------- */
.results { min-height: 0; }
.results-choice { display: flex; flex-direction: column; justify-content: safe center; gap: .7em; }
.bar-row { display: grid; grid-template-columns: minmax(6em, 32%) 1fr 6.2em; align-items: center; gap: .8em; }
.bar-label { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.bar-track { height: 1.9em; background: var(--track); border-radius: .45em; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--muted); border-radius: .45em; opacity: .5; transition: width .5s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
.bar-row.is-top .bar-fill { opacity: 1; background: var(--brand); }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 700; white-space: pre; }

.results-scale { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2em; }
.scale-avg { display: flex; flex-direction: column; align-items: center; }
.scale-avg-n { font-size: 3.6em; font-weight: 800; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.scale-avg-l { color: var(--muted); font-size: .9em; margin-top: .3em; }
.scale-chart { display: flex; flex-direction: column; gap: .4em; height: 100%; min-height: 9em; }
.scale-cols { flex: 1; display: flex; align-items: stretch; gap: .6em; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25em; min-width: 0; }
.col-n { height: 1.3em; font-weight: 700; font-variant-numeric: tabular-nums; }
.col-track { flex: 1; width: 100%; max-width: 5em; display: flex; align-items: flex-end; background: var(--track); border-radius: .45em; overflow: hidden; min-height: 4em; }
.col-fill { width: 100%; height: 0; background: var(--brand); border-radius: .45em .45em 0 0; transition: height .5s cubic-bezier(.2, .8, .2, 1); }
.col-v { font-weight: 700; }
.scale-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: .85em; gap: 1em; }

.results-wordcloud { display: flex; flex-wrap: wrap; align-items: center; align-content: safe center; justify-content: center; gap: .15em .7em; overflow: hidden; line-height: 1.1; }
.word { font-weight: 800; overflow-wrap: anywhere; animation: pop .35s ease-out; }
.word.c0 { color: var(--w0); } .word.c1 { color: var(--w1); } .word.c2 { color: var(--w2); } .word.c3 { color: var(--w3); } .word.c4 { color: var(--w4); }

.results-open { display: grid; grid-template-columns: repeat(auto-fill, minmax(13em, 1fr)); gap: .6em; align-content: start; overflow: hidden; }
.card-answer { background: var(--brand-soft); border-radius: .7em; padding: .6em .8em; overflow-wrap: anywhere; font-size: .95em; animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.results.is-empty::after { content: "En attente des premières réponses…"; color: var(--muted); grid-column: 1 / -1; text-align: center; align-self: center; width: 100%; }

.results-hidden { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em; }
.hidden-n { font-size: 3em; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.hidden-l { color: var(--muted); }

/* ---------- Écran de projection / complément PowerPoint ---------- */
/* Toute la scène est dimensionnée en rem, et le rem suit la taille du cadre : la vue reste lisible
   quelle que soit la taille donnée au complément dans la diapositive. */
html.stage-root { font-size: min(2.05vw, 3.65vh); height: 100%; }
html.stage-root body { height: 100%; overflow: hidden; background: var(--surface); }
#root { height: 100%; }
.stage { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: 1fr 12.5rem; gap: 1.6rem; padding: 1.6rem 1.8rem; position: relative; }
.stage.no-join { grid-template-columns: 1fr; }
.stage.no-join .st-join { display: none; }
.st-main { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; min-height: 0; }
.st-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -.015em; }
.st-meta { display: flex; align-items: center; gap: .8rem; margin-top: .5rem; color: var(--muted); font-size: .85rem; }
.st-status { padding: .15em .7em; border-radius: 99px; background: var(--track); font-weight: 700; }
.st-status.is-live { background: var(--ok); color: #fff; }
.st-status.is-live::before { content: "● "; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.st-main .results { flex: 1; font-size: 1.05rem; overflow: hidden; }
.st-main .results-wordcloud { font-size: 1.25rem; }
.st-join { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .3rem; padding: .8rem; background: var(--brand-soft); border-radius: 1.1rem; overflow: hidden; }
.st-join .logo { height: 1.9rem; margin-bottom: .3rem; }
.st-wtext .logo { height: 3.3rem; margin-bottom: 1.1rem; }
.st-join-l { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.st-qr { width: 100%; max-width: 9rem; aspect-ratio: 1; background: #fff; border-radius: .6rem; padding: .35rem; }
.st-url { font-weight: 700; font-size: .82rem; overflow-wrap: anywhere; }
.st-code-l { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: .2rem; }
.st-code { font-size: 1.75rem; font-weight: 800; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--brand); line-height: 1; }
.st-count { margin-top: .35rem; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.st-connected { font-size: .72rem; color: var(--muted); }
.st-welcome { display: none; }
.stage.is-welcome { grid-template-columns: 1fr; }
.stage.is-welcome .st-main, .stage.is-welcome .st-join { display: none; }
.stage.is-welcome .st-welcome { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3rem; padding: 0 2rem; }
.st-wtitle { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; }
.st-wlead { font-size: 1.15rem; margin-top: .7rem; color: var(--muted); }
.st-wor { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.st-wtext .st-url { font-size: 1.5rem; }
.st-wtext .st-code { font-size: 2.8rem; margin-top: .15rem; }
.st-wconnected { margin-top: 1rem; font-weight: 700; }
.st-welcome .st-qr { width: 18rem; max-width: none; padding: .8rem; border-radius: 1.2rem; box-shadow: 0 0 0 .35rem var(--brand-soft); }
.st-offline { position: absolute; left: 50%; bottom: .8rem; transform: translateX(-50%); background: var(--danger); color: #fff; padding: .3em 1em; border-radius: 99px; font-size: .8rem; font-weight: 700; }

/* Habillage avec image de fond : les résultats sont posés sur un panneau légèrement opaque pour rester lisibles. */
html.has-bg body { background-size: cover; background-position: center; background-repeat: no-repeat; }
html.has-bg .st-main { background: color-mix(in srgb, var(--surface) 82%, transparent); border-radius: 1.1rem; padding: 1.2rem 1.4rem; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
html.has-bg .st-join { background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
html.has-bg .st-welcome .st-qr { box-shadow: 0 1rem 3rem rgba(0, 0, 0, .35); }
html.has-bg.dark .st-wlead, html.has-bg.dark .st-wor { color: #dfe1ec; }
html.has-bg .addin-config { background: var(--surface); }

.addin-gear { position: fixed; top: .5rem; right: .5rem; font: inherit; font-size: 12px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; opacity: .55; }
.addin-gear:hover { opacity: 1; }
.addin-config { font-size: clamp(13px, .75rem, 17px); max-width: 46em; margin: 0 auto; padding: 1.4em; display: flex; flex-direction: column; gap: .9em; height: 100%; overflow: auto; }
.addin-row { display: flex; gap: .7em; align-items: flex-end; }
.addin-step2 { display: flex; flex-direction: column; gap: .8em; }
.addin-ok { font-weight: 700; color: var(--ok); }

/* ---------- Téléphone des participants ---------- */
body.phone { min-height: 100dvh; display: flex; flex-direction: column; font-size: 17px; }
.phone-head { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; padding-top: max(.9rem, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
#session-title { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 1.1rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.q { font-size: 1.35rem; }
.options { display: flex; flex-direction: column; gap: .6rem; }
.option, .num {
  font: inherit; font-weight: 600; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer; text-align: left;
}
.option { padding: .95em 1em; min-height: 52px; overflow-wrap: anywhere; }
.option[aria-pressed="true"], .num[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); gap: .45rem; }
.num { text-align: center; padding: .8em 0; min-height: 52px; font-size: 1.1rem; }
.phone .scale-ends { margin-top: .5rem; }
.sent { color: var(--ok); font-weight: 600; margin-top: .6rem; font-size: .95rem; }
.msg { margin: auto; text-align: center; display: flex; flex-direction: column; gap: .6rem; padding: 2rem 1rem; color: var(--muted); }
.msg h2 { color: var(--ink); }
.msg-icon { font-size: 3rem; }

/* ---------- Console d'administration ---------- */
.admin-head { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-head .btn { margin-left: auto; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1.2rem; }
.list { display: flex; flex-direction: column; gap: .6rem; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; }
.list-item:hover { border-color: var(--brand); }
.code-pill { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand); background: var(--brand-soft); padding: .3em .8em; border-radius: 99px; white-space: nowrap; }
.back { text-decoration: none; font-weight: 600; font-size: .92rem; }
.session-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.2rem; align-items: start; }
.side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
.q-list { display: flex; flex-direction: column; gap: .9rem; }
.q-card { background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 1.1rem; display: flex; flex-direction: column; gap: .9rem; }
.q-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.q-top { display: flex; gap: .8rem; align-items: flex-start; }
.q-num { flex: none; width: 2em; height: 2em; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.q-title { min-width: 0; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.badge { font-size: .76rem; font-weight: 700; padding: .15em .65em; border-radius: 99px; background: var(--track); color: var(--muted); }
.badge.live { background: var(--brand); color: #fff; }
.badge.ok { background: #dff3e8; color: var(--ok); }
.badge.warn { background: #fdeccf; color: var(--warn); }
.q-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.q-card .results { font-size: .9rem; }
.q-card .results-wordcloud, .q-card .results-open { max-height: 16em; overflow: auto; }
.q-card .word, .q-card .card-answer { cursor: pointer; }
.q-card .word:hover, .q-card .card-answer:hover { text-decoration: line-through; }
.q-card .scale-chart { height: 11em; }
.qr-small { width: 150px; height: 150px; align-self: center; }
.kv { display: flex; justify-content: space-between; gap: .8rem; align-items: baseline; font-size: .9rem; }
.kv span { color: var(--muted); }
.kv code { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; text-align: right; user-select: all; }
.steps { margin: 0; padding-left: 1.2em; font-size: .9rem; display: flex; flex-direction: column; gap: .35rem; }
.dialog { border: none; border-radius: 16px; padding: 1.4rem; width: min(520px, calc(100vw - 2rem)); color: var(--ink); background: var(--surface); box-shadow: 0 20px 60px rgba(10, 20, 60, .3); }
.dialog::backdrop { background: rgba(10, 20, 60, .45); }
.dialog > p { margin-bottom: 1.1rem; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; }
@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .side { position: static; }
  .admin-main { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
