:root {
  --navy: #1F2A44; --navy-2: #2A3756; --teal: #2E7D8C; --teal-2: #256876; --coral: #E8833A; --coral-2: #D0702A;
  --pale: #EEF4F5; --pale-2: #D9E6E8; --ink: #1B2333; --muted: #5A6270; --line: #D5DDE0;
  --ok: #2E8C5A; --ok-bg: #E3F3EA; --ko: #C8463A; --ko-bg: #FBE7E4; --white: #FFFFFF;
  --radius: 14px; --shadow: 0 2px 10px rgba(31, 42, 68, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--pale); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--navy); }
p { margin: 0 0 .75em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 0; border-radius: 12px; padding: .8em 1.2em; font-weight: 650; background: var(--teal); color: var(--white); transition: background .15s, transform .05s; min-height: 48px; }
.btn:hover { background: var(--teal-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.coral { background: var(--coral); } .btn.coral:hover { background: var(--coral-2); }
.btn.navy { background: var(--navy); } .btn.navy:hover { background: var(--navy-2); }
.btn.ghost { background: var(--white); color: var(--navy); border: 1.5px solid var(--line); }
.btn.ghost:hover { background: var(--pale); }
.btn.danger { background: var(--white); color: var(--ko); border: 1.5px solid #EBC3BD; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: .45em .9em; font-size: .9rem; border-radius: 10px; }

/* ---------- Champs ---------- */
label.f { display: block; font-weight: 650; margin: 1em 0 .35em; color: var(--navy); }
.hint { font-size: .85rem; color: var(--muted); margin: -.15em 0 .45em; }
input[type=text], input[type=url], input[type=password], select, textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: .75em .9em; background: var(--white); min-height: 48px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(46, 125, 140, .25); border-color: var(--teal); }
.chips { display: flex; flex-wrap: wrap; gap: .5em; }
.chip { border: 1.5px solid var(--line); background: var(--white); border-radius: 999px; padding: .5em 1em; font-weight: 600; min-height: 42px; }
.chip.on { background: var(--teal); border-color: var(--teal); color: var(--white); }
.scale { display: flex; gap: .4em; }
.scale button { flex: 1; min-height: 46px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--white); font-weight: 700; }
.scale button.on { background: var(--teal); border-color: var(--teal); color: var(--white); }
.scale-legend { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-top: .25em; }

/* ---------- Cartes ---------- */
.card { background: var(--white); border-radius: var(--radius); padding: 1.25em; box-shadow: var(--shadow); margin-bottom: 1em; }
.card.pale { background: var(--pale); box-shadow: none; }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: .4em; border-radius: 999px; padding: .3em .8em; font-size: .8rem; font-weight: 700; background: var(--pale-2); color: var(--navy); }
.pill.coral { background: var(--coral); color: var(--white); }
.pill.teal { background: var(--teal); color: var(--white); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- Participant ---------- */
.p-top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: var(--white); display: flex; align-items: center; justify-content: space-between; padding: .7em 1em; gap: .75em; }
.p-top .brand { font-weight: 800; letter-spacing: .02em; }
.p-top .brand span { color: var(--coral); }
.p-top .me { display: flex; align-items: center; gap: .5em; font-weight: 650; font-size: .95rem; }
.p-top .pts { background: var(--coral); color: var(--white); padding: .25em .7em; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.p-main { max-width: 640px; margin: 0 auto; padding: 1em 1em 6.5em; }
.p-tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--white); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.p-tabs button { border: 0; background: none; padding: .85em .3em; font-weight: 700; color: var(--muted); font-size: .9rem; min-height: 56px; }
.p-tabs button.on { color: var(--teal); box-shadow: inset 0 3px 0 var(--teal); }
.big-title { font-size: 1.6rem; }
.hero { text-align: center; padding: 2em 1em; }
.hero .emoji { font-size: 3rem; display: block; margin-bottom: .3em; }

.timer { height: 10px; background: var(--pale-2); border-radius: 999px; overflow: hidden; margin: .5em 0 1em; }
.timer > div { height: 100%; background: var(--teal); transition: width .25s linear; }
.timer.low > div { background: var(--coral); }
.timer-txt { font-weight: 800; font-variant-numeric: tabular-nums; }

.opts { display: grid; gap: .6em; }
.opt { text-align: left; border: 1.5px solid var(--line); background: var(--white); border-radius: 12px; padding: .9em 1em; font-weight: 600; min-height: 56px; }
.opt:hover:not(:disabled) { border-color: var(--teal); }
.opt.mine { border-color: var(--navy); background: var(--pale); box-shadow: inset 0 0 0 1.5px var(--navy); }
.opt.good { border-color: var(--ok); background: var(--ok-bg); color: #1d5e3b; }
.opt.bad { border-color: var(--ko); background: var(--ko-bg); color: #8e2c23; }
.opt:disabled { cursor: default; }

.feedback { border-radius: 12px; padding: .9em 1em; margin-top: 1em; font-weight: 600; }
.feedback.ok { background: var(--ok-bg); color: #1d5e3b; }
.feedback.ko { background: var(--ko-bg); color: #8e2c23; }
.feedback.info { background: var(--pale-2); color: var(--navy); }

.ia-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .75em; padding: .8em 0; border-bottom: 1px solid var(--line); }
.ia-item:last-child { border-bottom: 0; }
.ia-item .lbl { font-weight: 650; }
.ia-item .why { grid-column: 1 / -1; font-size: .875rem; color: var(--muted); margin-top: -.3em; }
.duo { display: flex; gap: .4em; }
.duo button { border: 1.5px solid var(--line); background: var(--white); border-radius: 10px; padding: .5em .8em; font-weight: 700; min-height: 44px; min-width: 70px; }
.duo button.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.duo button.good { background: var(--ok); color: var(--white); border-color: var(--ok); }
.duo button.bad { background: var(--ko); color: var(--white); border-color: var(--ko); }

.jg-grid { display: grid; gap: .5em; }
.jg-word { border: 1.5px solid var(--line); background: var(--white); border-radius: 10px; padding: .6em .8em; font-weight: 700; min-height: 46px; }
.jg-word.sel { background: var(--navy); color: var(--white); border-color: var(--navy); }
.jg-word.done { background: var(--ok-bg); border-color: var(--ok); color: #1d5e3b; text-decoration: line-through; }
.jg-def { text-align: left; border: 1.5px solid var(--line); background: var(--white); border-radius: 10px; padding: .7em .9em; min-height: 48px; }
.jg-def.shake { animation: shake .35s; border-color: var(--ko); background: var(--ko-bg); }
.jg-words { display: flex; flex-wrap: wrap; gap: .45em; margin-bottom: 1em; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.pz-pool, .pz-order { display: grid; gap: .5em; }
.pz-block { display: flex; align-items: center; gap: .75em; text-align: left; border: 1.5px solid var(--line); background: var(--white); border-radius: 12px; padding: .7em .9em; font-weight: 650; min-height: 54px; width: 100%; }
.pz-block .l { flex: none; width: 2em; height: 2em; border-radius: 50%; background: var(--navy); color: var(--white); display: grid; place-items: center; font-weight: 800; }
.pz-block.placed .l { background: var(--teal); }
.pz-block.good { border-color: var(--ok); background: var(--ok-bg); }
.pz-block.bad { border-color: var(--ko); background: var(--ko-bg); }
.pz-slot { border: 1.5px dashed var(--line); border-radius: 12px; min-height: 54px; display: flex; align-items: center; padding: 0 .9em; color: var(--muted); }

.fam { display: grid; gap: .5em; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: .75em 1.2em; border-radius: 12px; font-weight: 700; z-index: 50; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.toast.ok { background: var(--ok); } .toast.ko { background: var(--ko); }

.step-head { display: flex; align-items: center; justify-content: space-between; gap: .5em; }
.step-head h2 { margin: 0; font-size: 1.15rem; }
.step-card.current { box-shadow: 0 0 0 3px var(--coral), var(--shadow); }
.task { border: 1.5px solid var(--line); border-radius: 12px; padding: .2em 1em 1em; margin-top: 1em; }
.task h3 { font-size: 1rem; margin: .8em 0 0; }
.result-box { white-space: pre-wrap; background: var(--pale); border-radius: 12px; padding: 1em; margin-top: .75em; font-size: .95rem; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--pale-2); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.roster { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; }
.roster button { min-height: 64px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white); font-weight: 700; font-size: 1.05rem; }
.roster button:hover { border-color: var(--teal); }
.mini-flow { display: flex; align-items: center; gap: .4em; flex-wrap: wrap; font-weight: 650; font-size: .9rem; }
.mini-flow span.m { background: var(--pale-2); padding: .35em .7em; border-radius: 8px; }

/* ---------- Formateur ---------- */
body.trainer { background: #F4F7F8; }
.t-top { background: var(--navy); color: var(--white); display: flex; align-items: center; justify-content: space-between; padding: .6em 1.2em; gap: 1em; position: sticky; top: 0; z-index: 20; }
.t-top .brand { font-weight: 800; font-size: 1.05rem; }
.t-top .brand span { color: var(--coral); }
.t-top nav { display: flex; gap: .4em; flex-wrap: wrap; }
.t-top nav button { background: transparent; color: #C9D3E0; border: 0; padding: .55em .9em; border-radius: 9px; font-weight: 650; }
.t-top nav button.on, .t-top nav button:hover { background: var(--navy-2); color: var(--white); }
.t-layout { display: grid; grid-template-columns: 290px 1fr; min-height: calc(100vh - 56px); }
.t-side { background: var(--white); border-right: 1px solid var(--line); padding: 1em; overflow-y: auto; }
.t-side h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2em 0 .5em; }
.act-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: .6em .7em; border-radius: 9px; font-weight: 600; gap: .5em; }
.act-btn:hover { background: var(--pale); }
.act-btn.on { background: var(--teal); color: var(--white); }
.act-btn .h { font-size: .78rem; opacity: .7; white-space: nowrap; }
.side-part { display: flex; justify-content: space-between; padding: .35em .2em; font-size: .92rem; border-bottom: 1px solid var(--pale); }
.t-main { padding: 1.2em 1.5em 3em; overflow-x: hidden; }
.controls { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; background: var(--white); border-radius: var(--radius); padding: .8em 1em; box-shadow: var(--shadow); margin-bottom: 1em; }
.controls .lbl { font-weight: 700; color: var(--navy); margin-right: .5em; }
.stage { background: var(--white); border-radius: 18px; box-shadow: var(--shadow); padding: 2em; min-height: 62vh; }
.stage h1 { font-size: 2.1rem; }
.stage .sub { font-size: 1.15rem; color: var(--muted); }

.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .3em 1em; padding: 1.5em 0; }
.cloud span { font-weight: 800; line-height: 1.1; }
.bars { display: grid; gap: .7em; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 32%) 1fr 70px; gap: .8em; align-items: center; font-size: 1.1rem; }
.bar-row .track { background: var(--pale); border-radius: 8px; height: 34px; overflow: hidden; }
.bar-row .fill { background: var(--teal); height: 100%; border-radius: 8px; transition: width .4s; }
.bar-row.good .fill { background: var(--ok); }
.bar-row.good .name { color: var(--ok); font-weight: 800; }
.bar-row .val { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.names { display: flex; flex-wrap: wrap; gap: .7em; justify-content: center; margin-top: 1.5em; }
.names span { background: var(--teal); color: var(--white); font-weight: 800; font-size: 1.5rem; padding: .45em 1em; border-radius: 999px; animation: pop .45s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.welcome { display: grid; grid-template-columns: 1fr auto; gap: 2em; align-items: center; }
.welcome img { width: 230px; height: 230px; border-radius: 14px; border: 8px solid var(--white); box-shadow: var(--shadow); }
.bigtimer { font-size: 3rem; font-weight: 900; color: var(--teal); font-variant-numeric: tabular-nums; }
.bigtimer.low { color: var(--coral); }
.qopts { display: grid; grid-template-columns: 1fr 1fr; gap: .8em; margin-top: 1em; }
.qopt { border: 2px solid var(--line); border-radius: 14px; padding: 1em 1.2em; font-size: 1.2rem; font-weight: 650; position: relative; overflow: hidden; background: var(--white); }
.qopt .fillbg { position: absolute; inset: 0 auto 0 0; background: var(--pale-2); z-index: 0; transition: width .4s; }
.qopt .t { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 1em; }
.qopt.good { border-color: var(--ok); }
.qopt.good .fillbg { background: #CBE9D7; }
.rank-list { display: grid; gap: .5em; max-width: 760px; margin: 1em auto 0; }
.rank-row { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 1em; background: var(--pale); border-radius: 12px; padding: .7em 1em; font-size: 1.25rem; font-weight: 700; }
.rank-row .r { width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: var(--white); display: grid; place-items: center; }
.rank-row:nth-child(1) .r { background: var(--coral); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 1.2em; margin-top: 1.5em; }
.podium .col { text-align: center; width: 190px; }
.podium .block { border-radius: 14px 14px 0 0; background: var(--teal); color: var(--white); display: grid; place-items: center; font-size: 2.6rem; font-weight: 900; }
.podium .col:nth-child(2) .block { background: var(--coral); }
.podium .name { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.podium .p { color: var(--muted); font-weight: 700; margin-bottom: .4em; }
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1em; margin-top: 1em; }
.wall .t { background: var(--pale); border-radius: 14px; padding: 1em 1.1em; }
.wall .t .d { font-weight: 750; font-size: 1.1rem; color: var(--navy); margin-bottom: .5em; }
.wall .t .m { font-size: .92rem; color: var(--muted); }
.grid-q { width: 100%; border-collapse: collapse; font-size: 1.1rem; }
.grid-q th, .grid-q td { padding: .7em; border-bottom: 1px solid var(--line); text-align: center; }
.grid-q th:first-child, .grid-q td:first-child { text-align: left; }
.dot-ok { color: var(--ok); font-weight: 900; } .dot-no { color: var(--line); font-weight: 900; }
.p-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1em; }
.p-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1em 1.1em; cursor: pointer; border: 2px solid transparent; text-align: left; width: 100%; }
.p-card:hover { border-color: var(--teal); }
.p-card .n { font-weight: 800; font-size: 1.15rem; color: var(--navy); }
.steps-dots { display: flex; gap: .3em; margin-top: .4em; }
.steps-dots i { width: 26px; height: 8px; border-radius: 4px; background: var(--pale-2); }
.steps-dots i.on { background: var(--teal); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--white); box-shadow: -10px 0 30px rgba(0,0,0,.15); z-index: 40; overflow-y: auto; padding: 1.5em; }
.drawer .qa { margin: .2em 0 .9em; }
.drawer .qa b { display: block; color: var(--navy); font-size: .88rem; }
.overlay { position: fixed; inset: 0; background: rgba(27, 35, 51, .35); z-index: 35; }
pre.json { background: var(--navy); color: #E5ECF5; padding: 1em; border-radius: 12px; overflow: auto; max-height: 420px; font-size: .82rem; }
.matrix-wrap { display: grid; grid-template-columns: minmax(380px, 640px) 1fr; gap: 1.5em; align-items: start; }
.matrix-legend { display: grid; gap: .4em; font-size: .98rem; }
.matrix-legend div { display: grid; grid-template-columns: 30px 1fr; gap: .5em; }
.matrix-legend b { background: var(--navy); color: var(--white); border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-size: .8rem; }
.auto-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 2fr; gap: 1em; align-items: center; padding: .8em 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
.login { max-width: 420px; margin: 12vh auto; }

/* ---------- Projection ---------- */
body.projection { background: var(--navy); }
body.projection .stage { min-height: 100vh; border-radius: 0; padding: 3em 4em; font-size: 1.15rem; }
body.projection .stage h1 { font-size: 2.8rem; }
body.projection .names span { font-size: 2rem; }

@media (max-width: 900px) {
  .t-layout { grid-template-columns: 1fr; }
  .t-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .qopts { grid-template-columns: 1fr; }
  .welcome { grid-template-columns: 1fr; }
  .matrix-wrap { grid-template-columns: 1fr; }
  .auto-row { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
