:root{--bg:#f3f6f8;--card:#fff;--text:#17202a;--muted:#657381;--line:#dfe6eb;--accent:#1263df;--dark:#0e2037;--red:#e53935;--blue:#1976d2;--yellow:#f9a825;--green:#2e7d32}
*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--text)}
button,input,select,textarea{font:inherit}.topbar{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:14px 24px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:10}.brand{display:flex;align-items:center;gap:10px}.brandMark{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:var(--dark);color:#fff;font-weight:900}.brand small{display:block;color:var(--muted);font-size:11px}.topbar nav{display:flex;gap:8px;flex-wrap:wrap}.topbar button,.actions button,.panel button{border:1px solid var(--line);background:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}.primary{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important;font-weight:700}.full{width:100%}
main{max-width:1180px;margin:auto;padding:28px 20px}.view{display:none}.view.active{display:block}.narrow{max-width:680px;margin:auto}.hero{display:none;grid-template-columns:1.2fr .8fr;gap:28px;align-items:center;padding-top:70px}.hero.active{display:grid}.eyebrow{text-transform:uppercase;letter-spacing:.12em;font-size:12px;font-weight:800;color:var(--accent)}h1{font-size:clamp(38px,7vw,74px);line-height:.98;margin:12px 0 18px}h2{font-size:30px;margin:6px 0 20px}h3{margin-top:0}.hero p{font-size:20px;line-height:1.5;color:var(--muted);max-width:700px}.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}.featureGrid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.featureGrid article{background:#fff;border:1px solid var(--line);padding:22px;border-radius:18px;display:flex;flex-direction:column;gap:10px}.featureGrid b{font-size:28px}.featureGrid span{color:var(--muted)}
.sectionHead{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:20px}.panel,.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:20px}.hidden{display:none!important}.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}.card h3{margin:0 0 8px}.meta{color:var(--muted);font-size:14px}.card .actions{margin-top:14px}.danger{color:#a51b1b!important;border-color:#e9b9b9!important}
label,.labelText{display:block;font-size:13px;font-weight:700;color:var(--muted);margin-bottom:6px}input,select,textarea{width:100%;border:1px solid var(--line);border-radius:10px;padding:12px;background:#fff;color:var(--text);margin-top:6px}textarea{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.formGrid{display:grid;grid-template-columns:1fr 1fr auto;gap:14px;align-items:end}
.joinLayout{display:flex;justify-content:space-between;gap:24px;align-items:center}.bigCode{font-size:64px;font-weight:900;letter-spacing:.08em}.qr{width:min(310px,45%);border-radius:14px;border:1px solid var(--line)}
.avatars{display:grid;grid-template-columns:repeat(8,1fr);gap:8px;margin:10px 0 18px}.avatarBtn{font-size:24px;padding:10px;border:2px solid transparent;background:#f0f3f6;border-radius:12px;cursor:pointer}.avatarBtn.selected{border-color:var(--accent);background:#eaf2ff}
.roomTop{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.roomCode{font-size:38px;font-weight:900}.statusPill{padding:8px 12px;border-radius:999px;background:#eef3f8;font-weight:700}.participants{display:flex;gap:8px;flex-wrap:wrap}.person{background:#fff;border:1px solid var(--line);border-radius:999px;padding:8px 12px}.questionBox{background:#fff;border:1px solid var(--line);border-radius:18px;padding:22px;margin-top:16px}.questionMedia{display:block;max-width:100%;max-height:420px;object-fit:contain;margin:16px auto;border-radius:12px}.answers{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}.answer{border:0;color:#fff;border-radius:14px;padding:16px;text-align:left;font-weight:800;min-height:76px;cursor:pointer}.answer.red{background:var(--red)}.answer.blue{background:var(--blue)}.answer.yellow{background:var(--yellow);color:#312600}.answer.green{background:var(--green)}.answer:disabled{opacity:.55;cursor:not-allowed}.symbol{font-size:24px;margin-right:8px}.timer{font-size:36px;font-weight:900}.wait{text-align:center;padding:50px 10px}.scoreBig{font-size:56px;font-weight:900}.leaderboard{display:grid;gap:8px}.leaderRow{display:grid;grid-template-columns:50px 1fr auto;align-items:center;background:#fff;border:1px solid var(--line);padding:12px 14px;border-radius:12px}.rank{font-size:22px;font-weight:900}.cloud{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:center;padding:30px}.word{font-weight:800;line-height:1}.msg{margin-top:10px;color:#9a271f}.success{color:#177245}.historyTable{width:100%;border-collapse:collapse;background:#fff}.historyTable th,.historyTable td{padding:10px;border-bottom:1px solid var(--line);text-align:left}.resultActions{display:flex;gap:8px;flex-wrap:wrap}.small{font-size:12px;color:var(--muted)}
@media(max-width:760px){.topbar{align-items:flex-start;flex-direction:column}.hero.active{grid-template-columns:1fr;padding-top:24px}.featureGrid{grid-template-columns:1fr 1fr}.formGrid{grid-template-columns:1fr}.joinLayout{flex-direction:column}.qr{width:85%;max-width:320px}.answers{grid-template-columns:1fr}.avatars{grid-template-columns:repeat(4,1fr)}.bigCode{font-size:48px}.sectionHead{align-items:flex-start;flex-direction:column}}

/* Interface élève : priorité au téléphone, lisibilité et grands contrôles */
body.student-mode{background:var(--dark);overflow-x:hidden}
body.student-mode .topbar{display:none}
body.student-mode main{max-width:none;margin:0;padding:0;background:var(--dark);min-height:100vh}
body.student-mode #student.narrow{max-width:none;width:100%;margin:0}
body.student-mode #studentContent{width:100%;min-height:100vh}
body.student-mode #student .questionBox,
body.student-mode #student .panel.wait,
body.student-mode #student>.panel{margin:0;border:0;border-radius:0;min-height:100vh;padding:clamp(18px,4vw,42px);background:var(--bg)}
body.student-mode #student .questionBox{display:flex;flex-direction:column}
body.student-mode #student .roomTop{align-items:center;margin-bottom:10px}
body.student-mode #student .eyebrow{font-size:13px}
body.student-mode #student h2{font-size:clamp(28px,7vw,48px);line-height:1.08;margin:10px 0 18px}
body.student-mode #student .timer{font-size:clamp(34px,10vw,58px);line-height:1;white-space:nowrap}
body.student-mode #student .questionMedia{width:100%;max-height:34vh;object-fit:contain;margin:8px auto 16px}
body.student-mode #student .answers{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;flex:1;align-content:stretch;margin-top:10px}
body.student-mode #student .studentAnswer{min-height:clamp(118px,24vh,230px);padding:18px;font-size:clamp(18px,4.8vw,28px);line-height:1.15;display:flex;align-items:center;justify-content:flex-start;box-shadow:0 2px 0 rgba(0,0,0,.15)}
body.student-mode #student .studentAnswer .symbol{font-size:clamp(30px,9vw,56px);min-width:1.15em;flex:0 0 auto}
body.student-mode #student form{display:flex;flex-direction:column;gap:14px;flex:1}
body.student-mode #student textarea{min-height:clamp(160px,32vh,300px);font-size:clamp(20px,5vw,30px);line-height:1.35;padding:18px;border:2px solid var(--line);border-radius:16px;resize:none}
body.student-mode #student form .primary{min-height:64px;font-size:22px;border-radius:14px}
body.student-mode #student .success{margin-top:16px;font-size:18px;font-weight:700;text-align:center}
body.student-mode #student .wait{display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}
body.student-mode #student .wait p{font-size:20px;color:var(--muted)}
body.student-mode #student .scoreBig{font-size:clamp(58px,18vw,110px)}
body.student-mode #student .leaderboard{width:min(820px,100%);margin:0 auto}
body.student-mode #student .leaderRow{font-size:clamp(16px,4vw,22px);padding:14px}
.reconnectSpinner{font-size:72px;line-height:1;animation:spin 1.1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.reconnectSpinner{animation:none}}

@media(max-width:520px){
  body.student-mode #student .questionBox,body.student-mode #student .panel.wait,body.student-mode #student>.panel{padding:16px}
  body.student-mode #student .answers{grid-template-columns:1fr 1fr;gap:10px}
  body.student-mode #student .studentAnswer{min-height:132px;padding:14px;flex-direction:column;align-items:flex-start;justify-content:center}
  body.student-mode #student .studentAnswer .symbol{margin:0 0 8px 0}
  body.student-mode #student h2{font-size:clamp(26px,7vw,36px)}
}



/* Correction manuelle des réponses libres */
.gradingPanel{margin-top:16px}.gradingHead{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}.gradingHead h3{font-size:24px;margin:4px 0 6px}.gradingHead p{margin:0;color:var(--muted)}.gradingReference{margin:14px 0;padding:12px 14px;border-radius:12px;background:#eef6ff;border:1px solid #cfe1fb}.mutedBox{background:#f7f8fa;border-color:var(--line);color:var(--muted)}.gradingList{display:grid;gap:10px}.gradingRow{display:grid;grid-template-columns:32px minmax(170px,.8fr) minmax(260px,1.6fr) 90px;gap:12px;align-items:center;margin:0;padding:13px 14px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--text);cursor:pointer}.gradingRow:hover{border-color:#b8c8d8}.gradingRow input{width:22px;height:22px;margin:0;accent-color:var(--green)}.gradingIdentity{display:flex;align-items:center;gap:9px;min-width:0}.gradingIdentity small{display:block;margin-top:2px;color:var(--muted);font-weight:400}.gradingAvatar{font-size:24px}.gradingAnswer{font-size:17px;font-weight:650;overflow-wrap:anywhere;white-space:pre-wrap}.gradingPoints{justify-self:end;font-weight:900;white-space:nowrap}.gradingRow:has(input:checked){background:#f0f8f2;border-color:#9fcca8}.gradingRow:has(input:checked) .gradingPoints{color:var(--green)}
@media(max-width:760px){.gradingHead{flex-direction:column}.gradingRow{grid-template-columns:32px 1fr auto}.gradingAnswer{grid-column:2/4;padding-top:4px}.gradingPoints{grid-column:3;grid-row:1}.gradingIdentity small{display:none}}
.historyCorrection{margin-top:26px}.historyGrading{border:1px solid var(--line);border-radius:12px;background:#fff;margin:10px 0;overflow:hidden}.historyGrading summary{cursor:pointer;padding:14px 16px;display:flex;gap:8px;align-items:center;list-style:none}.historyGrading summary::-webkit-details-marker{display:none}.historyGrading summary span{margin-left:auto;color:var(--muted);font-weight:700}.historyGrading[open] summary{border-bottom:1px solid var(--line);background:#f7f9fb}.historyGradingBody{padding:14px}


/* Session professeur persistante : QR code/lien et actions */
.teacherRoomHeaderActions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.teacherRoomHeaderActions button,.teacherJoinPanel button,.wordCloudHead button{border:1px solid var(--line);background:#fff;border-radius:10px;padding:10px 14px;cursor:pointer}
.teacherJoinPanel{display:grid;grid-template-columns:minmax(0,1fr) 190px;gap:22px;align-items:center;margin:14px 0}
.teacherJoinPanel h3{font-size:24px;margin:5px 0 8px}
.teacherJoinText{min-width:0}
.joinLink{display:block;font-size:17px;font-weight:700;color:var(--accent);overflow-wrap:anywhere;margin:8px 0}
.teacherQr{width:190px;height:190px;object-fit:contain;border:1px solid var(--line);border-radius:14px;background:#fff;justify-self:end}
.teacherQuestionActions{position:sticky;bottom:10px;z-index:4;padding:10px;background:rgba(255,255,255,.94);border:1px solid var(--line);border-radius:14px;backdrop-filter:blur(8px)}
.wordCloudPanel{margin-top:16px}
.wordCloudHead{display:flex;justify-content:space-between;align-items:flex-start;gap:14px}
.wordCloudHead h3{margin:4px 0 0}
.wordCloudPanel .cloud{min-height:150px}
@media(max-width:760px){
  .teacherJoinPanel{grid-template-columns:1fr}
  .teacherQr{justify-self:center;width:min(250px,80vw);height:auto}
  .teacherRoomHeaderActions{justify-content:flex-start}
  .teacherQuestionActions{bottom:6px}
}


/* QR code professeur réductible */
.teacherJoinPanel.collapsed{grid-template-columns:minmax(0,1fr) 76px;padding:12px 16px;gap:14px}
.teacherJoinPanel.collapsed .teacherQr{width:70px;height:70px;border-radius:10px}
.teacherJoinPanel.collapsed .teacherJoinText h3{margin:2px 0 4px;font-size:19px}
.teacherJoinPanel.collapsed .joinLink{font-size:14px;margin:4px 0}
.teacherJoinPanel.collapsed .small{display:none}
#toggleTeacherQr{margin-top:5px}

/* Bilan final élève */
body.student-mode #student .studentFinished{background:var(--bg);min-height:100vh;padding:clamp(14px,3vw,30px)}
body.student-mode #student .studentFinished .finishHero{min-height:auto;border-radius:20px;padding:28px 18px;margin:0 auto 18px;max-width:980px}
.finishPercent{font-size:clamp(20px,5vw,30px);font-weight:800;margin:8px 0 0}
.studentReview{max-width:980px;margin:0 auto}
.reviewSummary{background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px;margin-bottom:14px}
.reviewSummary h3{font-size:clamp(24px,6vw,34px);margin:6px 0}
.reviewSummary p{font-size:17px;color:var(--muted);margin:0}
.reviewList{display:grid;gap:12px}
.reviewItem{background:#fff;border:2px solid var(--line);border-radius:18px;padding:18px}
.review-correct{border-color:#8bc59a}.review-incorrect{border-color:#e3a2a0}.review-partial{border-color:#e6c56c}.review-pending{border-color:#b7a7dc}.review-unanswered{border-color:#c8d0d7}
.reviewItemHead{display:grid;grid-template-columns:44px minmax(0,1fr) auto;gap:10px;align-items:start}
.reviewItemHead h4{font-size:clamp(19px,4.8vw,25px);line-height:1.2;margin:2px 0 8px}
.reviewBadge{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;font-size:24px;font-weight:900;background:#eef2f5}
.review-correct .reviewBadge{background:#e8f6ec;color:#18733a}.review-incorrect .reviewBadge{background:#fbeaea;color:#a32320}.review-partial .reviewBadge{background:#fff5d9;color:#8b6500}.review-pending .reviewBadge{background:#f0ebfb;color:#6443a5}
.reviewVerdict{font-weight:900;margin:8px 0}.review-correct .reviewVerdict{color:#18733a}.review-incorrect .reviewVerdict{color:#a32320}
.reviewOwn,.reviewExpected,.reviewPending{padding:10px 12px;border-radius:10px;background:#f6f8fa;margin-top:8px;font-size:16px;overflow-wrap:anywhere}
.reviewExpected{background:#eef8f1}.reviewPending{background:#f4efff;color:#6443a5}
.reviewExplanation{margin-top:10px;border-top:1px solid var(--line);padding-top:10px}
.reviewExplanation summary{cursor:pointer;font-weight:800;color:var(--accent);padding:6px 0}
.reviewExplanation p{font-size:16px;line-height:1.5}
.reviewImage{display:block;max-width:100%;max-height:300px;object-fit:contain;border-radius:12px;margin:10px auto}
.finalLeaderboard{max-width:980px;margin:18px auto 0;border-radius:18px!important;min-height:auto!important}
@media(max-width:600px){
  .reviewItem{padding:14px}.reviewItemHead{grid-template-columns:36px minmax(0,1fr) auto}.reviewBadge{width:32px;height:32px;font-size:20px}.reviewItemHead strong{font-size:14px}
  body.student-mode #student .studentFinished{padding:10px}
  .teacherJoinPanel.collapsed{grid-template-columns:1fr 58px}.teacherJoinPanel.collapsed .teacherQr{width:54px;height:54px}
}


/* v0.2.6 — création de quiz, import ZIP et fin de quiz */
.teacherLibraryActions{margin:0}
.importGrid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.importBlock{border:1px solid var(--line);border-radius:14px;padding:16px;background:#fafbfd;min-width:0}
.importBlock h3{margin:5px 0 8px}
.importBlock textarea{min-height:190px}
.legacyImageUpload{margin-top:16px;border-top:1px solid var(--line);padding-top:14px}
.legacyImageUpload summary{cursor:pointer;font-weight:800}

.editorMeta{display:grid;grid-template-columns:2fr 1fr 1fr 180px;gap:14px;margin-bottom:18px}
.editorQuestions{display:grid;gap:16px}
.editorQuestion{padding:18px}
.editorQuestionHead{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:14px}
.editorQuestionHead h3{margin:4px 0 0}
.editorQuestionActions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.editorQuestionActions button{min-width:42px}
.editorQuestionGrid{display:grid;grid-template-columns:minmax(210px,1fr) 120px 140px;gap:12px}
.editorQuestion textarea{font-family:inherit;resize:vertical}
.editorImageRow{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap;margin:10px 0 16px}
.editorFileLabel{display:inline-flex;align-items:center;gap:8px;border:1px dashed #aebdca;border-radius:10px;padding:10px 12px;background:#f7f9fb;cursor:pointer;color:var(--text);font-weight:750}
.editorFileLabel input[type=file]{width:auto;max-width:240px;margin:0;padding:0;border:0;background:transparent}
.editorMediaPreview{display:flex;align-items:center;gap:10px;border:1px solid var(--line);padding:8px;border-radius:12px;background:#fff}
.editorMediaPreview img{width:100px;height:72px;object-fit:contain;border-radius:8px;background:#f2f4f6}
.editorAnswers{margin:14px 0}
.editorAnswers h4{margin:0 0 10px}
.editorAnswer{display:grid;grid-template-columns:54px minmax(0,1fr);gap:10px;border-radius:12px;padding:10px;margin:8px 0;color:#fff}
.editorAnswer.red{background:var(--red)}.editorAnswer.blue{background:var(--blue)}.editorAnswer.yellow{background:var(--yellow);color:#332700}.editorAnswer.green{background:var(--green)}
.editorAnswerSymbol{font-size:30px;font-weight:900;display:grid;place-items:center}
.editorAnswerBody{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center}
.editorAnswerBody>input{grid-column:1/3;margin:0;border:0}
.editorCorrect{display:flex;align-items:center;gap:7px;color:inherit;margin:0;font-size:14px}
.editorCorrect input{width:18px;height:18px;margin:0;accent-color:#fff}
.editorAnswer .editorFileLabel{background:rgba(255,255,255,.92);color:var(--text);border:0}
.editorAnswer .editorMediaPreview{grid-column:1/3}
.editorBottomBar{position:sticky;bottom:8px;z-index:6;display:flex;gap:10px;align-items:center;justify-content:space-between;margin-top:18px;padding:12px;background:rgba(255,255,255,.95);border:1px solid var(--line);border-radius:14px;backdrop-filter:blur(8px)}
.editorBottomBar .msg{margin:0;flex:1;text-align:center}

.launchQrPanel.qrCollapsed .joinLayout{display:grid;grid-template-columns:minmax(0,1fr) 78px}
.launchQrPanel.qrCollapsed .qr{width:72px;height:72px;object-fit:contain}
.launchQrPanel.qrCollapsed .bigCode{font-size:40px}
.studentFinishActions{max-width:980px;margin:18px auto 0;padding-bottom:28px}
.studentFinishActions button{width:100%;min-height:58px;font-size:18px;border-radius:14px}

@media(max-width:860px){
  .editorMeta{grid-template-columns:1fr 1fr}
  .importGrid{grid-template-columns:1fr}
}
@media(max-width:680px){
  .editorMeta,.editorQuestionGrid{grid-template-columns:1fr}
  .editorQuestionHead{flex-direction:column}
  .editorQuestionActions{justify-content:flex-start}
  .editorAnswer{grid-template-columns:42px minmax(0,1fr)}
  .editorAnswerBody{grid-template-columns:1fr}
  .editorAnswerBody>input,.editorAnswer .editorMediaPreview{grid-column:1}
  .editorBottomBar{flex-wrap:wrap}
  .editorBottomBar .msg{order:3;flex-basis:100%}
  .launchQrPanel.qrCollapsed .joinLayout{grid-template-columns:1fr 58px;align-items:center}
  .launchQrPanel.qrCollapsed .qr{width:54px;height:54px}
}


/* QuizLangu branding */
.brandLogo{width:42px;height:42px;display:block;border-radius:12px;flex:0 0 auto}
.avatarBtn{min-width:50px;min-height:50px;display:grid;place-items:center}
@media(max-width:520px){.avatars{grid-template-columns:repeat(5,1fr)}.avatarBtn{font-size:26px;padding:8px}}

/* v0.2.9 — multi-prof, QR verrouillé et avatars inclusifs */
.lockedSessionCode{background:#eef3f8!important;color:#243647;font-weight:850;letter-spacing:.08em;cursor:not-allowed}
.aiQuizHelp{margin:0 0 18px}
.aiQuizHelp summary{cursor:pointer;font-size:17px}
.aiQuizHelp textarea{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:13px;line-height:1.45;background:#f8fafc}
.adminWho{color:var(--muted);font-size:14px}
.adminCreate{margin-bottom:16px}
.adminFormGrid{display:grid;grid-template-columns:1fr 1.5fr 1.2fr 180px;gap:12px}
.adminTeacherRow{display:grid;grid-template-columns:minmax(180px,1fr) 2fr;gap:14px;align-items:center;padding:14px 0;border-bottom:1px solid var(--line)}
.adminTeacherRow:last-child{border-bottom:0}
.adminTeacherRow small{display:block;color:var(--muted);margin-top:3px}
.adminDisplayName{margin:0}
.adminTeacherControls{display:grid;grid-template-columns:150px 90px minmax(170px,1fr) auto auto;gap:8px;align-items:center}
.adminTeacherControls input,.adminTeacherControls select{margin:0}
.adminActiveLabel{display:flex;align-items:center;gap:6px;margin:0;color:var(--text)}
.adminActiveLabel input{width:18px;height:18px}
@media(max-width:900px){.adminFormGrid{grid-template-columns:1fr 1fr}.adminTeacherRow{grid-template-columns:1fr}.adminTeacherControls{grid-template-columns:1fr 1fr}.adminTeacherControls .adminResetPassword{grid-column:1/3}}
@media(max-width:560px){.adminFormGrid,.adminTeacherControls{grid-template-columns:1fr}.adminTeacherControls .adminResetPassword{grid-column:1}}


/* v0.3.0 — QR code et lien depuis l'historique */
.historyJoinHost:empty,#historyDetailJoinHost:empty{display:none}
.historyJoinPanel{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#f8fafc}
.historyJoinGrid{display:grid;grid-template-columns:minmax(0,1fr) 150px;gap:18px;align-items:center}
.historyJoinCode{font-size:34px;font-weight:900;letter-spacing:.08em;margin:3px 0 8px}
.historyQr{width:150px;height:150px;object-fit:contain;background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px}
.historyJoinActions{margin-top:10px}
#historyDetailJoinHost .historyJoinPanel{margin:18px 0}
#historyDetailJoinHost .historyJoinGrid{grid-template-columns:minmax(0,1fr) 190px}
#historyDetailJoinHost .historyQr{width:190px;height:190px}
@media(max-width:620px){
  .historyJoinGrid,#historyDetailJoinHost .historyJoinGrid{grid-template-columns:1fr}
  .historyQr,#historyDetailJoinHost .historyQr{width:min(240px,80%);height:auto;justify-self:center}
  .historyJoinCode{font-size:30px}
}


/* v0.3.1 — avatars uniques et mode compétition */
.avatars{grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:9px}
.avatarBtn{min-height:76px!important;display:flex!important;flex-direction:column;gap:4px;align-items:center;justify-content:center;padding:8px!important;font-size:25px!important}
.avatarBtn .avatarLabel{font-size:10px;line-height:1.1;font-weight:750;color:var(--muted);text-align:center}
.avatarBtn.selected .avatarLabel{color:var(--accent)}
.avatarBtn.used{opacity:.35;cursor:not-allowed;filter:grayscale(.6)}
.avatarBtn.used::after{content:"Pris";font-size:9px;font-weight:900;text-transform:uppercase;color:#7b2630}
.competitionRule,.competitionReward,.reviewSpeed{margin-top:12px;padding:10px 12px;border-radius:11px;background:#fff4d8;border:1px solid #eac975;font-weight:800}
.competitionReward{font-size:16px}
.reviewSpeed{font-size:14px}
@media(max-width:560px){.avatars{grid-template-columns:repeat(3,1fr)}.avatarBtn{min-height:82px!important}}


/* v0.3.2 — podium final et feu d'artifice */
.teacherFinalStage{position:relative;overflow:hidden;border-radius:24px;min-height:620px;background:linear-gradient(160deg,#111d33 0%,#172a49 52%,#0e2037 100%);color:#fff;padding:32px 24px 28px;margin-top:16px}
.fireworksCanvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
.teacherFinalContent{position:relative;z-index:2;max-width:980px;margin:0 auto;text-align:center}
.teacherFinalEyebrow{color:#d9e9ff}
.teacherFinalContent>h2{font-size:clamp(38px,6vw,66px);margin:8px 0 12px;text-shadow:0 3px 18px rgba(0,0,0,.35)}
.teacherFinalList{background:rgba(255,255,255,.94);color:var(--text);max-width:760px;margin:18px auto 0;text-align:left}
.teacherFinalActions{justify-content:center;margin-top:18px}
.teacherFinalActions button{background:#fff;border-color:#fff}

.finalPodium{display:flex;justify-content:center;align-items:flex-end;gap:clamp(8px,2vw,18px);margin:18px auto 24px;max-width:760px;min-height:260px}
.podiumPlace{min-width:0;flex:1;max-width:230px;text-align:center;display:flex;flex-direction:column;align-items:center}
.podiumMedal{font-size:clamp(30px,5vw,48px);line-height:1}
.podiumAvatar{font-size:clamp(42px,8vw,70px);margin:7px 0}
.podiumName{font-weight:900;font-size:clamp(15px,2.3vw,22px);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.podiumScore{font-weight:800;margin-top:3px}
.podiumStep{width:100%;display:flex;align-items:flex-start;justify-content:center;margin-top:8px;border-radius:14px 14px 0 0;font-size:clamp(30px,6vw,54px);font-weight:950;padding-top:12px;background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.25)}
.podiumRank1{order:2}.podiumRank2{order:1}.podiumRank3{order:3}
.podiumRank1 .podiumStep{height:118px;background:linear-gradient(180deg,rgba(255,210,64,.42),rgba(255,210,64,.20))}
.podiumRank2 .podiumStep{height:88px;background:linear-gradient(180deg,rgba(220,230,240,.34),rgba(220,230,240,.15))}
.podiumRank3 .podiumStep{height:68px;background:linear-gradient(180deg,rgba(213,137,72,.38),rgba(213,137,72,.15))}
.finalPodiumEmpty{padding:28px;color:var(--muted)}

.studentFinalRanking{max-width:980px;margin:0 auto 18px;border-radius:20px!important;text-align:center}
.studentFinalRanking>h2{font-size:clamp(32px,8vw,48px);margin:7px 0 4px}
.studentFinalRanking .finalPodium{color:var(--text);min-height:230px}
.studentFinalRanking .podiumStep{color:#fff;background:#24384f;border:0}
.studentFinalRanking .podiumRank1 .podiumStep{background:#c99b15}
.studentFinalRanking .podiumRank2 .podiumStep{background:#8794a3}
.studentFinalRanking .podiumRank3 .podiumStep{background:#a86e3d}
.studentFullRanking{margin-top:8px;text-align:left}
.studentFinished .finishHero{margin-top:0!important}

@media(max-width:620px){
  .teacherFinalStage{padding:22px 10px;min-height:560px;border-radius:16px}
  .finalPodium{gap:5px;min-height:215px;margin-top:10px}
  .podiumAvatar{font-size:44px}
  .podiumName{font-size:13px}
  .podiumScore{font-size:12px}
  .podiumRank1 .podiumStep{height:88px}
  .podiumRank2 .podiumStep{height:66px}
  .podiumRank3 .podiumStep{height:50px}
  .studentFinalRanking{padding:16px 10px}
}


/* v0.3.6 — leçon autonome, radios visibles et aide historique */
.lessonEditor{margin-bottom:18px}
.lessonEditor summary{cursor:pointer;font-size:17px}
.lessonEditor textarea{white-space:pre-wrap}
.studentLesson{max-width:900px;margin:20px auto;padding:clamp(20px,4vw,38px)}
.studentLesson h2{font-size:clamp(28px,6vw,42px);margin:8px 0 18px}
.lessonText{white-space:pre-wrap;font-size:clamp(17px,4vw,21px);line-height:1.6;background:#f7f9fb;border:1px solid var(--line);border-radius:14px;padding:18px;margin:18px 0}
.lessonMedia{display:block;max-width:100%;max-height:420px;object-fit:contain;margin:16px auto;border-radius:14px}

/* Le rond de la bonne réponse devient entièrement noir quand il est coché */
.editorCorrect input[type="radio"]{-webkit-appearance:none;appearance:none;width:24px;height:24px;min-width:24px;border-radius:50%;border:2px solid #111;background:#fff;margin:0;cursor:pointer;transition:background .12s ease,border-color .12s ease,transform .12s ease}
.editorCorrect input[type="radio"]:checked{background:#111;border-color:#111;transform:scale(1.08)}
.editorCorrect input[type="radio"]:focus-visible{outline:3px solid rgba(0,0,0,.28);outline-offset:2px}
.editorCorrect{font-weight:800}

.historyQuestionHead{cursor:help;text-decoration:underline dotted;text-underline-offset:4px}


/* v0.4.0 — éditeur HTML de leçon + IA */
.aiBuilderPanel,.adminAiPanel{margin-bottom:18px}
.aiFormGrid,.aiOptionsGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:14px;margin-bottom:14px}
.aiOptionBlock{border:1px solid var(--line);border-radius:14px;padding:12px;background:#fbfcff}
.inlineChecks{display:flex;flex-wrap:wrap;gap:10px;margin-top:8px}
.sectionHead.compact{margin-bottom:8px}
.lessonRichWrap{display:flex;flex-direction:column;gap:8px}
.richToolbar{display:flex;flex-wrap:wrap;gap:8px;padding:8px;border:1px solid var(--line);border-radius:14px;background:#f8fafc}
.richToolbar button{padding:8px 12px;border-radius:10px;border:1px solid var(--line);background:#fff;cursor:pointer}
.richEditor,.htmlSourceEditor{min-height:220px;border:1px solid var(--line);border-radius:14px;padding:14px;background:#fff;outline:none}
.richEditor:empty:before{content:attr(data-placeholder);color:#8a94a6}
.htmlSourceEditor{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
.richLessonHtml p{margin:.6em 0}.richLessonHtml ul,.richLessonHtml ol{padding-left:1.2em}.richLessonHtml h1,.richLessonHtml h2,.richLessonHtml h3{margin:.5em 0}.richLessonHtml blockquote{border-left:4px solid #b9c5d8;padding-left:12px;color:#3e4d66;margin:.8em 0}
.adminAiPanel .adminFormGrid label:first-child,.adminAiPanel .adminFormGrid label:nth-child(2){display:flex;align-items:center;gap:8px;padding-top:28px}


/* v0.4.1 — SVG + Gemini images */
.svgFrame,.svgMedia{display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:14px;background:#fff}
.svgFrame svg,.svgMedia svg{display:block;width:100%;height:auto;max-height:420px}
.editorSvgPreview{display:grid;gap:8px;max-width:480px;margin-top:8px}.editorSvgPreview .svgFrame{border:1px solid var(--line);padding:8px}
.answerMiniMedia{max-width:90px;max-height:70px;vertical-align:middle;margin-right:8px;border-radius:8px}.answerMiniSvg{display:inline-flex;width:90px;height:70px;vertical-align:middle;margin-right:8px}.answerMiniSvg svg{width:100%;height:100%}
.svgMedia.questionMedia,.svgMedia.lessonMedia,.svgMedia.reviewImage{width:100%;max-width:820px;margin:14px auto;padding:10px;border:1px solid var(--line)}
.adminAiPanel hr{border:0;border-top:1px solid var(--line);margin:20px 0}.adminAiPanel h4{margin:10px 0}


/* v0.4.3 — transition entre les questions autonomes */
.autonomousTransitionScreen{min-height:390px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;overflow:hidden;animation:autonomousPanelIn .22s ease-out}
.autonomousTransitionScreen h2{margin:.4rem 0 .2rem;font-size:clamp(1.8rem,6vw,3rem)}
.autonomousTransitionScreen p{margin:.2rem 0 1.4rem;color:var(--muted)}
.autonomousTransitionIcon{width:96px;height:96px;border-radius:50%;display:grid;place-items:center;margin-bottom:18px;font-size:48px;font-weight:900;background:#eef8f0;box-shadow:0 0 0 0 rgba(35,147,73,.2);animation:autonomousPulse 1s ease-out infinite}
.autonomousTransitionIcon.timeout{background:#fff6df}
.autonomousTransitionIcon span{animation:autonomousIconPop .35s cubic-bezier(.2,.9,.25,1.25)}
.autonomousTransitionBar{width:min(360px,80%);height:10px;background:#e8edf5;border-radius:999px;overflow:hidden;margin-top:8px}
.autonomousTransitionBar span{display:block;height:100%;width:0;border-radius:inherit;background:currentColor;animation:autonomousProgress 1.35s linear forwards}
@keyframes autonomousProgress{to{width:100%}}
@keyframes autonomousIconPop{0%{transform:scale(.25);opacity:0}100%{transform:scale(1);opacity:1}}
@keyframes autonomousPulse{0%{box-shadow:0 0 0 0 rgba(35,147,73,.20)}70%{box-shadow:0 0 0 22px rgba(35,147,73,0)}100%{box-shadow:0 0 0 0 rgba(35,147,73,0)}}
@keyframes autonomousPanelIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.autonomousTransitionScreen,.autonomousTransitionIcon,.autonomousTransitionIcon span,.autonomousTransitionBar span{animation:none}.autonomousTransitionBar span{width:100%}}


/* v0.4.6 — cours HTML interactifs isolés */
.lessonFormatChooser{display:grid;gap:8px;margin:14px 0}
.lessonFormatButtons{display:flex;flex-wrap:wrap;gap:8px}
.lessonFormatButtons button.primary{background:var(--accent);color:#fff;border-color:var(--accent)}
.lessonInteractiveWrap{display:grid;gap:10px}
.interactiveHtmlSource{min-height:340px;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:13px;white-space:pre;tab-size:2}
.interactiveLessonFrame{display:block;width:100%;height:min(76vh,900px);min-height:520px;border:1px solid var(--line);border-radius:16px;background:#fff;margin:14px 0}
.interactiveLessonFrame.editorPreview{height:560px;min-height:420px}
.interactiveStudentLesson{max-width:1100px}
.interactiveStudentLesson>.primary{margin-top:16px}
@media(max-width:620px){.interactiveLessonFrame{height:72vh;min-height:480px;border-radius:12px}.interactiveLessonFrame.editorPreview{height:500px}}
