/* ViageXperquiz — styles communs */
:root {
  --navy: #11244a;
  --navy-2: #183467;
  --navy-3: #22437f;
  --ink: #13294b;
  --muted: #5d6d88;
  --line: #dde4ef;
  --paper: #f4f6fa;
  --white: #ffffff;
  --accent: #2f8fd8;      /* bleu ViageXpertise : boutons, mises en avant */
  --accent-2: #6cc6f6;    /* bleu clair : chiffres et titres sur fond sombre */
  --gold: #f2b134;
  --gold-ink: #3b2800;
  --ok: #1f9d6b;
  --ko: #d64545;
  --a0: #2f6fdb;
  --a1: #e0573f;
  --a2: #f2b134;
  --a3: #22a079;
  --radius: 16px;
  --shadow: 0 12px 30px rgba(6, 18, 42, .22);
  --font-d: 'Outfit', system-ui, sans-serif;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--white);
  background: radial-gradient(1200px 700px at 80% -10%, var(--navy-3), transparent 60%), var(--navy);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body.light { background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }

/* Logo */
.logo-img { display: block; height: 44px; width: auto; max-width: 100%; }
.logo-img.sm { height: 40px; }
.topbar .logo-img.sm { height: 52px; }
.logo-img.xl { height: auto; width: min(620px, 92vw); margin: 0 auto; }
.card.center-card .logo-img { height: auto; width: min(300px, 100%); margin: 0 auto 10px; }
.logo { font-family: var(--font-d); font-weight: 800; font-size: 28px; letter-spacing: -.5px; white-space: nowrap; }
.logo span { color: var(--gold); }
.logo.xl { font-size: clamp(40px, 7vw, 72px); }
.logo.sm { font-size: 20px; }

/* Boutons */
.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 12px;
  padding: 12px 20px; font-weight: 700; font-size: 16px;
  background: var(--accent); color: #fff;
  transition: transform .08s ease, filter .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.big { font-size: 22px; padding: 16px 32px; border-radius: 14px; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: var(--white); }
.btn.ghost:hover { background: rgba(255, 255, 255, .18); }
.light .btn.ghost { background: #e8edf5; color: var(--ink); }
.btn.danger { background: var(--ko); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 9px; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; text-align: left; }
.field label { font-size: 14px; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font-size: 18px; outline: none;
}
.input:focus { border-color: var(--accent); }
.input.code { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-size: 30px; font-weight: 800; font-family: var(--font-d); }

.card { background: #fff; color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.center-card { width: 100%; max-width: 420px; text-align: center; }
.center-card .logo { color: var(--navy); margin-bottom: 6px; }
.msg { min-height: 22px; margin-top: 10px; font-weight: 600; color: var(--ko); }
.msg.ok { color: var(--ok); }
.sub { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600;
  opacity: 0; transition: .25s; z-index: 1000; pointer-events: none; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--ko); }

/* Bandeau de connexion */
.conn { position: fixed; top: 10px; right: 10px; background: var(--ko); color: #fff; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; z-index: 999; }

/* Réponses (formes + couleurs) */
.shape { display: inline-flex; width: 1.6em; justify-content: center; flex: none; font-size: 1.1em; }
.ans { color: #fff; border-radius: 14px; display: flex; align-items: center; gap: 12px; padding: 16px 18px; font-weight: 700; position: relative; overflow: hidden; text-align: left; }
.ans.a0 { background: var(--a0); }
.ans.a1 { background: var(--a1); }
.ans.a2 { background: var(--a2); color: var(--gold-ink); }
.ans.a3 { background: var(--a3); }

/* Badges */
.badge { display: inline-block; padding: 5px 12px; border-radius: 99px; font-size: 14px; font-weight: 700; background: rgba(255, 255, 255, .14); }
.badge.gold { background: var(--gold); color: var(--gold-ink); }
.badge.poll { background: #7c5cd6; color: #fff; }

/* ===================== Écran animateur ===================== */
.host-screen { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar .qtitle { font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .joinpill { background: #fff; color: var(--ink); border-radius: 12px; padding: 6px 14px; font-weight: 700; white-space: nowrap; }
.topbar .joinpill b { font-family: var(--font-d); letter-spacing: 2px; font-size: 20px; }
.host-main { flex: 1; display: flex; flex-direction: column; padding: 8px 32px 24px; min-height: 0; }
.host-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px 22px; }
.host-foot .hint { opacity: .55; font-size: 14px; }
.icon-btn { background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 42px; height: 42px; border-radius: 12px; cursor: pointer; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255, 255, 255, .2); }

/* Salle d'attente */
.lobby { flex: 1; display: grid; grid-template-columns: minmax(300px, 430px) 1fr; gap: 32px; align-items: start; }
.join-box { background: #fff; color: var(--ink); border-radius: 22px; padding: 24px; text-align: center; box-shadow: var(--shadow); }
.join-box .step { font-size: 18px; margin-bottom: 12px; }
.join-box .url { font-size: 22px; font-weight: 800; font-family: var(--font-d); word-break: break-all; margin: 12px 0 4px; }
.join-box .bigcode { font-family: var(--font-d); font-size: 64px; font-weight: 800; letter-spacing: 10px; line-height: 1; margin-top: 8px; }
.qr { display: flex; justify-content: center; }
.qr img, .qr canvas { width: 100% !important; max-width: 300px; height: auto !important; }
.players-box h2 { font-family: var(--font-d); font-size: 34px; margin: 6px 0 16px; }
.players-box h2 b { color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: rgba(255, 255, 255, .12); padding: 10px 16px; border-radius: 99px; font-weight: 700; font-size: 18px; animation: pop .3s ease; cursor: pointer; border: 0; color: #fff; }
.chip:hover { background: var(--ko); }
.waiting { opacity: .6; font-size: 20px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Question */
.q-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.q-num { font-family: var(--font-d); font-weight: 800; font-size: 20px; color: var(--accent-2); }
.q-text { font-family: var(--font-d); font-weight: 700; font-size: clamp(28px, 3.6vw, 52px); line-height: 1.15; margin: 4px 0 18px; }
.q-body { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; min-height: 0; }
.q-img { max-height: 32vh; max-width: 100%; border-radius: 14px; justify-self: center; }
.q-side { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.timer {
  --p: 100; width: 150px; height: 150px; border-radius: 50%;
  background: conic-gradient(var(--accent-2) calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0);
  display: grid; place-items: center;
}
.timer > div { width: 122px; height: 122px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; font-family: var(--font-d); font-weight: 800; font-size: 52px; }
.timer.low { background: conic-gradient(var(--ko) calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0); }
.answered { text-align: center; font-size: 18px; opacity: .85; }
.answered b { display: block; font-family: var(--font-d); font-size: 44px; }
.ready { font-family: var(--font-d); font-size: 26px; opacity: .8; text-align: center; }
.ready b { display: block; font-size: 90px; color: var(--accent-2); line-height: 1.1; }
.grid-ans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.grid-ans .ans { font-size: clamp(18px, 2vw, 28px); min-height: 92px; }
.grid-ans.dim .ans:not(.good) { opacity: .35; }
.ans .count { margin-left: auto; font-family: var(--font-d); font-size: 1.2em; }
.ans .bar { position: absolute; left: 0; bottom: 0; height: 6px; background: rgba(255, 255, 255, .75); transition: width .6s ease; }
.ans .tick { font-size: 1.2em; }
.explain { margin-top: 16px; background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 14px 18px; font-size: 20px; line-height: 1.4; }
.explain b { color: var(--accent-2); }

/* Classement */
.board { max-width: 900px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.board h1 { font-family: var(--font-d); font-size: 44px; text-align: center; margin: 0 0 10px; }
.row { display: flex; align-items: center; gap: 16px; background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 14px 20px; font-size: 24px; font-weight: 700; animation: slide .4s ease both; }
.row .rk { font-family: var(--font-d); width: 44px; color: var(--accent-2); }
.row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sc { font-family: var(--font-d); }
.row.first { background: var(--accent); color: #fff; }
.row.first .rk { color: #fff; }
@keyframes slide { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 18px; margin: 20px auto 10px; }
.pod { width: min(240px, 28vw); text-align: center; animation: rise .8s ease both; }
.pod .who { font-family: var(--font-d); font-weight: 800; font-size: 28px; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pts { opacity: .8; margin-bottom: 10px; font-weight: 700; }
.pod .block { border-radius: 16px 16px 0 0; display: grid; place-items: center; font-family: var(--font-d); font-weight: 800; font-size: 64px; }
.pod.p1 .block { height: 230px; background: var(--gold); color: var(--gold-ink); }
.pod.p2 .block { height: 170px; background: #c9d3e3; color: var(--ink); }
.pod.p3 .block { height: 120px; background: #d99a68; color: #3b1d06; }
.pod.p2 { animation-delay: .4s; }
.pod.p1 { animation-delay: .9s; }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Fenêtre (télécommande) */
.modal-bg { position: fixed; inset: 0; background: rgba(4, 12, 28, .7); display: grid; place-items: center; z-index: 500; padding: 16px; }
.modal { background: #fff; color: var(--ink); border-radius: 20px; padding: 26px; max-width: 420px; width: 100%; text-align: center; }
.modal .pin { font-family: var(--font-d); font-size: 56px; font-weight: 800; letter-spacing: 12px; }

/* ===================== Téléphone participant ===================== */
.phone { min-height: 100vh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: 14px 16px 20px; }
.phone-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.phone-top .me { font-weight: 700; background: rgba(255, 255, 255, .12); padding: 6px 12px; border-radius: 99px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-main { flex: 1; display: flex; flex-direction: column; }
.phone-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.phone h1 { font-family: var(--font-d); font-size: 30px; margin: 0; line-height: 1.2; }
.phone .ptext { font-family: var(--font-d); font-size: 22px; font-weight: 700; line-height: 1.25; margin: 6px 0 14px; }
.phone .ptimer { font-family: var(--font-d); font-weight: 800; font-size: 22px; background: rgba(255, 255, 255, .12); border-radius: 99px; padding: 4px 14px; }
.phone .ptimer.low { background: var(--ko); }
.choices { display: grid; gap: 12px; flex: 1; align-content: start; }
.choices .ans { border: 0; cursor: pointer; font-size: 19px; min-height: 76px; width: 100%; font-family: var(--font); }
.choices .ans:active { transform: scale(.98); }
.choices.locked .ans { opacity: .35; }
.choices.locked .ans.picked { opacity: 1; outline: 4px solid #fff; }
.big-emoji { font-size: 76px; line-height: 1; }
.result { border-radius: 22px; padding: 26px 20px; width: 100%; }
.result.good { background: var(--ok); }
.result.bad { background: var(--ko); }
.result.neutral { background: rgba(255, 255, 255, .12); }
.result .pts { font-family: var(--font-d); font-size: 40px; font-weight: 800; }
.stat { display: flex; gap: 12px; width: 100%; }
.stat > div { flex: 1; background: rgba(255, 255, 255, .1); border-radius: 16px; padding: 14px; }
.stat b { display: block; font-family: var(--font-d); font-size: 30px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ===================== Télécommande ===================== */
.remote .rbtn { width: 100%; font-size: 24px; padding: 26px; border-radius: 18px; }
.remote .rinfo { background: rgba(255, 255, 255, .1); border-radius: 16px; padding: 16px; text-align: left; width: 100%; }

/* ===================== Administration ===================== */
.admin-top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--navy); color: #fff; flex-wrap: wrap; }
.admin-top .grow { flex: 1; }
.admin-top nav { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-top nav button { background: transparent; border: 0; color: #fff; opacity: .7; padding: 8px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.admin-top nav button.on, .admin-top nav button:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 80px; }
.admin-wrap h1 { font-family: var(--font-d); margin: 0 0 4px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.toolbar .grow { flex: 1; }
.list { display: grid; gap: 12px; }
.item { background: #fff; border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 8px rgba(16, 35, 74, .06); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.item .info { flex: 1; min-width: 220px; }
.item .info b { font-size: 18px; }
.item .meta { color: var(--muted); font-size: 14px; margin-top: 3px; }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px; background: #fff; border-radius: 14px; }

.qcard { background: #fff; border-radius: 16px; padding: 18px; box-shadow: 0 2px 8px rgba(16, 35, 74, .06); margin-bottom: 14px; }
.qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.qhead .qn { font-family: var(--font-d); font-weight: 800; font-size: 18px; margin-right: 6px; }
.qhead .grow { flex: 1; }
.sel { padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; }
.ta { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); font-size: 17px; resize: vertical; color: var(--ink); }
.ta:focus, .sel:focus, .in:focus { outline: none; border-color: var(--accent); }
.in { width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); color: var(--ink); background: #fff; }
.aedit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.aslot { display: flex; align-items: center; gap: 8px; border-radius: 12px; padding: 8px 10px; color: #fff; }
.aslot.a0 { background: var(--a0); }
.aslot.a1 { background: var(--a1); }
.aslot.a2 { background: var(--a2); color: var(--gold-ink); }
.aslot.a3 { background: var(--a3); }
.aslot input[type=text] { flex: 1; min-width: 0; border: 0; border-radius: 8px; padding: 9px 10px; color: var(--ink); }
.aslot input[readonly] { background: rgba(255, 255, 255, .85); }
.aslot label { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.aslot input[type=checkbox] { width: 20px; height: 20px; accent-color: #fff; }
.extra { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-box { display: flex; gap: 8px; margin-top: 10px; }
.link-box input { flex: 1; font-size: 13px; }
.sticky-save { position: sticky; top: 0; z-index: 10; background: var(--paper); padding: 10px 0; }
table.res { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; font-size: 14px; }
table.res th, table.res td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.res th { background: #eef2f8; }

@media (max-width: 860px) {
  .lobby { grid-template-columns: 1fr; }
  .q-body { grid-template-columns: 1fr; }
  .grid-ans { grid-template-columns: 1fr; }
  .host-main { padding: 8px 16px 16px; }
  .topbar, .host-foot { padding-left: 16px; padding-right: 16px; }
  .aedit, .extra { grid-template-columns: 1fr; }
  .podium { gap: 8px; }
  .pod .who { font-size: 18px; }
}
