/* Lumi — palette chaleureuse et vive : crème, corail, mangue, turquoise, violet, prune. */
:root {
  --bg: #fff4e8;
  --card: #ffffff;
  --soft: #fff9f2;
  --line: #f2dcc8;
  --text: #2a1540;
  --muted: #7d6a86;
  --coral: #ff5a3c;
  --rasp: #ff2e7e;
  --mango: #ffb21e;
  --teal: #12b3a0;
  --violet: #7c4dff;
  --brand: var(--coral);
  --ok: #12b3a0;
  --ko: #ff4d5e;
  --a0: var(--coral);  --on0: #fff;
  --a1: var(--mango);  --on1: #3a1d00;
  --a2: var(--teal);   --on2: #fff;
  --a3: var(--violet); --on3: #fff;
  --radius: 26px;
  --shadow: 0 12px 34px rgba(120, 50, 40, .14);
  --shadow-lg: 0 24px 60px rgba(120, 40, 60, .22);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.2, .8, .2, 1);
  --font-title: "Oswald", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Poppins", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.45;
  background: var(--bg);
  overflow-x: hidden;
}
/* Bande diagonale en dégradé (signature visuelle) + halos colorés qui bougent doucement */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(135deg, var(--coral), var(--rasp) 55%, var(--violet));
  clip-path: polygon(74% 0, 100% 0, 100% 100%, 60% 100%);
}
body::after {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(28% 32% at 18% 22%, rgba(255, 178, 30, .28), transparent 70%),
    radial-gradient(24% 28% at 70% 80%, rgba(18, 179, 160, .20), transparent 70%),
    radial-gradient(22% 26% at 40% 60%, rgba(255, 90, 60, .16), transparent 70%);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(4%, -3%) rotate(8deg); }
}

#app { min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.1; font-family: var(--font-title); font-weight: 700; letter-spacing: .3px; }
h1 { text-transform: uppercase; }
a { color: var(--coral); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- Transitions d'écran (View Transitions) ---------- */
::view-transition-old(root) { animation: vt-out .28s var(--smooth) both; }
::view-transition-new(root) { animation: vt-in .42s var(--smooth) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px) scale(.985); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(4px); } }
::view-transition-group(qtext) { animation-duration: .6s; animation-timing-function: var(--smooth); }
.vt-qtext { view-transition-name: qtext; }

/* Entrées en cascade : chaque enfant arrive l'un après l'autre */
.stagger > * { animation: rise-in .55s var(--spring) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }
@keyframes rise-in { from { opacity: 0; transform: translateY(22px) scale(.96); } }
.word { display: inline-block; animation: word-in .5s var(--spring) both; animation-delay: calc(var(--i) * 70ms + 150ms); }
@keyframes word-in { from { opacity: 0; transform: translateY(.5em) rotate(4deg); filter: blur(6px); } }

/* ---------- Icônes ---------- */
.ico { font-size: 1.2em; line-height: 1; flex: none; vertical-align: -.18em; display: inline-block; }
.ico-sm { font-size: 1em; }

/* Pastille ronde blanche + longue ombre diagonale (style « bouton en relief ») */
.disc {
  --d: 48px; position: relative; isolation: isolate; flex: none;
  display: inline-grid; place-items: center; width: var(--d); height: var(--d);
  font-size: calc(var(--d) * .5); color: var(--coral); vertical-align: middle;
}
.disc::before { /* ombre longue */
  content: ""; position: absolute; z-index: -1; left: 0; top: 50%; width: 100%; height: 230%;
  transform-origin: 50% 0; transform: rotate(-45deg);
  background: linear-gradient(to bottom, rgba(90, 40, 50, .17), rgba(90, 40, 50, 0) 85%);
  border-radius: 0 0 50% 50%; pointer-events: none;
}
.disc::after { /* face blanche */
  content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffffff, #fbf3ec 68%, #f3e4d8);
  box-shadow: 0 2px 5px rgba(90, 40, 50, .12), inset 0 -3px 0 rgba(90, 40, 50, .05);
}
.disc .ico { font-size: 1em; vertical-align: 0; }
.disc b { font-family: var(--font-title); font-size: .9em; }
.disc.t0 { color: var(--coral); } .disc.t1 { color: #f08c00; } .disc.t2 { color: var(--teal); } .disc.t3 { color: var(--violet); }
.disc.sm { --d: 34px; } .disc.lg { --d: 76px; } .disc.xl { --d: 116px; }
.feature:hover .disc, .home-grid .card:hover .disc { animation: wobble .8s ease-in-out; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--text); }
.logo-mark { transition: transform .5s var(--spring); }
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.08); }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-text b { font-family: Poppins, sans-serif; font-weight: 700; font-size: 1.75rem; letter-spacing: -.5px; color: #2a0f45; }
.logo-text small { font-size: .74rem; color: var(--coral); font-weight: 600; margin-top: 3px; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Mise en page ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 16px 20px 60px; flex: 1; }
.page.narrow { max-width: 520px; }
.page.full { max-width: none; display: flex; flex-direction: column; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }

/* ---------- Formulaires ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--soft);
  border: 2px solid var(--line); border-radius: 16px; padding: 10px 16px; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px rgba(255, 90, 60, .15); }
textarea { resize: vertical; min-height: 70px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.big-input { font-family: var(--font-title); font-size: 1.8rem; text-align: center; font-weight: 700; letter-spacing: 6px; padding: 12px; }

.btn {
  position: relative; overflow: hidden; isolation: isolate;
  font: inherit; font-weight: 600; border: 0; cursor: pointer; border-radius: 999px;
  padding: 10px 18px; color: #fff; background: var(--text);
  transition: transform .25s var(--spring), box-shadow .25s, filter .2s;
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(255, 60, 90, .22); }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, var(--coral), var(--rasp)); }
.btn.ok { background: linear-gradient(135deg, var(--teal), #0d8f9e); }
.btn.danger { background: var(--ko); }
.btn.ghost { background: var(--card); color: var(--text); border: 2px solid var(--line); }
.btn.ghost:hover { border-color: var(--coral); color: var(--coral); box-shadow: 0 8px 18px rgba(255, 90, 60, .14); }
.btn.big { font-size: 1.15rem; padding: 14px 26px; }
.btn.block { width: 100%; justify-content: center; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(255, 46, 126, 0); } 0% { box-shadow: 0 0 0 0 rgba(255, 46, 126, .45); } }
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: ripple .65s ease-out; pointer-events: none; z-index: -1; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- Accueil ---------- */
.hero { padding: 30px 0 10px; }
.hero h1 { font-size: clamp(2.6rem, 7.5vw, 4.8rem); line-height: .98; }
.hero h1 .accent { display: block; background: linear-gradient(90deg, var(--coral), var(--rasp), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .tagline { font-family: var(--font-title); font-size: 1.25rem; letter-spacing: 2px; text-transform: uppercase; color: var(--coral); margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.hero .tagline .ico { animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 560px; margin: 0 0 20px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-top: 20px; }
.home-grid h2 { display: flex; align-items: center; gap: 12px; }
.home-grid .card { transition: transform .35s var(--spring), box-shadow .35s; }
.home-grid .card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 28px; }
.feature { background: var(--card); border-radius: 24px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; transition: transform .3s var(--spring); }
.feature:hover { transform: translateY(-3px); }
.feature b { display: block; margin-bottom: 2px; }
.feature .muted { font-size: .9rem; }

/* ---------- Liste / éditeur ---------- */
.quiz-list { display: grid; gap: 12px; }
.quiz-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; flex-wrap: wrap; transition: transform .3s var(--spring); }
.quiz-item:hover { transform: translateX(4px); }
.quiz-item h3 { margin: 0; font-size: 1.15rem; }
.q-edit { border-left: 6px solid var(--coral); }
.q-edit .head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.q-num { font-family: var(--font-title); font-weight: 700; background: linear-gradient(135deg, var(--coral), var(--rasp)); color: #fff; border-radius: 10px; padding: 2px 10px; }
.choices-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.choice-edit { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 14px 6px 6px; }
.choice-edit input[type=text] { background: rgba(255,255,255,.22); border-color: transparent; color: inherit; }
.choice-edit input[type=text]::placeholder { color: inherit; opacity: .65; }
.choice-edit input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--text); flex: none; }
.c0 { background: var(--a0); color: var(--on0); } .c1 { background: var(--a1); color: var(--on1); }
.c2 { background: var(--a2); color: var(--on2); } .c3 { background: var(--a3); color: var(--on3); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.letter {
  font-family: var(--font-title); font-weight: 700; width: 2em; height: 2em; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; background: rgba(255,255,255,.25); border: 2px solid currentColor;
}

/* ---------- Salle d'attente ---------- */
.lobby { max-width: 1040px; margin: 0 auto; width: 100%; }
.lobby-top { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.pin-box { text-align: center; }
.pin { font-family: var(--font-title); font-size: clamp(3.4rem, 11vw, 7rem); font-weight: 700; letter-spacing: 8px; line-height: 1; display: flex; justify-content: center; gap: 4px; margin: 6px 0; }
.pin span { display: inline-block; background: linear-gradient(180deg, var(--coral), var(--rasp)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: digit .7s var(--spring) both; animation-delay: calc(var(--i) * 90ms); }
.pin .gap { width: .35em; }
@keyframes digit { from { opacity: 0; transform: translateY(-40px) rotateX(90deg); } }
.qr { background: #fff; padding: 12px; border-radius: 28px; width: 180px; height: 180px; border: 3px solid var(--mango); animation: rise-in .6s var(--spring) .4s both; }
.qr img, .qr canvas { width: 100% !important; height: 100% !important; }
.bubbles { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: flex-start; align-content: flex-start; margin-top: 22px; min-height: 120px; }
.bubble {
  padding: 10px 18px; border-radius: 999px; font-weight: 700; color: #fff; cursor: pointer;
  box-shadow: var(--shadow); animation: bubble-in .6s var(--spring) both, float 4s ease-in-out infinite;
  animation-delay: 0s, calc(var(--i) * -.7s);
}
.bubble:nth-child(4n+1) { background: var(--coral); } .bubble:nth-child(4n+2) { background: var(--teal); }
.bubble:nth-child(4n+3) { background: var(--violet); } .bubble:nth-child(4n) { background: var(--mango); color: var(--on1); }
.bubble:hover { filter: brightness(1.1); text-decoration: line-through; }
@keyframes bubble-in { from { transform: scale(0); opacity: 0; } }
@keyframes float { 50% { translate: 0 -6px; } }

/* ---------- Intro de question ---------- */
.intro { margin: auto; text-align: center; max-width: 1000px; padding: 20px; }
.intro .q-index { font-family: var(--font-title); font-size: clamp(5rem, 16vw, 11rem); line-height: .9; font-weight: 700;
  background: linear-gradient(135deg, var(--coral), var(--rasp), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: zoom-in .7s var(--spring) both; }
.intro .q-index small { font-size: .3em; display: block; letter-spacing: 6px; color: var(--muted); -webkit-text-fill-color: var(--muted); }
.intro h2 { font-family: "Poppins", sans-serif; font-size: clamp(1.4rem, 3.4vw, 2.6rem); font-weight: 700; margin-top: 20px; }
.intro .dots { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }
.intro .dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s var(--spring); }
.intro .dots i.on { background: var(--coral); transform: scale(1.4); }
@keyframes zoom-in { from { opacity: 0; transform: scale(.3) rotate(-8deg); } }

/* ---------- Scène de question (animateur) ---------- */
.stage { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; max-width: 1400px; margin: 0 auto; width: 100%; padding: 10px 10px 0; }
.q-card { background: var(--card); border-radius: 36px; padding: 28px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; animation: card-in .6s var(--spring) both; }
.q-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: linear-gradient(90deg, var(--coral), var(--mango), var(--teal), var(--violet)); }
@keyframes card-in { from { opacity: 0; transform: translateX(-40px) rotate(-2deg); } }
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; padding: 5px 12px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.chip.hot { background: linear-gradient(135deg, var(--mango), var(--coral)); color: #fff; border: 0; animation: wobble 2s ease-in-out infinite; }
.q-text { font-size: clamp(1.5rem, 3vw, 2.6rem); font-weight: 700; line-height: 1.2; margin: 0; }
.q-image { display: block; max-height: 30vh; max-width: 100%; border-radius: 16px; margin: 18px auto 0; box-shadow: var(--shadow); }
.fuse { margin-top: 24px; display: flex; align-items: center; gap: 14px; }
.fuse-track { flex: 1; height: 14px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); overflow: hidden; }
.fuse-fill { height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--mango), var(--coral)); background-size: 300% 100%; transform-origin: left; transition: transform .1s linear; }
.fuse-num { font-family: var(--font-title); font-size: 2.4rem; font-weight: 700; min-width: 2.2ch; text-align: right; }
.fuse.urgent .fuse-num { color: var(--ko); animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.18); } }
.meter { margin-top: 18px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.meter b { font-family: var(--font-title); font-size: 1.8rem; color: var(--text); }
.meter b.bump { animation: bump .4s var(--spring); }
@keyframes bump { 50% { transform: scale(1.4); color: var(--coral); } }

.pills { display: flex; flex-direction: column; gap: 14px; }
.pill {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 16px; border-radius: 999px; padding: 14px 26px 14px 14px; min-height: 78px;
  font-size: clamp(1.05rem, 2vw, 1.5rem); font-weight: 700; box-shadow: var(--shadow);
  animation: pill-in .6s var(--spring) both; animation-delay: calc(var(--i) * 110ms + 250ms);
  transition: transform .5s var(--spring), opacity .5s, filter .5s, box-shadow .5s;
}
@keyframes pill-in { from { opacity: 0; transform: translateX(60px) scale(.9); } }
.pill .letter { font-size: 1.1rem; }
.pill .pill-text { flex: 1; }
.pill .pill-fill { position: absolute; inset: 0; z-index: -1; background: rgba(255,255,255,.28); transform: scaleX(0); transform-origin: left; transition: transform 1s var(--smooth) .2s; }
.pill .pill-count { font-family: var(--font-title); font-size: 1.6rem; opacity: 0; transform: scale(.4); transition: opacity .4s .5s, transform .5s var(--spring) .5s; }
.pills.revealed .pill-count { opacity: 1; transform: none; }
.pill.lose { opacity: .35; transform: scale(.96); filter: saturate(.4); }
.pill.win { transform: scale(1.04); box-shadow: 0 0 0 5px #fff, 0 0 0 9px var(--ok), var(--shadow-lg); }
.pill .tick { font-size: 1.7em; animation: pop-in .5s var(--spring) .6s both; }
@keyframes pop-in { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
.type-card { text-align: center; padding: 30px; }
.type-card .disc { margin-bottom: 14px; }
.answers-cloud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.answers-cloud span { padding: 8px 16px; border-radius: 999px; background: var(--soft); border: 2px solid var(--line); font-weight: 600; animation: bubble-in .5s var(--spring) both; animation-delay: calc(var(--i) * 80ms); }
.answers-cloud span.good { border-color: var(--ok); background: #e3faf6; }
.stage-foot { display: flex; justify-content: space-between; align-items: center; padding: 16px 10px 0; max-width: 1400px; margin: 0 auto; width: 100%; }

/* ---------- Classement ---------- */
.leaderboard { max-width: 680px; margin: 0 auto; width: 100%; }
.board-title { font-size: clamp(2.4rem, 6vw, 4rem); text-align: center; margin-bottom: 20px; animation: zoom-in .6s var(--spring) both; }
.lb-row {
  position: relative; display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 22px 8px 8px; margin-bottom: 10px; font-size: 1.15rem; box-shadow: var(--shadow);
}
.lb-row .rank { font-family: var(--font-title); font-weight: 700; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); flex: none; }
.lb-row:nth-child(1) .rank { background: linear-gradient(135deg, var(--mango), var(--coral)); color: #fff; }
.lb-row:nth-child(2) .rank { background: linear-gradient(135deg, var(--teal), #0d8f9e); color: #fff; }
.lb-row:nth-child(3) .rank { background: linear-gradient(135deg, var(--violet), var(--rasp)); color: #fff; }
.lb-row .name { flex: 1; font-weight: 600; }
.lb-row .score { font-family: var(--font-title); font-weight: 700; font-size: 1.4rem; }
.lb-row .delta { color: #fff; background: var(--ok); border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-weight: 700; animation: pop-in .5s var(--spring) .9s both; }
.lb-row.out { opacity: .45; }
.lb-row.out .name { text-decoration: line-through; }
.lb-list { position: relative; }
.alive-note { text-align: center; font-weight: 600; margin-bottom: 12px; }

/* ---------- Podium en médaillons ---------- */
.end-title { text-align: center; font-size: clamp(1.8rem, 4.5vw, 3rem); display: flex; align-items: center; justify-content: center; gap: 16px; animation: zoom-in .6s var(--spring) both; }
.medals { display: flex; justify-content: center; align-items: flex-end; gap: clamp(14px, 5vw, 64px); margin: 34px 0 26px; }
.medal { --size: clamp(110px, 20vw, 160px); --c1: var(--teal); --c2: #0d8f9e;
  position: relative; isolation: isolate; text-align: center; width: calc(var(--size) + 40px);
  animation: medal-drop 1s var(--spring) both; animation-delay: var(--delay); }
.medal.m1 { --size: clamp(140px, 27vw, 220px); --c1: var(--mango); --c2: var(--coral); margin-bottom: 46px; }
.medal.m3 { --c1: var(--violet); --c2: var(--rasp); }
@keyframes medal-drop { from { opacity: 0; transform: translateY(-160px) scale(.5) rotate(-20deg); } 70% { transform: translateY(8px) scale(1.04); } }
.medal-disc { position: relative; isolation: isolate; width: var(--size); height: var(--size); margin: 0 auto 16px; display: grid; place-items: center; }
.medal-disc::before { /* longue ombre diagonale, comme les pastilles */
  content: ""; position: absolute; z-index: -2; left: 0; top: 50%; width: 100%; height: 190%;
  transform-origin: 50% 0; transform: rotate(-45deg);
  background: linear-gradient(to bottom, rgba(90, 40, 50, .2), rgba(90, 40, 50, 0) 80%); border-radius: 0 0 50% 50%;
}
.medal-disc::after { /* anneau coloré qui tourne lentement */
  content: ""; position: absolute; z-index: -1; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--c1), var(--c2), #fff8, var(--c1), var(--c2), var(--c1));
  box-shadow: 0 10px 30px rgba(90, 40, 50, .22); animation: spin 7s linear infinite;
}
.medal-face {
  width: 78%; height: 78%; border-radius: 50%; display: flex; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 32% 28%, #fff, #fbf3ec 68%, #f1e1d4);
  box-shadow: inset 0 4px 10px rgba(90, 40, 50, .12);
}
.medal-face b { font-family: var(--font-title); font-size: calc(var(--size) * .42); line-height: 1;
  background: linear-gradient(160deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.medal-face small { font-family: var(--font-title); font-weight: 700; font-size: calc(var(--size) * .13); color: var(--c2); align-self: flex-start; margin-top: 26%; }
.medal-name { display: inline-block; max-width: 100%; background: var(--card); border-radius: 999px; padding: 6px 16px; font-weight: 700; font-size: 1.05rem;
  box-shadow: var(--shadow); word-break: break-word; }
.medal-score { display: block; width: fit-content; margin: 8px auto 0; background: var(--card); border-radius: 999px; padding: 2px 14px; box-shadow: var(--shadow); font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; color: var(--c2); }
.medal .crown { position: absolute; left: 50%; top: calc(var(--size) * -.36); translate: -50% 0; font-size: calc(var(--size) * .34); color: var(--mango);
  filter: drop-shadow(0 6px 10px rgba(240, 140, 0, .35)); animation: crown-in .8s var(--spring) both, float 3s ease-in-out infinite;
  animation-delay: calc(var(--delay) + 700ms), calc(var(--delay) + 1500ms); }
@keyframes crown-in { from { opacity: 0; transform: translateY(-50px) rotate(-30deg) scale(.4); } }
.medal .rays { position: absolute; z-index: -3; left: 50%; top: calc(var(--size) / 2); width: calc(var(--size) * 2.4); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 178, 30, .35) 0 9deg, transparent 9deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: rays-in 1s ease-out both, spin 24s linear infinite; animation-delay: calc(var(--delay) + 400ms), 0s; }
@keyframes rays-in { from { opacity: 0; scale: .3; } }
.runners { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 auto 26px; max-width: 900px; }
.runner { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 999px; padding: 5px 16px 5px 5px; box-shadow: var(--shadow); font-weight: 600; }
.runner .muted { font-size: .85rem; }

/* Lettres des réponses dans une pastille blanche */
.pill .letter, .p-answer .letter { background: #fff; border: 0; box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.c0 .letter { color: var(--a0); } .c1 .letter { color: #d97a00; } .c2 .letter { color: var(--a2); } .c3 .letter { color: var(--a3); }
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table td, .stats-table th { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.pct { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; min-width: 80px; }
.pct > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--mango)); border-radius: inherit; animation: fill 1.2s var(--smooth) 2.4s both; transform-origin: left; }
@keyframes fill { from { transform: scaleX(0); } }

/* ---------- Joueur ---------- */
.player-screen { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 12px; min-height: 100vh; width: 100%; max-width: 760px; margin: 0 auto; }
.kbd-hint { text-align: center; color: var(--muted); font-size: .85rem; margin: 0; display: none; }
.kbd-hint kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; background: #fff; border: 1px solid var(--line); border-bottom-width: 3px; font-family: var(--font-title); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .kbd-hint { display: block; } }
.player-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; background: var(--card); border-radius: 999px; padding: 8px 12px; box-shadow: var(--shadow); }
.score-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--text); color: #fff; border-radius: 999px; padding: 4px 14px; font-family: var(--font-title); font-weight: 700; }
.p-question { background: var(--card); border-radius: 26px; padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.p-question .q-small { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; font-weight: 600; }
.p-question .q-txt { font-weight: 700; font-size: 1.1rem; margin-top: 6px; }
.p-question .fuse-track { height: 6px; margin-top: 10px; }
.powers { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.power { background: var(--card); border: 2px solid var(--violet); color: var(--violet); }
.power.used { border-color: var(--line); color: var(--muted); }
.power.active { background: var(--violet); color: #fff; animation: beat .9s ease-in-out infinite; }
.p-answers { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.p-answer {
  position: relative; overflow: hidden; isolation: isolate; flex: 1; min-height: 64px;
  display: flex; align-items: center; gap: 14px; padding: 12px 18px; border: 0; border-radius: 32px; cursor: pointer;
  font: inherit; font-size: 1.1rem; font-weight: 700; text-align: left; box-shadow: var(--shadow);
  animation: pill-in .5s var(--spring) both; animation-delay: calc(var(--i) * 80ms);
  transition: transform .4s var(--spring), opacity .35s, flex .4s var(--smooth);
}
.p-answer:active { transform: scale(.96); }
.p-answer .letter { font-size: 1.2rem; }
.p-answers.locked .p-answer:not(.selected) { opacity: 0; transform: translateX(-40px) scale(.9); pointer-events: none; }
.p-answers.locked .p-answer.selected { flex: 2.5; transform: scale(1.02); }
.p-answer.hidden-5050 { visibility: hidden; }
.p-text { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.feedback { flex: 1; display: grid; place-items: center; text-align: center; border-radius: 36px; padding: 30px; color: #fff; position: relative; overflow: hidden; animation: wipe .7s var(--smooth) both; }
@keyframes wipe { from { clip-path: circle(0% at 50% 60%); } to { clip-path: circle(150% at 50% 60%); } }
.feedback.good { background: linear-gradient(160deg, var(--teal), #0b8a8f); }
.feedback.bad { background: linear-gradient(160deg, var(--rasp), var(--coral)); }
.feedback.win { background: linear-gradient(160deg, var(--mango), var(--coral) 50%, var(--rasp)); }
.feedback.neutral { background: var(--card); color: var(--text); box-shadow: var(--shadow); animation: rise-in .5s var(--spring) both; }
.feedback .big { margin-bottom: 18px; }
.feedback .big .disc { animation: pop-in .6s var(--spring) .2s both; }
.feedback h2 { font-size: 2.2rem; text-transform: uppercase; animation: rise-in .5s var(--spring) .3s both; }
.feedback .muted { color: inherit; opacity: .8; }
.feedback .score-pill { background: rgba(0,0,0,.22); font-size: 1.4rem; padding: 6px 18px; animation: pop-in .5s var(--spring) .45s both; }
.feedback .streak { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: #fff4c2; }
.orb { width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 50%; background: conic-gradient(var(--coral), var(--mango), var(--teal), var(--violet), var(--coral)); animation: spin 2.4s linear infinite; position: relative; }
.orb::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--card); }
.streak { color: var(--coral); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.wait-dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1.2em; text-align: left; overflow: hidden; vertical-align: bottom; }
@keyframes dots { from { width: 0; } to { width: 1.2em; } }

/* ---------- Divers ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); transition: transform .45s var(--spring); z-index: 50; max-width: calc(100% - 32px);
}
#toast.show { transform: translateX(-50%) translateY(0); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 60; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-family: "Poppins", sans-serif; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--text); color: #fff; vertical-align: middle; }
.mode-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mode-pick label.opt {
  display: block; cursor: pointer; background: var(--soft); border: 2px solid var(--line); border-radius: 16px; padding: 12px;
  color: var(--text); font-size: 1rem; margin: 0; height: 100%; border-radius: 24px; transition: transform .3s var(--spring), border-color .2s;
}
.mode-pick label.opt:hover { transform: translateY(-2px); }
.mode-pick label.opt b { display: flex; align-items: center; gap: 10px; color: var(--text); margin-bottom: 6px; }
.mode-pick input { display: none; }
.mode-pick input:checked + label.opt { border-color: var(--coral); background: #fff; box-shadow: 0 8px 20px rgba(255, 90, 60, .18); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font-size: 1rem; margin: 0; }
.switch input { width: 20px; height: 20px; accent-color: var(--coral); }
.switch .ico { color: var(--coral); }
.spinner { width: 40px; height: 40px; border: 4px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
dialog { border: 0; border-radius: 32px; animation: rise-in .45s var(--spring) both; }
dialog::backdrop { background: rgba(42, 21, 64, .45); backdrop-filter: blur(4px); }

/* ---------- Avatars ---------- */
.avatar { --s: 44px; display: inline-block; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; flex: none;
  vertical-align: middle; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(90, 40, 50, .18);
  background: radial-gradient(circle at 35% 28%, #fff 0, var(--av1, #fff) 38%, var(--av2, #ffd9cf) 100%); position: relative; }
.avatar img { display: block; width: 84%; height: 84%; margin: 8% auto 0; object-fit: contain; user-select: none;
  filter: drop-shadow(0 4px 4px rgba(60, 20, 40, .28)); transition: transform .4s var(--spring); }
.avatar::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: inset 0 -6px 12px rgba(60, 20, 40, .14), inset 0 4px 8px rgba(255, 255, 255, .6); }
.av-opt:hover .avatar img, .avatar.xl img { transform: scale(1.06) translateY(-2%); }
.avatar.sm { --s: 30px; box-shadow: 0 0 0 2px #fff; } .avatar.md { --s: 40px; }
.avatar.xl { --s: 116px; box-shadow: 0 0 0 5px #fff, 0 12px 28px rgba(90, 40, 50, .22); }
.avatar.pop { animation: pop-in .5s var(--spring) both; }
.join-card { margin-top: 20px; animation: rise-in .5s var(--spring) both; }
.join-preview { display: flex; align-items: center; gap: 18px; padding-bottom: 6px; }
.join-preview b { font-family: var(--font-title); font-size: 1.6rem; display: block; word-break: break-word; }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 12px; margin-top: 8px;
  max-height: 250px; overflow-y: auto; padding: 6px 4px; scrollbar-width: thin; }
.av-opt { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; justify-self: center;
  transition: transform .3s var(--spring); animation: bubble-in .4s var(--spring) both; animation-delay: calc(var(--i) * 18ms); }
.av-opt .avatar { --s: 64px; }
.av-opt:hover { transform: scale(1.1) rotate(-6deg); }
.av-opt.on { transform: scale(1.12); }
.av-opt.on .avatar { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--coral); }
.bubble { display: inline-flex; align-items: center; gap: 10px; padding: 5px 20px 5px 5px; font-size: 1.15rem; }
.lb-row .avatar { --s: 40px; }
.medal-face.has-avatar { padding: 0; overflow: hidden; }
.medal-face.has-avatar .avatar { --s: 100%; box-shadow: none; }
.medal-rank { position: absolute; right: 2%; bottom: 2%; width: 34%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; font-family: var(--font-title); font-weight: 700;
  font-size: calc(var(--size) * .17); box-shadow: 0 0 0 4px #fff, 0 6px 14px rgba(90, 40, 50, .25); }
.runner .avatar { margin-left: -4px; }

/* ---------- Images d'en-tête ---------- */
.cover-empty { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px; border: 2px dashed var(--line); border-radius: 24px; background: var(--soft); }
.cover-preview { position: relative; border-radius: 24px; overflow: hidden; aspect-ratio: 16 / 6; background: var(--soft); }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; animation: rise-in .5s var(--spring) both; }
.cover-preview.broken::after { content: "Image introuvable"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.cover-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.q-img-chip { display: flex; align-items: center; gap: 8px; }
.q-img-chip img { width: 64px; height: 42px; object-fit: cover; border-radius: 12px; }
.quiz-thumb { width: 96px; height: 60px; border-radius: 18px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--soft); }
.quiz-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cover-banner { width: 100%; aspect-ratio: 16 / 6; object-fit: cover; border-radius: 22px; display: block; }
.lobby-cover { position: relative; border-radius: 28px; overflow: hidden; height: 150px; box-shadow: var(--shadow); animation: rise-in .6s var(--spring) both; }
.lobby-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lobby-cover span { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 24px 14px; color: #fff; font-family: var(--font-title);
  font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; text-transform: uppercase; background: linear-gradient(transparent, rgba(42, 21, 64, .75)); }

/* ---------- Devinettes & rébus ---------- */
.rebus { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 4px; }
.rb-tile { display: grid; place-items: center; min-width: 96px; height: 96px; padding: 0 16px; border-radius: 26px; background: var(--soft);
  border: 2px solid var(--line); box-shadow: var(--shadow); animation: rb-in .6s var(--spring) both; animation-delay: calc(var(--i) * 140ms + 300ms); }
.rb-tile.emoji { font-size: 3.6rem; line-height: 1; background: radial-gradient(circle at 35% 30%, #fff, #fff1e4); }
.rb-tile.word { font-family: var(--font-title); font-size: 2.6rem; font-weight: 700; letter-spacing: 2px; color: var(--violet); }
.rb-tile.img { padding: 6px; } .rb-tile.img img { height: 100%; width: auto; max-width: 160px; object-fit: contain; border-radius: 18px; }
.rb-op { font-family: var(--font-title); font-size: 2.6rem; font-weight: 700; color: var(--coral); animation: rb-in .5s var(--spring) both; animation-delay: calc(var(--i) * 140ms + 300ms); }
@keyframes rb-in { from { opacity: 0; transform: translateY(26px) rotate(-8deg) scale(.6); } }
.rebus.small { gap: 6px; margin: 0; } .rebus.small .rb-tile { min-width: 58px; height: 58px; border-radius: 18px; padding: 0 10px; }
.rebus.small .rb-tile.emoji { font-size: 2.1rem; } .rebus.small .rb-tile.word { font-size: 1.5rem; } .rebus.small .rb-op { font-size: 1.6rem; }

.riddle-card { padding: 24px; }
.letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.letters .slot { width: 30px; height: 40px; border-bottom: 4px solid var(--coral); border-radius: 4px; background: var(--soft);
  animation: rise-in .4s var(--spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
.letters .sym { font-family: var(--font-title); font-size: 1.6rem; align-self: flex-end; }
.letters .gap { width: 16px; }
.letters.small .slot { width: 18px; height: 24px; border-bottom-width: 3px; } .letters.small .gap { width: 10px; }
.hints { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.hint { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 999px; background: var(--soft);
  border: 2px dashed var(--line); color: var(--muted); font-weight: 600; transition: background .4s, border-color .4s, color .4s; }
.hint-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: #fff; font-family: var(--font-title); }
.hint.on { background: #fff6dc; border: 2px solid var(--mango); color: var(--text); animation: hint-pop .6s var(--spring); }
.hint.on .hint-num { background: linear-gradient(135deg, var(--mango), var(--coral)); }
@keyframes hint-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.05); } }
.p-hints { display: flex; flex-direction: column; gap: 6px; } .p-hints .hint { padding: 6px 12px 6px 6px; font-size: .9rem; }
.p-hints .hint-num { width: 24px; height: 24px; font-size: .8rem; }
.answer-reveal { text-align: center; margin-bottom: 14px; }
.answer-word { font-family: var(--font-title); font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700; text-transform: uppercase; letter-spacing: 3px;
  background: linear-gradient(90deg, var(--coral), var(--rasp), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: zoom-in .6s var(--spring) both; }
.explain { display: inline-flex; align-items: center; gap: 8px; background: #fff6dc; border-radius: 999px; padding: 6px 16px; font-weight: 600; margin: 8px 0 0; }
.feedback .explain { background: rgba(255, 255, 255, .2); color: inherit; }

/* Éditeur de rébus */
.rebus-edit { margin-top: 12px; padding: 14px; border-radius: 22px; background: var(--soft); border: 1px solid var(--line); }
.rebus-pieces { display: flex; flex-wrap: wrap; gap: 10px; }
.rb-piece { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rb-piece input { width: 92px; height: 64px; text-align: center; font-family: var(--font-title); font-size: 1.4rem; border-radius: 18px; padding: 4px; }
.rb-piece input.emoji { font-size: 2.2rem; }
.rb-piece img { width: 92px; height: 64px; object-fit: contain; border-radius: 18px; background: #fff; border: 2px solid var(--line); }
.rb-tools { display: flex; gap: 4px; } .rb-tools .btn.small { padding: 3px 7px; }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.emoji-btn { font-size: 1.4rem; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff; cursor: pointer; box-shadow: 0 2px 6px rgba(90, 40, 50, .1);
  transition: transform .25s var(--spring); }
.emoji-btn:hover { transform: scale(1.2) rotate(-8deg); }

@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; gap: 16px; }
  .q-card { padding: 20px; }
}
@media (max-width: 700px) {
  body::before { clip-path: polygon(88% 0, 100% 0, 100% 100%, 80% 100%); }
  .lobby-top { grid-template-columns: 1fr; justify-items: center; }
  .choices-edit { grid-template-columns: 1fr; }
  .podium .step { width: 31%; }
  .page { padding: 12px 16px 50px; }
  .logo-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ----- Sauvegarde en ligne et partage ----- */
.sync-chip { display: inline-flex; align-items: center; gap: 6px; font: 600 .8rem/1 Poppins, sans-serif; padding: 7px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); vertical-align: middle; }
.sync-chip:empty { display: none; }
.sync-chip.ok { background: #dff7ef; color: #0d8a64; }
.sync-chip.syncing .ico { animation: pulse-op 1s ease-in-out infinite; }
.sync-chip.offline, .sync-chip.error { background: #fff1d6; color: #a86200; }
@keyframes pulse-op { 50% { opacity: .35; } }
.sync-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; }
.sync-card .grow { display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 32px 20px; }
.empty-state h3 { margin: 8px 0 0; }
.narrow-card { max-width: 620px; margin: 24px auto; }
.narrow-card h1 { margin: 0; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#saved .ico { color: #0d8a64; }
