/* Adaptations "écran réel" par-dessus style.css (les maquettes avaient des tailles fixes). */
html, body { margin: 0; min-height: 100%; }
body.qz { min-height: 100dvh; }

/* Participant : colonne centrée, pleine hauteur sur mobile, largeur bornée sur PC */
.app { min-height: 100dvh; display: flex; flex-direction: column; width: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); }
@media (min-width: 700px) { .app { max-width: 880px; } .app .q-title { font-size: 28px; } .app .p-body { padding: 32px 24px; } }
.p-body { flex: 1; }
.p-foot { position: sticky; bottom: 0; }

/* Projection : remplit la fenêtre, proportions 16:9 conservées par le viewport */
.proj.fill { width: 100vw; height: 100dvh; padding: 2.5vh 4vw; gap: 2.5vh; }
.proj.fill .proj-q { font-size: clamp(28px, 4.2vw, 60px); }
.proj.fill .popt { font-size: clamp(22px, 2.6vw, 42px); min-height: 12vh; }
.proj.fill .roomcode { font-size: clamp(90px, 14vw, 220px); }
.proj.fill .code-lg { font-size: clamp(18px, 2vw, 32px); }
.qr img, .qr canvas { display: block; width: 100%; height: 100%; }

/* Admin */
.admin { min-height: 100dvh; }
.qitem { cursor: pointer; }
.qitem:hover { background: var(--surface-2); }
.thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.thumb iframe { width: 1600px; height: 900px; border: 0; transform-origin: 0 0; pointer-events: none; }

/* Écran d'entrée (participant) et de connexion (admin) : carte centrée */
.app.is-entry { max-width: none; }
.entry { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.entry-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 28px; }
.entry-head { display: flex; flex-direction: column; gap: 8px; }
.entry-head .q-title { font-size: 30px; }
.entry-head .hint { font-size: 16px; }
.entry-form { display: flex; flex-direction: column; gap: 20px; }
.entry-form .btn-lg { margin-top: 4px; }
.entry-note { text-align: center; font-size: 13px; }
/* même hauteur pour tous les champs ; le code garde sa police mono espacée */
.entry .input, .entry .input-code { height: 56px; }
.entry .input-code { font-size: 24px; letter-spacing: .2em; text-indent: .2em; }
.entry .input-code::placeholder { color: var(--line-strong); }
.room-chip .link-btn { margin-left: auto; flex: none; white-space: nowrap; padding: 8px 0; border: 0; background: none; font: 600 14px/1 var(--font); color: var(--accent-text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 700px) {
  .entry-card { padding: 36px 36px 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 1px 2px rgba(13, 43, 78, .04), 0 8px 24px rgba(13, 43, 78, .06); }
}

/* Lien de la salle sur l'écran d'attente projeté */
.join-link { display: inline-flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.join-link a { font: 700 44px/1 var(--mono); color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.join-link a:hover { color: var(--brand); text-decoration-color: var(--brand); }
.copy-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font: 600 16px/1 var(--font); cursor: pointer; }
.copy-btn:hover { border-color: var(--brand); }
.copy-btn.is-done { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }

/* QCM à plusieurs réponses : case à cocher à droite de chaque option */
.opt-check { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.opt-check .ic { width: 18px; height: 18px; stroke-width: 3; }
.opt.is-selected .opt-check { background: var(--sel); border-color: var(--sel); color: var(--sel-ink); }

/* Liste des salles (/admin) */
.rooms-grid .a-main { flex-basis: 640px; }
.room-code { display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none; }
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.rooms-tbl td { vertical-align: middle; }
/* Dossiers de salles (écran Mes salles) */
details.dossier > summary { cursor: pointer; list-style: none; }
details.dossier > summary::-webkit-details-marker { display: none; }
details.dossier > summary h2 { display: inline-flex; align-items: center; gap: 8px; }
details.dossier > summary h2::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .15s; }
details.dossier[open] > summary h2::before { transform: rotate(90deg); }
details.dossier:not([open]) > summary { border-bottom: 0; }
details.dossier [data-deldir] { color: var(--ko); margin-left: 8px; }
details.dossier > summary h2 { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.rooms-tbl td:nth-child(2) { white-space: normal; min-width: 180px; }
.rooms-tbl .row-actions .btn { padding-left: 10px; padding-right: 10px; }
.rooms-grid .input:not(.input-code) { font-size: 15px; font-weight: 500; }
.rooms-tbl [data-del] { color: var(--ko); }
a.btn { text-decoration: none; }

/* Boutons de pilotage (admin) : actions de question en haut, actions de session en dessous */
.ctrls { align-items: center; }
.ctrls .ctrls-main { margin-left: auto; }
.ctrls-session { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 12px; }
.ctrls-session .muted { font: 700 11px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; margin-right: 4px; }
.btn-danger { color: var(--ko); }
.btn-danger:hover:not([disabled]) { border-color: var(--ko); }

/* Mise en forme des textes de questions (`code`, **gras**, blocs ```) */
.md-code { padding: .08em .35em; border-radius: var(--r-sm); background: var(--brand-soft); color: var(--ink); font-family: var(--mono); font-size: .9em; }
.md-pre { margin: .5em 0 0; padding: .7em .9em; border: 1px solid var(--line); border-radius: var(--r); background: var(--code-bg); color: var(--code-ink); font: 500 .8em/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; letter-spacing: 0; }
.q-title .md-pre, .proj-q .md-pre { font-weight: 500; }
.proj .md-pre { background: var(--surface-2); }
.opt-label .md-pre, .popt-label .md-pre { margin: 0; }
.explain .md-pre { font-size: .85em; }
/* Coloration du code (questions, propositions, explications) */
.hl-k { color: #7c3aed; font-weight: 600; }
.hl-s { color: #047857; }
.hl-t { color: #1d4ed8; }
.hl-n { color: #b45309; }
.hl-c { color: #6b7280; font-style: italic; }
.tv .hl-k { color: #c4b5fd; } .tv .hl-s { color: #6ee7b7; } .tv .hl-t { color: #93c5fd; } .tv .hl-n { color: #fcd34d; } .tv .hl-c { color: #9ca3af; }

/* Bilan de fin de session — projection */
.bilan-top { display: flex; align-items: flex-end; justify-content: space-between; }
.bilan { gap: 56px; }
.bilan-left { flex: 0 0 46%; min-width: 0; display: flex; flex-direction: column; gap: 4vh; }
.bilan-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.bilan-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bilan-kpi { padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.bilan-kpi b { display: block; font: 700 clamp(32px, 3.4vw, 54px)/1.05 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.bilan-kpi b small { font-size: .5em; font-weight: 600; color: var(--muted); }
.bilan-kpi span { font: 600 clamp(15px, 1.3vw, 20px)/1.3 var(--font); color: var(--muted); }
.bilan-kpi.ok b { color: var(--ok); }
.bilan-h { margin: 0; font: 700 clamp(13px, 1.1vw, 17px)/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bilan-dist { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.bilan-histo { --hh: auto; flex: 1; min-height: 160px; height: auto; --hg: 14px; }
.bilan-histo .histo-bar { background: var(--brand); max-width: 90px; }
.bilan-histo .histo-col.is-correct .histo-bar { background: var(--ok); }
.bilan-histo .histo-key { width: 40px; height: 40px; font-size: 18px; }
.bilan-histo .histo-val { font-size: 20px; }
.bilan-axis { margin: 0; text-align: center; font: 500 15px/1 var(--font); color: var(--muted); }
.bilan-q { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 16px); }
.bilan-q li { display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(160px, 38%); align-items: center; gap: 14px; }
.bilan-q-t { font: 600 clamp(15px, 1.35vw, 21px)/1.3 var(--font); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bilan-q .rate-val { font-size: clamp(14px, 1.2vw, 19px); }

/* Bilan de fin de session — participant */
.recap .panel-h { padding: 10px 14px; }
.recap-list { list-style: none; margin: 0; padding: 6px 14px 12px; display: flex; flex-direction: column; }
.recap-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recap-list li:last-child { border-bottom: 0; }
.recap-t { font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap-s { font: 600 12px/1 var(--font); color: var(--muted); }
.recap-s.ok { color: var(--ok); } .recap-s.part { color: var(--part); } .recap-s.ko { color: var(--ko); }

/* Divers */
.hidden { display: none !important; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; border-radius: var(--r); background: var(--ko); color: #fff; font: 600 14px/1 var(--font); z-index: 9; }
.gap-select option { color: #0D2B4E; }
.term, .target, .opt, .btn { -webkit-tap-highlight-color: transparent; }
.score-tbl .dqs { display: inline-flex; }

/* Logo de la marque de la session (OF) : remplace le logo JEHC sur les écrans participant et projection */
.logo-marque img { height: 34px; width: auto; display: block; }
.proj-head .logo-marque img { height: 52px; }
