@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600&family=Montserrat:wght@400;500;600;700;800;900&display=swap');

:root {
  --night: #01042C;
  --paper: #F9F9F9;
  --indigo: #3941B1;
  --line: #E2E3EC;
  --peach: #FBD3B0;
  --mint: #BDE8D0;
  --coral: #F5B5AA;
  --lav: #D8CCF1;
  --muted: rgba(1, 4, 44, .62);
  --shadow: 0 4px 24px rgba(1, 4, 44, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Montserrat, system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--night);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.15; }
a { color: inherit; }
[hidden] { display: none !important; }

.eyebrow {
  font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 14px;
  color: var(--muted);
}
.muted { color: var(--muted); }

/* Boutons */
.btn {
  appearance: none; border: 2px solid var(--night); background: var(--night); color: #fff;
  font: 600 15px/1 Montserrat, sans-serif; padding: 13px 20px; border-radius: 8px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; filter: none; transform: none; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); }
.btn.ghost { background: transparent; color: var(--night); }
.btn.small { padding: 8px 12px; font-size: 13px; }
.linkbtn { appearance: none; border: 0; background: none; font: 600 13px Montserrat, sans-serif; color: var(--muted); cursor: pointer; padding: 4px 6px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--night); }

/* Champs */
input[type=text], input[type=number], input[type=search], input[type=email], textarea, select {
  width: 100%; font: 500 16px Montserrat, sans-serif; color: var(--night); background: #fff;
  border: 1.5px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--night); outline-offset: 1px; border-color: var(--night); }
textarea { resize: vertical; min-height: 84px; }
label.field { display: block; margin-bottom: 18px; }
label.field > .eyebrow { display: block; margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--night); margin: 0; }

.card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 28px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: 13px; background: var(--lav); color: var(--night); }
.chip.mint { background: var(--mint); }
.chip.coral { background: var(--coral); }
.chip.peach { background: var(--peach); }
.rule { width: 64px; height: 4px; background: var(--indigo); margin: 14px 0 18px; }

/* ------- Accueil ------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 48px 24px 96px; }
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.home-head h1 { font-size: clamp(30px, 5vw, 48px); font-weight: 900; max-width: 620px; }
.newquiz { display: flex; gap: 10px; margin-bottom: 32px; flex-wrap: wrap; }
.newquiz input { flex: 1; min-width: 220px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.quiz-card { display: flex; flex-direction: column; gap: 14px; }
.quiz-card h3 { font-size: 20px; font-weight: 800; }
.quiz-card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.code { font-weight: 900; letter-spacing: .06em; }
.info-strip { background: var(--peach); border-radius: 12px; padding: 12px 16px; font-weight: 500; margin-bottom: 28px; }

/* ------- Éditeur ------- */
.edit { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 24px 20px; display: flex; flex-direction: column; gap: 18px; }
.edit-main { padding: 32px 40px 96px; max-width: 860px; }
.topbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 28px; }
.topbar .title { flex: 1 1 320px; font-weight: 800; font-size: 20px; }
.slide-item { cursor: grab; display: grid; grid-template-columns: 34px 1fr; gap: 6px 10px; padding: 12px; border-radius: 12px; cursor: pointer; border: 1.5px solid transparent; }
.slide-item:hover { background: var(--paper); }
.slide-item.on { border-color: var(--night); background: var(--paper); }
.slide-item .num { font-weight: 900; font-size: 18px; }
.slide-item .q { font-weight: 600; font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slide-item .tools { grid-column: 2; display: flex; flex-wrap: wrap; gap: 2px; }
.add-list { display: flex; flex-direction: column; gap: 6px; }
.add-list .btn { justify-content: flex-start; }
.opt-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-row .check { flex: none; }
.opt-row.correct input[type=text] { background: var(--mint); border-color: var(--night); }
.saved { font-size: 13px; color: var(--muted); min-height: 20px; }
.sub { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 12px 0 22px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ------- Écran présentateur ------- */
.present { min-height: 100vh; display: flex; flex-direction: column; }
.p-top { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; gap: 24px; }
.join-chip { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 16px; padding: 8px 8px 8px 20px; box-shadow: var(--shadow); }
.join-chip .t { font-size: 14px; font-weight: 500; text-align: right; }
.join-chip .t b { display: block; font-size: 22px; font-weight: 900; letter-spacing: .06em; }
.join-chip img { width: 84px; height: 84px; border-radius: 8px; display: block; }
.stage { flex: 1; padding: 8px 40px 120px; max-width: 1400px; width: 100%; margin: 0 auto; }
.stage h1 { font-size: clamp(32px, 4.4vw, 64px); font-weight: 900; max-width: 1100px; }
.stage .meta { display: flex; align-items: center; gap: 18px; margin: 18px 0 28px; flex-wrap: wrap; }
.count { font-weight: 800; font-size: 18px; }
.count b { font-size: 34px; font-weight: 900; color: var(--indigo); margin-right: 6px; }
.timer { flex: 1; min-width: 200px; max-width: 420px; height: 10px; background: var(--line); border-radius: 8px; overflow: hidden; }
.timer > i { display: block; height: 100%; background: var(--night); width: 100%; transition: width .25s linear; }
.timer-n { font-weight: 900; font-size: 28px; min-width: 60px; }

.lobby { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; margin-top: 24px; }
.lobby .bigcode { font-size: clamp(56px, 9vw, 120px); font-weight: 900; letter-spacing: .04em; line-height: 1; margin: 18px 0 6px; }
.lobby .qr { width: min(38vw, 420px); aspect-ratio: 1; background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 14px; }
.lobby .qr img { width: 100%; height: 100%; display: block; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.people .chip { font-size: 15px; padding: 6px 12px; animation: rise .35s ease; }

.controls { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 40px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; background: rgba(249, 249, 249, .92); border-top: 1px solid var(--line); opacity: .4; transition: opacity .2s; }
.controls:hover, .controls:focus-within { opacity: 1; }
.controls .spacer { flex: 1; }

/* Barres (choix, classement, classement général) */
.bars { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.bar-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 6px; }
.bar-row .name { font-weight: 700; font-size: clamp(18px, 2.2vw, 30px); }
.bar-row .val { font-weight: 900; font-size: clamp(18px, 2.2vw, 30px); white-space: nowrap; }
.bar-row .val small { font-weight: 500; font-size: .6em; color: var(--muted); margin-left: 8px; }
.track { height: clamp(22px, 3vw, 40px); background: #fff; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--night); border-radius: 8px; transition: width .6s cubic-bezier(.2, .8, .2, 1), background-color .3s; }
.bar-row.lead .fill { background: var(--indigo); }
.bar-row.right .fill { background: #5DBB8A; }
.bar-row.wrong { opacity: .45; }
.bar-row .rk { font-weight: 900; margin-right: 14px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; max-width: 1100px; }
.tile { background: #fff; border-radius: 16px; padding: 22px 24px; font-weight: 700; font-size: clamp(18px, 2vw, 28px); box-shadow: var(--shadow); }

/* Nuage de mots */
.cloud { display: flex; flex-wrap: wrap; gap: 6px 26px; align-items: center; justify-content: center; padding: 20px; min-height: 320px; max-width: 1200px; }
.cloud span { font-weight: 800; line-height: 1.1; transition: font-size .5s ease, opacity .5s; }
.cloud .lead { color: var(--indigo); }

/* Échelle */
.scale { max-width: 900px; }
.kpi { font-size: clamp(64px, min(12vw, 20vh), 160px); font-weight: 900; color: var(--indigo); line-height: 1; letter-spacing: -.03em; }
.hist { display: flex; align-items: flex-end; gap: 10px; height: clamp(130px, 26vh, 280px); margin-top: 20px; }
.hist .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.hist .col i { display: block; width: 100%; background: var(--night); border-radius: 8px 8px 0 0; height: 0; transition: height .6s cubic-bezier(.2, .8, .2, 1); min-height: 3px; }
.hist .col b { font-size: 18px; }
.hist .col span { font-weight: 700; color: var(--muted); }
.scale-ends { display: flex; justify-content: space-between; margin-top: 10px; font-weight: 600; color: var(--muted); }

/* Textes libres */
.wall { columns: 3 280px; column-gap: 18px; max-width: 1200px; }
.wall .note { break-inside: avoid; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; font-weight: 600; font-size: clamp(16px, 1.6vw, 22px); overflow-wrap: anywhere; }
.wall .note.pop { animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ------- Participant (mobile) ------- */
.play { max-width: 520px; margin: 0 auto; min-height: 100vh; padding: 20px 20px 48px; display: flex; flex-direction: column; gap: 18px; }
.play header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.play h1 { font-size: 26px; font-weight: 900; }
.play .q { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { appearance: none; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 16px; font: 600 17px Montserrat, sans-serif; color: var(--night); cursor: pointer; display: flex; align-items: center; gap: 12px; }
.opt .box { width: 22px; height: 22px; border: 2px solid var(--night); border-radius: 6px; flex: none; display: grid; place-items: center; font-size: 14px; color: #fff; }
.opt.radio .box { border-radius: 50%; }
.opt.sel { border-color: var(--night); background: var(--lav); }
.opt.sel .box { background: var(--night); }
.opt.sel .box::after { content: '✓'; }
.rank-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 10px 10px 16px; font-weight: 600; font-size: 17px; }
.rank-item .n { font-weight: 900; color: var(--muted); }
.rank-item .lbl { flex: 1; }
.rank-item button { appearance: none; width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid var(--night); background: #fff; font: 700 18px Montserrat; cursor: pointer; }
.rank-item button:disabled { opacity: .25; }
.nums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.nums button { appearance: none; height: 56px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font: 800 20px Montserrat; color: var(--night); cursor: pointer; }
.nums button.sel { background: var(--night); color: #fff; border-color: var(--night); }
.ends { display: flex; justify-content: space-between; font-weight: 600; font-size: 14px; color: var(--muted); }
.wordfields { display: flex; flex-direction: column; gap: 10px; }
.status-card { border-radius: 22px; padding: 28px 24px; }
.status-card.mint { background: var(--mint); }
.status-card.coral { background: var(--coral); }
.status-card.lav { background: var(--lav); }
.status-card.white { background: #fff; box-shadow: var(--shadow); }
.status-card h2 { font-size: 26px; font-weight: 900; }
.status-card p { margin: 10px 0 0; font-weight: 500; }
.err { color: #B3261E; font-weight: 600; min-height: 22px; }
.mini-timer { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.mini-timer > i { display: block; height: 100%; width: 100%; background: var(--night); transition: width .25s linear; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.lb-row .rk { width: 34px; font-weight: 900; color: var(--muted); }
.lb-row .nm { flex: 1; }
.lb-row.me { background: var(--lav); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }

@media (max-width: 900px) {
  .edit { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .edit-main { padding: 24px 20px 96px; }
  .lobby { grid-template-columns: 1fr; }
  .lobby .qr { width: min(80vw, 360px); }
  .p-top, .stage, .controls { padding-left: 20px; padding-right: 20px; }
  .row2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Dialogue */
.dlg { border: 0; border-radius: 22px; padding: 28px; box-shadow: 0 12px 48px rgba(1, 4, 44, .25); width: calc(100% - 32px); max-width: 480px; color: var(--night); font-family: Montserrat, sans-serif; }
.dlg::backdrop { background: rgba(1, 4, 44, .45); }

/* Sessions (accueil) */
.section-title { margin: 44px 0 16px; }
.session-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; align-items: center; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 12px; }
.session-row .who { font-weight: 800; font-size: 17px; }
.session-row .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Glisser-déposer des questions */
.slide-item.dragging { opacity: .35; }
.slide-item.drop-before { box-shadow: 0 -3px 0 var(--night); }
.slide-item.drop-after { box-shadow: 0 3px 0 var(--night); }
@media (max-width: 700px) { .session-row { grid-template-columns: 1fr; } }

/* Slides de contenu (présentateur) */
.content-body { font-size: clamp(20px, 2.4vw, 34px); font-weight: 500; max-width: 1000px; white-space: pre-line; margin: 18px 0 0; }
.stage.is-content { flex: none; height: calc(100vh - 140px); padding-bottom: 76px; display: flex; flex-direction: column; }
.content-media { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; margin-top: 18px; }
.content-media img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; box-shadow: var(--shadow); background: #fff; }

/* Éditeur : menu « Nouvelle slide » et import */
.newmenu { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.newmenu .eyebrow { margin: 6px 0 2px; }
.newmenu .btn { justify-content: flex-start; }
.thumb { display: block; max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--line); margin: 8px 0; background: #fff; }
.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; width: 0; background: var(--night); transition: width .2s; }
.slide-item .mini { display: block; width: 100%; max-height: 72px; object-fit: cover; border-radius: 6px; margin-top: 6px; border: 1px solid var(--line); }

/* Accueil : onglets et tableau de bord */
.tabs { display: flex; gap: 6px; border-bottom: 1.5px solid var(--line); margin-bottom: 24px; }
.tab { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px; padding: 10px 16px; font: 700 16px Montserrat, sans-serif; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--night); }
.tab.on { color: var(--night); border-bottom-color: var(--night); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.seg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.seg .eyebrow { margin-right: 6px; }
.seg button { appearance: none; background: #fff; border: 1.5px solid var(--line); border-radius: 8px; padding: 7px 12px; font: 600 14px Montserrat, sans-serif; color: var(--night); cursor: pointer; }
.seg button.on { background: var(--night); border-color: var(--night); color: #fff; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.kpi-tile { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 12px 18px; min-width: 120px; }
.kpi-tile b { display: block; font-size: 30px; font-weight: 900; color: var(--indigo); line-height: 1.1; }
.group { margin-top: 26px; }
.group-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.group-head h3 { font-size: 20px; font-weight: 800; }
.srow-main { display: flex; gap: 18px; align-items: center; }
.srow-date { min-width: 96px; font-weight: 800; font-size: 15px; }
@media (max-width: 800px) { .filters { grid-template-columns: 1fr 1fr; } .filters input { grid-column: 1 / -1; } }

/* Plein écran : une slide qui n'est qu'une image occupe tout l'écran */
.controls { z-index: 10; }
.controls .counter { font-weight: 800; font-size: 14px; color: var(--muted); margin-right: 6px; }
.p-top { position: relative; z-index: 5; }
body.bare .p-top { position: fixed; top: 0; left: 0; right: 0; padding: 12px 16px; background: none; pointer-events: none; justify-content: flex-end; }
body.bare .p-top .eyebrow { display: none; }
body.bare .join-chip { pointer-events: auto; transform: scale(.72); transform-origin: top right; }
.stage.is-bare { position: fixed; inset: 0; z-index: 1; max-width: none; padding: 0; margin: 0; background: #fff; }
.stage.is-bare .eyebrow { display: none; }
.stage.is-bare .content-media { position: absolute; inset: 0; margin: 0; display: block; }
.stage.is-bare .content-media img { width: 100%; height: 100%; object-fit: contain; border-radius: 0; box-shadow: none; background: #fff; }

/* Écran d'accueil de la session : adresse, code et QR code bien visibles */
.lobby { grid-template-columns: 1fr auto; column-gap: 56px; row-gap: 8px; }
.lobby-title { grid-column: 1 / -1; }
.lobby-title h1 { font-size: clamp(30px, 4vw, 56px); }
.lobby-step { font-weight: 500; font-size: clamp(16px, 1.6vw, 22px); color: var(--muted); }
.lobby-url { font-weight: 900; font-size: clamp(30px, 4.6vw, 68px); letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 18px; overflow-wrap: anywhere; }
.lobby-left .bigcode { margin: 4px 0 14px; }
.lobby-direct { font-size: 15px; overflow-wrap: anywhere; }
.qr-col { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.join-chip .t { font-size: 16px; }
@media (max-width: 900px) { .lobby { grid-template-columns: 1fr; } }

/* Déplacement des slides à la souris ou au doigt */
.slide-item { user-select: none; -webkit-user-select: none; }
.slide-item .num { touch-action: none; }
.slide-item.dragging { opacity: .9; box-shadow: var(--shadow); z-index: 5; position: relative; background: #fff; cursor: grabbing; }
body.sorting, body.sorting * { cursor: grabbing !important; }

/* Dialogue « Lancer » */
.dlg.wide { max-width: 560px; }
.resume-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow: auto; }
.resume-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; }

/* Adresse et code visibles en permanence pendant la présentation */
.join-chip { padding: 10px 10px 10px 22px; }
.join-chip .t { font-size: 15px; font-weight: 600; }
.join-chip .t b { font-size: 26px; }
body.bare .join-chip { transform: scale(.85); }

.lobby .bigcode.long { font-size: clamp(36px, 6vw, 84px); overflow-wrap: anywhere; letter-spacing: 0; }

.btn.danger { background: var(--coral); border-color: var(--coral); color: var(--night); }
