:root {
  --c1: #e21b3c; /* rouge - triangle */
  --c2: #1368ce; /* bleu - losange */
  --c3: #d89e00; /* jaune - rond */
  --c4: #26890c; /* vert - carre */
  --bg: #0f1024;
  --bg2: #1a1b3a;
  --panel: #ffffff;
  --ink: #1a1a2e;
  --muted: #6b6b88;
  --accent: #6c2bd9;
  --ok: #26890c;
  --ko: #e21b3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 30% 10%, #2a2b6a, var(--bg) 60%);
  color: #fff;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }
.center { display: flex; align-items: center; justify-content: center; }

/* ---- Layout helpers ---- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.brand { font-weight: 800; letter-spacing: .5px; }
.brand .if { color: var(--c3); }
.muted { color: #c3c3e0; }

/* ---- Cards / panels ---- */
.card {
  background: var(--panel); color: var(--ink);
  border-radius: 18px; padding: 28px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.card.tight { padding: 18px; }

/* ---- Buttons ---- */
.btn {
  background: var(--accent); color: #fff;
  padding: 14px 22px; border-radius: 12px;
  font-size: 18px; font-weight: 700;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.lg { font-size: 22px; padding: 18px 34px; }
.btn.ghost { background: rgba(255,255,255,.15); }
.btn.dark { background: #222; }

/* ---- Inputs ---- */
.field { width: 100%; padding: 16px; border-radius: 12px; border: 2px solid #ddd; font-size: 18px; color: var(--ink); }
.field:focus { outline: none; border-color: var(--accent); }
label.lbl { display: block; font-weight: 700; margin: 12px 0 6px; }

/* ---- PIN entry (mobile) ---- */
.join-box { max-width: 420px; width: 100%; margin: auto; text-align: center; }
.join-box h1 { font-size: 30px; margin-bottom: 6px; }
.join-box .field { text-align: center; margin-bottom: 12px; }
.pin-input { letter-spacing: 8px; font-weight: 800; font-size: 28px; }

/* ---- Answer shapes (Kahoot-like) ---- */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.answers.two { grid-template-columns: 1fr 1fr; }
.ans {
  position: relative; border-radius: 14px; color: #fff;
  font-size: 22px; font-weight: 700; padding: 22px 18px;
  min-height: 90px; display: flex; align-items: center; gap: 14px;
  text-align: left; transition: transform .08s, opacity .2s;
}
.ans:active { transform: scale(.98); }
.ans .shape { font-size: 26px; }
.ans.c1 { background: var(--c1); }
.ans.c2 { background: var(--c2); }
.ans.c3 { background: var(--c3); }
.ans.c4 { background: var(--c4); }
.ans.dim { opacity: .35; }
.ans.correct { outline: 5px solid #fff; }
.ans .img { max-height: 70px; border-radius: 8px; }

/* mobile answer buttons fill screen */
.play-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 100%; }
.play-answers.two { grid-template-rows: 1fr 1fr; }
.pa { border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.pa.c1 { background: var(--c1); } .pa.c2 { background: var(--c2); }
.pa.c3 { background: var(--c3); } .pa.c4 { background: var(--c4); }
.pa:active { filter: brightness(.85); }

/* ---- Host question view ---- */
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.q-text { font-size: 34px; font-weight: 800; text-align: center; margin: 10px 0 18px; line-height: 1.2; }
.q-media { text-align: center; margin: 10px 0; }
.q-media img { max-height: 320px; max-width: 100%; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.timer { font-size: 30px; font-weight: 800; background: var(--accent); color:#fff; width: 64px; height: 64px; border-radius: 50%; display:flex; align-items:center; justify-content:center; }
.counter { font-size: 22px; font-weight: 700; }

/* ---- QR / lobby ---- */
.lobby-grid { display: grid; grid-template-columns: 320px 1fr; gap: 30px; align-items: start; }
.pin-display { font-size: 60px; font-weight: 900; letter-spacing: 6px; color: var(--c3); }
.players { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: rgba(255,255,255,.15); padding: 10px 16px; border-radius: 999px; font-weight: 700; }
.qr img { width: 260px; height: 260px; background:#fff; border-radius: 12px; padding: 8px; }

/* ---- Bars (distribution) ---- */
.bars { display:flex; align-items:flex-end; gap: 16px; height: 180px; margin-top: 16px; }
.bar { flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; }
.bar .fill { width: 80%; border-radius: 8px 8px 0 0; transition: height .5s; min-height: 4px; }
.bar.c1 .fill{background:var(--c1)} .bar.c2 .fill{background:var(--c2)}
.bar.c3 .fill{background:var(--c3)} .bar.c4 .fill{background:var(--c4)}
.bar .n { font-weight: 800; margin-bottom: 4px; }

/* ---- Leaderboard ---- */
.lb { list-style: none; max-width: 640px; margin: 16px auto; }
.lb li { display:flex; justify-content:space-between; align-items:center; background: rgba(255,255,255,.12); margin-bottom:10px; padding:16px 20px; border-radius:12px; font-size:20px; font-weight:700; }
.lb li .rk { color: var(--c3); margin-right: 12px; }
.podium { display:flex; justify-content:center; align-items:flex-end; gap: 18px; margin-top: 24px; }
.podium .col { text-align:center; }
.podium .stand { background: var(--accent); border-radius: 12px 12px 0 0; width: 140px; display:flex; align-items:flex-end; justify-content:center; padding-bottom: 10px; font-size: 40px; font-weight:900; }
.podium .p1 .stand{ height: 200px; background: var(--c3);}
.podium .p2 .stand{ height: 150px; }
.podium .p3 .stand{ height: 110px; background: var(--c1);}

/* ---- Result (player) ---- */
.result { text-align:center; padding: 40px 20px; }
.result.ok { background: var(--ok); }
.result.ko { background: var(--ko); }
.result h1 { font-size: 40px; }
.result .pts { font-size: 28px; margin-top: 10px; }
.full-screen-color { min-height: 100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; }

/* ---- Editor ---- */
.editor-grid { display:grid; grid-template-columns: 300px 1fr; gap: 20px; }
.q-list { display:flex; flex-direction:column; gap:8px; }
.q-item { background: rgba(255,255,255,.1); padding:12px; border-radius:10px; cursor:pointer; display:flex; justify-content:space-between; gap:8px; }
.q-item.active { background: var(--accent); }
.q-item small { color:#cfcfe8; }
.opt-row { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.opt-row .swatch { width:26px; height:26px; border-radius:6px; flex:none; }
.opt-row .field { flex:1; }
.opt-row input[type=radio], .opt-row input[type=checkbox] { width:22px; height:22px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.topbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.topbar a { color:#fff; text-decoration:none; font-weight:700; opacity:.85; }
.topbar a:hover { opacity:1; }
.preview-img { max-height:120px; border-radius:8px; margin-top:8px; }
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:#222; color:#fff; padding:12px 20px; border-radius:10px; font-weight:700; opacity:0; transition:opacity .2s; }
.toast.show { opacity:1; }

@media (max-width: 760px) {
  .lobby-grid, .editor-grid { grid-template-columns: 1fr; }
  .q-text { font-size: 26px; }
}
