:root {
  --bg: #0f1226;
  --bg2: #171b38;
  --card: #1e2347;
  --line: #2f3566;
  --text: #f3f4ff;
  --muted: #a4a9d6;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
  --c0: #ef4444; --c1: #3b82f6; --c2: #f59e0b; --c3: #22c55e;
  --c4: #a855f7; --c5: #ec4899; --c6: #14b8a6; --c7: #f97316;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #2a2470 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; }
a { color: var(--accent2); }
[hidden] { display: none !important; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { height: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px;
}
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent2); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #05260f; }
.btn.danger { background: transparent; border-color: var(--bad); color: #ffb4b4; }
.btn.small { padding: 4px 10px; min-height: 32px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 42px;
}
textarea { resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
label.check input { width: auto; min-height: 0; }
.error { color: #ffb4b4; min-height: 1.4em; margin: 8px 0 0; }

.topbar { border-bottom: 1px solid var(--line); background: rgba(15,18,38,.8); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; text-decoration: none; color: var(--text); }
.brand b { color: var(--accent2); }
.banner { background: #3b2f08; color: #ffe29a; padding: 8px 16px; font-size: 14px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ok); color: #05260f; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 99; }

/* accueil */
.hero { text-align: center; padding: 64px 0 32px; }
.hero h1 { font-size: clamp(32px, 6vw, 56px); }
.hero p { color: var(--muted); font-size: 20px; max-width: 640px; margin: 0 auto 24px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding-bottom: 48px; }

/* formulaires auth */
.auth { max-width: 420px; margin: 48px auto; }

/* sessions */
.sessions { display: grid; gap: 12px; margin-top: 16px; }
.session { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.code { font: 700 18px ui-monospace, Consolas, monospace; letter-spacing: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px; }

/* organisateur */
.host { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; gap: 14px; padding: 14px; align-items: start; }
@media (max-width: 1000px) { .host { grid-template-columns: 1fr; } }
.col h2 { font-size: 16px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan li { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.plan li[draggable=true] { cursor: grab; }
.plan li.locked { opacity: .65; border-style: dashed; }
.plan li.dragging { opacity: .4; }
.plan li.drop-before { box-shadow: 0 -4px 0 var(--accent2); }
.plan li.drop-after { box-shadow: 0 4px 0 var(--accent2); }
.plan li.live { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(34,211,238,.25); }
.plan .ttl { font-weight: 600; overflow-wrap: anywhere; }
.plan .meta { font-size: 13px; color: var(--muted); }
.plan .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent); margin-right: 6px; }
.pill.quiz { background: var(--warn); color: #2a1a00; }
.pill.open { background: var(--c6); color: #00221d; }
.pill.slide, .pill.video { background: #475085; }
.live-panel .big { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.timer { font: 800 56px ui-monospace, Consolas, monospace; }
.bars { display: grid; gap: 8px; margin: 12px 0; }
.bar { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 40px; display: flex; align-items: center; padding: 6px 12px; gap: 10px; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--c1); opacity: .55; transition: width .4s ease; }
.bar > span { position: relative; }
.bar .n { margin-left: auto; font-weight: 800; }
.bar.right { border-color: var(--ok); }
.bar.right > i { background: var(--ok); }
.words { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; justify-content: center; margin: 12px 0; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.qlist li { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; overflow-wrap: anywhere; }
.qlist li.shown { border-color: var(--accent2); }
.qlist li.done, .qlist li.dismissed { opacity: .55; }
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.optrow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.optrow input[type=radio] { width: 20px; min-height: 0; }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #000; margin-bottom: 6px; }

/* ecran de salle */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 3vw; text-align: center; position: relative; }
.screen h1 { font-size: clamp(32px, 5vw, 80px); margin: 0 0 .4em; }
.screen .qr { width: min(46vh, 46vw); aspect-ratio: 1; background: #fff; border-radius: 18px; padding: 14px; }
.screen .qr svg { width: 100%; height: 100%; display: block; }
.screen .code-big { font: 800 clamp(36px, 6vw, 90px) ui-monospace, Consolas, monospace; letter-spacing: .15em; }
.screen .lobby { display: grid; grid-template-columns: 1fr auto; gap: 5vw; align-items: center; text-align: left; width: 100%; max-width: 1500px; }
@media (max-width: 800px) { .screen .lobby { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.screen .stage { width: 100%; max-width: 1500px; }
.screen .timerbar { height: 14px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 2vh 0; }
.screen .timerbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .15s linear; }
.screen .count { font: 800 clamp(40px, 6vw, 96px) ui-monospace, Consolas, monospace; }
.screen .opts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 2vh; }
.screen .opt { border-radius: 16px; padding: 2.2vh 2vw; font-size: clamp(20px, 2.6vw, 44px); font-weight: 700; text-align: left; display: flex; gap: 14px; align-items: center; }
.opt .shape, .pbtn .shape { width: 1.4em; height: 1.4em; border-radius: 6px; background: rgba(255,255,255,.35); display: inline-grid; place-items: center; flex: none; font-size: .8em; }
.screen .bars .bar { min-height: 8vh; font-size: clamp(18px, 2.4vw, 40px); }
.screen .bars .bar > i { opacity: .8; }
.screen .media { max-width: 100%; max-height: 94vh; border-radius: 12px; }
.screen iframe.media { width: min(94vw, 168vh); aspect-ratio: 16/9; border: 0; }
.screen .qbox { position: absolute; left: 3vw; right: 3vw; bottom: 3vh; background: rgba(15,18,38,.95); border: 2px solid var(--accent2); border-radius: 18px; padding: 2vh 2vw; font-size: clamp(20px, 2.6vw, 44px); text-align: left; }
.screen .qbox small { display: block; color: var(--accent2); font-size: .45em; text-transform: uppercase; letter-spacing: 2px; margin-bottom: .4em; }
.board { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 10px; max-width: 900px; counter-reset: r; }
.board li { display: flex; align-items: center; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.4vh 2vw; font-size: clamp(18px, 2.6vw, 42px); font-weight: 700; animation: rise .5s both; }
.board li::before { counter-increment: r; content: counter(r); width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--bg); display: grid; place-items: center; flex: none; }
.board li:nth-child(1) { background: linear-gradient(90deg, #7a5a00, var(--card)); border-color: #facc15; }
.board li:nth-child(1)::before { content: '\1F3C6'; background: transparent; }
.board li:nth-child(2)::before { background: #94a3b8; color: #000; }
.board li:nth-child(3)::before { background: #b45309; }
.board .pts { margin-left: auto; font-family: ui-monospace, Consolas, monospace; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.startgate { position: fixed; inset: 0; z-index: 20; background: rgba(8,10,24,.96); display: grid; place-items: center; text-align: center; cursor: pointer; padding: 24px; }
.startgate h1 { font-size: clamp(28px, 4vw, 56px); }

/* participant */
.player { min-height: 100vh; display: flex; flex-direction: column; padding: 14px; max-width: 560px; margin: 0 auto; }
.player .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.player .main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 16px 0; }
.player h1 { font-size: 24px; }
.pbtn { appearance: none; border: 0; color: #fff; font: inherit; font-size: 20px; font-weight: 700; border-radius: 14px; padding: 18px; min-height: 64px; display: flex; gap: 12px; align-items: center; text-align: left; cursor: pointer; width: 100%; }
.pbtn.sel { outline: 4px solid #fff; }
.pbtn[disabled] { opacity: .5; }
.pstat { text-align: center; }
.pstat .emoji { font-size: 64px; }
.pstat .pts { font-size: 40px; font-weight: 800; }
.ptimer { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.ptimer > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .15s linear; }
.askbox { border-top: 1px solid var(--line); padding-top: 12px; }
.offline { background: var(--bad); color: #fff; text-align: center; padding: 6px; font-size: 14px; position: sticky; top: 0; z-index: 9; }
.qstate { font-size: 13px; color: var(--muted); }
.bg0 { background: var(--c0); } .bg1 { background: var(--c1); } .bg2 { background: var(--c2); color: #231500 !important; } .bg3 { background: var(--c3); color: #052410 !important; }
.bg4 { background: var(--c4); } .bg5 { background: var(--c5); } .bg6 { background: var(--c6); color: #00221d !important; } .bg7 { background: var(--c7); color: #2a1000 !important; }

.langsel { width: auto; min-height: 32px; padding: 2px 6px; font-size: 13px; }

.chip { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--accent); }
.preview { display: grid; gap: 6px; background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px; padding: 10px; }
.notes { white-space: pre-wrap; background: var(--bg2); border-radius: 12px; padding: 10px; margin: 0; }
.host.present { grid-template-columns: minmax(0, 1fr) 340px; }
.host.present #planCard, .host.present #shareCard, .host.present #toolsCard, .host.present #teamCard, .host.present #teamSpacer { display: none; }
.host.present .live-panel .notes { font-size: 22px; line-height: 1.5; }
.host.present .live-panel .big { font-size: 38px; }
@media (max-width: 1000px) { .host.present { grid-template-columns: 1fr; } }
@media print { .topbar, .langsel, .noprint { display: none !important; } body { background: #fff; color: #000; } .card { border-color: #bbb; background: #fff; } }
.toast.bad { background: var(--bad); color: #fff; }
