:root {
  --bg: #0a4a86;
  --bg2: #052342;
  --card: #ffffff;
  --ink: #1d1740;
  --muted: #6b6590;
  --accent: #fbbb00;
  --c0: #e5384f;
  --c1: #2a6fdb;
  --c2: #f0a202;
  --c3: #22a867;
  --radius: 16px;
  --shadow: 0 6px 0 rgba(0, 0, 0, .22);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #fff;
  background: radial-gradient(circle at 20% 0%, #1a76c4 0%, var(--bg) 40%, var(--bg2) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 20px; animation: fadeIn .35s ease both; }
.center { align-items: center; justify-content: center; text-align: center; gap: 18px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

.brand { display: flex; align-items: center; gap: 14px; }
.brand.lg { flex-direction: column; text-align: center; }
.brand-logo { display: block; height: auto; border-radius: 50%; box-shadow: 0 6px 0 rgba(0, 0, 0, .22); background: #fff; }
.brand.lg .brand-logo { width: clamp(120px, 34vw, 190px); }
.brand.sm .brand-logo { width: 64px; box-shadow: 0 3px 0 rgba(0, 0, 0, .22); }
.brand.sm .logo { font-size: 1.6rem; }
.logo { font-size: clamp(2.2rem, 7vw, 3.6rem); font-weight: 900; letter-spacing: -.02em; text-shadow: 0 4px 0 rgba(0, 0, 0, .25); }
.logo span { color: var(--accent); }

.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); width: 100%; max-width: 420px; }
.card.wide { max-width: 900px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 14px 14px; border-radius: 12px;
  border: 3px solid #d9d4ef; background: #fff; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--c1); }
.pin-input { text-align: center; font-weight: 800; letter-spacing: .25em; font-size: 1.6rem; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
  border: 0; border-radius: 12px; padding: 14px 22px; font-weight: 800; font-size: 1.1rem;
  background: var(--ink); color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--c3); }
.btn.warn { background: var(--c0); }
.btn.alt { background: var(--c1); }
.btn.ghost { background: rgba(255, 255, 255, .15); color: #fff; box-shadow: none; }
.btn.light { background: #ece8fb; color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.btn.big { font-size: 1.4rem; padding: 18px 34px; }
.btn.small { padding: 8px 12px; font-size: .9rem; border-radius: 9px; }
.error { color: #ffd7dc; background: rgba(229, 56, 79, .35); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.card .error { color: #a1182b; background: #ffe3e7; }
.muted { opacity: .75; }

/* Réponses colorées */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.choice {
  position: relative; border: 0; border-radius: 14px; color: #fff; font-weight: 800; font-size: clamp(1.05rem, 3.2vw, 1.8rem);
  padding: 18px 16px 18px 64px; min-height: 96px; text-align: left; display: flex; align-items: center;
  box-shadow: var(--shadow); transition: transform .1s, opacity .25s, filter .25s;
  overflow-wrap: break-word; word-break: normal; hyphens: auto;
}
.choice .shape { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 2rem; opacity: .95; }
.choice.c0 { background: var(--c0); } .choice.c1 { background: var(--c1); }
.choice.c2 { background: var(--c2); } .choice.c3 { background: var(--c3); }
button.choice:active { transform: translateY(4px); }
.choice.dim { opacity: .28; filter: grayscale(.4); }
.choice.right { outline: 6px solid #fff; animation: pop .4s ease; }
.choice.picked { outline: 5px solid var(--accent); }
.choices.fill { flex: 1; align-content: stretch; }
.choices.fill .choice { min-height: 120px; }

/* Joueur */
.player-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; padding-bottom: 10px; }
.pill { background: rgba(0, 0, 0, .3); padding: 6px 14px; border-radius: 999px; }
.timerbar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; margin-bottom: 14px; }
.timerbar > i { display: block; height: 100%; background: var(--accent); width: 100%; transform-origin: left; }
.player-q { background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; font-size: 1.25rem; font-weight: 800; }

.verdict { font-size: clamp(2.2rem, 9vw, 3.4rem); font-weight: 900; animation: pop .5s ease both; }
.verdict-screen.ok { background: var(--c3); } .verdict-screen.ko { background: var(--c0); }
.verdict-screen { margin: 0 -20px -20px; width: calc(100% + 40px); padding: 20px; flex: 1; }
.bigscore { font-size: 3rem; font-weight: 900; }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 6px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* Animateur */
.host-wrap { max-width: 1200px; margin: 0 auto; width: 100%; }
.pin-box { background: #fff; color: var(--ink); border-radius: 20px; padding: 18px 34px; box-shadow: var(--shadow); text-align: center; }
.pin-box small { display: block; color: var(--muted); font-weight: 700; }
.pin-box b { font-size: clamp(3rem, 10vw, 5.5rem); letter-spacing: .12em; line-height: 1; }
.lobby-grid { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.qr { background: #fff; padding: 10px; border-radius: 16px; box-shadow: var(--shadow); }
.qr img { display: block; width: 220px; height: 220px; }
@media (max-width: 800px) { .lobby-grid { grid-template-columns: 1fr; justify-items: center; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-height: 34vh; overflow: auto; padding: 4px; }
.chip { background: rgba(255, 255, 255, .18); padding: 8px 14px; border-radius: 999px; font-weight: 800; animation: pop .35s ease both; display: inline-flex; gap: 8px; align-items: center; }
.chip button { background: none; border: 0; color: #fff; opacity: .6; font-weight: 900; padding: 0; }
.chip button:hover { opacity: 1; }
.chip.off { opacity: .5; }

.host-question { font-size: clamp(1.6rem, 4.5vw, 3rem); font-weight: 900; text-align: center; background: #fff; color: var(--ink); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); margin: 14px 0 20px; }
.host-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.countdown { width: 86px; height: 86px; border-radius: 50%; background: var(--accent); color: var(--ink); display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; box-shadow: var(--shadow); }
.countdown.low { background: var(--c0); color: #fff; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.1); } }

.histo { display: flex; align-items: flex-end; justify-content: center; gap: 16px; height: 220px; margin: 6px 0 14px; }
.histo .col { flex: 1; max-width: 200px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.histo .bar { width: 100%; border-radius: 10px 10px 0 0; min-height: 8px; transition: height .8s cubic-bezier(.2, .9, .3, 1); height: 0; }
.histo .n { font-weight: 900; font-size: 1.5rem; }
.histo .col.wrong { opacity: .35; }
.histo .col.right .bar { outline: 4px solid #fff; }

.board { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.board .line { display: flex; align-items: center; gap: 14px; background: #fff; color: var(--ink); border-radius: 12px; padding: 14px 18px; font-weight: 900; font-size: 1.4rem; box-shadow: var(--shadow); animation: slideIn .5s ease both; }
.board .line .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .line .pts { font-variant-numeric: tabular-nums; }
.board .line .gain { color: var(--c3); font-size: 1rem; }
.board .line .pos { background: var(--ink); color: #fff; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 1rem; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; height: 340px; margin: 20px 0; }
.podium .step { height: 100%; width: min(28vw, 220px); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.podium .who { font-weight: 900; font-size: clamp(1rem, 3vw, 1.7rem); margin-bottom: 8px; text-align: center; word-break: break-word; opacity: 0; animation: pop .6s ease forwards; }
.podium .who small { display: block; opacity: .8; font-size: .75em; }
.podium .block { width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: start center; padding-top: 10px; font-size: 2.6rem; font-weight: 900; color: var(--ink); height: 0; transition: height 1.2s cubic-bezier(.2, .9, .3, 1); }
.p1 .block { background: #ffcb2f; } .p2 .block { background: #d5dbe5; } .p3 .block { background: #e0925a; }

/* Éditeur */
.lib-item { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 0; border-bottom: 2px solid #eeeaf9; }
.lib-item:last-child { border-bottom: 0; }
.lib-item b { font-size: 1.15rem; }
.qcard { background: #f6f4fd; border-radius: 14px; padding: 14px; margin-bottom: 14px; border: 2px solid #e3def6; }
.qcard .qhead { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; font-weight: 900; }
.qcard .qhead .grow { flex: 1; }
.ans { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.ans .dot { width: 34px; height: 34px; border-radius: 8px; color: #fff; display: grid; place-items: center; flex: none; font-size: 1.1rem; }
.ans input[type=text] { padding: 10px 12px; font-size: 1rem; }
.ans input[type=radio] { width: 24px; height: 24px; accent-color: var(--c3); flex: none; }
.ans label { font-size: .8rem; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 4px; flex: none; }
.card h2, .card h3 { color: var(--ink); }
.small-label { font-size: .85rem; color: var(--muted); font-weight: 700; }

@media (max-width: 600px) {
  .choices { gap: 10px; }
  .choice { padding: 12px 8px 12px 44px; min-height: 80px; font-size: 1.05rem; }
  .choice .shape { left: 10px; font-size: 1.4rem; }
  .podium { height: 280px; }
}

/* Images de question */
.qimg { display: block; max-width: 100%; max-height: 34vh; width: auto; height: auto; object-fit: contain; margin: 0 auto 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.player-img { max-height: 22vh; margin-bottom: 10px; }
.has-img .choices.fill .choice, .choices.fill.has-img .choice { min-height: 84px; }
.imgrow { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.imgrow .thumb { height: 70px; width: auto; max-width: 160px; object-fit: contain; border-radius: 8px; border: 2px solid #d9d4ef; background: #fff; }

/* Sondages */
.histo .n small { display: block; font-size: .55em; opacity: .75; font-weight: 700; text-align: center; }
.choice .pct { margin-left: auto; padding-left: 12px; font-weight: 900; font-size: 1.3em; }
.pollrow { position: relative; overflow: hidden; border-radius: 12px; background: rgba(255, 255, 255, .12); margin-bottom: 10px; padding: 14px 16px 14px 14px; display: flex; gap: 10px; align-items: center; font-weight: 800; }
.pollrow > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; opacity: .85; transition: width .8s cubic-bezier(.2, .9, .3, 1); }
.pollrow > span { position: relative; z-index: 1; }
.pollrow .t { flex: 1; word-break: break-word; }
.pollrow.mine { outline: 4px solid var(--accent); }

/* nombre impair de réponses : la dernière occupe toute la largeur */
.choices > .choice:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* Boutons flottants + panneau Joueurs */
.fabs { position: fixed; left: 14px; bottom: 14px; display: flex; gap: 8px; z-index: 20; }
.fab { border: 0; border-radius: 999px; padding: 10px 16px; font-weight: 800; background: rgba(0, 0, 0, .45); color: #fff; backdrop-filter: blur(4px); }
.fab:hover { background: rgba(0, 0, 0, .65); }
.overlay { position: fixed; inset: 0; background: rgba(5, 20, 40, .7); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { max-width: 560px; max-height: 86vh; display: flex; flex-direction: column; gap: 12px; }
.plist { overflow: auto; flex: 1; min-height: 120px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 2px solid #eeeaf9; color: var(--ink); font-weight: 700; }
.prow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pts { color: var(--muted); font-size: .9rem; }
.status { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.status.on { background: var(--c3); } .status.off { background: #b9b4d3; }

/* Nuage de mots, idées, vote, classement des idées */
.cloud { flex: 1; min-height: 38vh; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; align-content: center; gap: 6px 22px; padding: 12px; }
.cloud[data-empty]::before, .ideas[data-empty]::before { content: attr(data-hint); opacity: .6; font-size: 1.3rem; }
.word { position: relative; font-weight: 900; line-height: 1.05; animation: pop .45s ease both; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); transition: font-size .5s ease; cursor: default; }
.word .wx, .idea .wx { display: none; position: absolute; top: -8px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--c0); color: #fff; font-weight: 900; line-height: 1; padding: 0; }
.word:hover .wx, .idea:hover .wx { display: block; }
.ideas { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-content: start; overflow: auto; max-height: 52vh; padding: 4px; }
.idea { position: relative; background: #fff; color: var(--ink); border-radius: 12px; padding: 14px 16px; font-weight: 800; font-size: 1.15rem; box-shadow: var(--shadow); animation: pop .35s ease both; display: flex; gap: 10px; align-items: center; word-break: break-word; }
.idea .num { background: var(--c1); color: #fff; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.ranking { display: flex; flex-direction: column; gap: 10px; max-width: 900px; width: 100%; margin: 0 auto; }
.rrow { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 16px 18px; font-weight: 800; font-size: 1.3rem; }
.rrow > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--c1); opacity: .85; transition: width 1s cubic-bezier(.2, .9, .3, 1); }
.rrow.win > i { background: var(--c3); }
.rrow > span { position: relative; z-index: 1; }
.rrow .pos { width: 34px; text-align: center; } .rrow .txt { flex: 1; word-break: break-word; } .rrow .v { font-variant-numeric: tabular-nums; }
.opensettings { background: #fff; border-radius: 10px; padding: 10px 12px; margin: 10px 0 4px; border: 2px dashed #d9d4ef; }
.opensettings label { gap: 6px; }

/* Saisie libre (nuage de mots, brainstorming) et vote côté joueur */
.entryform { display: flex; gap: 8px; margin-bottom: 10px; }
.entryform input { flex: 1; min-width: 0; }
.entryinfo { text-align: center; font-weight: 800; opacity: .9; margin: 6px 0 10px; }
.mychips { display: flex; flex-wrap: wrap; gap: 8px; }
.votelist { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px; }
.voteitem { display: flex; align-items: center; gap: 12px; text-align: left; border: 3px solid transparent; border-radius: 14px; padding: 14px; color: #fff; font-weight: 800; font-size: 1.1rem; background: rgba(255, 255, 255, .15); box-shadow: var(--shadow); }
.voteitem .t { flex: 1; word-break: break-word; }
.voteitem .tick { width: 28px; text-align: center; font-size: 1.3rem; flex: none; }
.voteitem small { opacity: .8; font-weight: 700; }
.voteitem.on { background: var(--c3); border-color: #fff; }
.voteitem:disabled { opacity: .45; box-shadow: none; }

.host-wrap { padding-bottom: 60px; } /* laisse la place aux boutons flottants (Joueurs, Musique) */
