:root {
  --bg: #0a0d18;
  --bg2: #111628;
  --panel: rgba(22, 28, 48, 0.72);
  --panel-solid: #161c30;
  --line: rgba(255, 255, 255, 0.08);
  --line2: rgba(255, 255, 255, 0.14);
  --text: #eef1fa;
  --muted: #8f98b3;
  --red: #ff4d5e;
  --red-d: #c9283a;
  --teal: #22d3ee;
  --teal-d: #0e9bb3;
  --gold: #f5b83d;
  --ok: #22c55e;
  --partial: #f59e0b;
  --bad: #e5485d;
  --radius: 18px;
  --display: 'Chakra Petch', 'Outfit', system-ui, sans-serif;
  --body: 'Outfit', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
input { font: inherit; }
b { font-weight: 700; }
kbd {
  font-family: var(--body);
  font-size: 0.75em;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  margin-left: 6px;
}

/* ------------------------------------------------ fond animé */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(ellipse at top, #141a33 0%, var(--bg) 60%); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; animation: drift 22s ease-in-out infinite alternate; }
.b1 { width: 520px; height: 520px; background: #ff4d5e; top: -160px; left: -120px; }
.b2 { width: 460px; height: 460px; background: #6d28d9; top: 30%; right: -160px; animation-delay: -7s; }
.b3 { width: 420px; height: 420px; background: #0891b2; bottom: -180px; left: 25%; animation-delay: -14s; opacity: 0.3; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 60px) scale(1.12); }
  100% { transform: translate(-40px, 120px) scale(0.95); }
}
.grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  opacity: 0.55;
}

/* ------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(10, 13, 24, 0.9), rgba(10, 13, 24, 0));
  backdrop-filter: blur(6px);
}
.logo {
  font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: 0.04em;
  color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.logo-mark { color: var(--red); font-size: 20px; display: inline-block; animation: spin 6s linear infinite; }
.logo-accent { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line2);
  background: var(--panel); cursor: pointer; font-size: 18px; transition: transform 0.15s;
}
.icon-btn:hover { transform: translateY(-2px); }

main { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 40px; min-height: calc(100vh - 140px); }
.footer { position: relative; z-index: 0; text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 28px; opacity: 0.7; }

/* ------------------------------------------------ boutons */
.btn {
  --b: var(--panel-solid); --bd: #0b0f1d;
  border: 0; cursor: pointer; border-radius: 14px;
  padding: 12px 22px; font-weight: 700; letter-spacing: 0.01em;
  background: var(--b); box-shadow: 0 5px 0 var(--bd);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 var(--bd); filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--bd); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { --b: var(--red); --bd: var(--red-d); color: #fff; }
.btn-teal { --b: var(--teal); --bd: var(--teal-d); color: #04222a; }
.btn-ghost { --b: rgba(255, 255, 255, 0.06); --bd: rgba(0, 0, 0, 0.35); border: 1px solid var(--line2); }
.btn-sm { padding: 8px 14px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 var(--bd); }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-xl { padding: 18px 40px; font-size: 20px; font-family: var(--display); letter-spacing: 0.04em; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}
.muted { color: var(--muted); font-weight: 500; }
.tiny { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ------------------------------------------------ chargement */
.loading { display: grid; place-items: center; gap: 16px; padding: 120px 0; color: var(--muted); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--line2); border-top-color: var(--red); animation: spin 0.8s linear infinite; }

/* ------------------------------------------------ écrans */
.screen { animation: enter 0.45s cubic-bezier(.2, .9, .3, 1.2); }
.screen.lobby:not(.enter) { animation: none; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ accueil */
.hero { padding: 36px 0 18px; max-width: 760px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 6px 12px; border: 1px solid var(--line2); border-radius: 999px;
}
.hero-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: ping 1.8s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); } 100% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } }
.hero-title {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(40px, 7.5vw, 84px); line-height: 0.95; margin: 18px 0 14px; letter-spacing: 0.01em;
}
.grad {
  background: linear-gradient(90deg, var(--red), #ff8a5c, var(--gold), var(--red));
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite;
}
@keyframes shine { to { background-position: 300% 0; } }
.hero-sub { color: #b8c0d8; font-size: 18px; max-width: 620px; margin: 0 0 22px; }
.name-field { display: inline-flex; flex-direction: column; gap: 6px; }
.name-field span { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.name-field input, .join-row input {
  background: rgba(0, 0, 0, 0.3); border: 2px solid var(--line2); color: var(--text);
  border-radius: 14px; padding: 12px 16px; font-size: 17px; font-weight: 600; width: min(320px, 80vw);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.name-field input:focus, .join-row input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 77, 94, 0.18); }

.section-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin: 44px 0 16px; }
.section-head h2 { font-family: var(--display); font-size: 30px; margin: 0; text-transform: uppercase; letter-spacing: 0.03em; }
.section-head p { margin: 0; color: var(--muted); }
.inf { color: var(--teal); }
.vs { color: var(--red); font-style: italic; }

.modes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.mode-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; padding: 20px 18px 16px;
  border-radius: var(--radius); border: 1px solid var(--line2);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--c) 40%, transparent) 0%, transparent 60%),
    var(--panel);
  transition: transform 0.2s cubic-bezier(.2, .9, .3, 1.4), border-color 0.2s, box-shadow 0.2s;
}
.mode-card::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c);
  transform: scaleX(0.2); transform-origin: left; transition: transform 0.3s;
}
.mode-card:hover { transform: translateY(-5px) rotate(-0.6deg); border-color: var(--c); box-shadow: 0 18px 40px -16px var(--c); }
.mode-card:hover::after { transform: scaleX(1); }
.mode-card:hover .mode-icon { transform: scale(1.18) rotate(-8deg); }
.mode-icon { font-size: 38px; line-height: 1; margin-bottom: 8px; transition: transform 0.25s cubic-bezier(.2, .9, .3, 1.6); }
.mode-name { font-family: var(--display); font-size: 22px; font-weight: 700; text-transform: uppercase; }
.mode-desc { color: var(--muted); font-size: 14px; min-height: 40px; }
.mode-best { font-size: 12px; font-weight: 700; color: var(--c); margin-top: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.mode-card.mix { background: linear-gradient(135deg, rgba(255, 77, 94, 0.35), rgba(139, 92, 246, 0.3) 50%, rgba(34, 211, 238, 0.28)); }

.mp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.mp-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mp-card h3 { margin: 0; font-family: var(--display); font-size: 24px; text-transform: uppercase; }
.mp-card p { margin: 0 0 12px; color: var(--muted); }
.mp-card-icon { font-size: 34px; }
.mp-card.highlight { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15), 0 20px 50px -20px rgba(34, 211, 238, 0.5); }
.join-row { display: flex; gap: 10px; flex-wrap: wrap; }
.join-row input { width: 140px; text-transform: uppercase; letter-spacing: 0.3em; font-family: var(--display); text-align: center; font-size: 22px; }

/* ------------------------------------------------ en-tête de jeu */
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--line2); background: var(--panel); border-radius: 999px; padding: 7px 14px;
  cursor: pointer; font-weight: 600; font-size: 14px; transition: all 0.15s;
}
.pill:hover { border-color: var(--c); }
.pill.on { background: var(--c); border-color: var(--c); color: #0a0d18; }

.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.hud-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; }
.hud-item span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.hud-item b { font-family: var(--display); font-size: 28px; line-height: 1.1; display: inline-block; }
.hud-item.streak b { color: var(--gold); }
.hud-item.streak b::before { content: '🔥 '; font-size: 22px; }
.bump { animation: bump 0.5s cubic-bezier(.2, .9, .3, 2); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }

.game-card { padding: 20px clamp(14px, 3vw, 28px) 22px; }
.game-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mode-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 20%, transparent); border: 1px solid var(--c);
  font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.reveal { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.reveal-bar { width: min(220px, 34vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.reveal-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--gold), var(--red)); border-radius: inherit; }
.game-actions { display: flex; justify-content: center; margin-top: 18px; }

/* ------------------------------------------------ puzzle */
.puzzle { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.puzzle.shake .stage { animation: shake 0.4s; }
@keyframes shake {
  20% { transform: translateX(-10px); } 40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(3px); }
}
.stage { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stage-hint { margin: 0; color: var(--muted); text-align: center; }
.stage-hint b { color: var(--text); }

.frame {
  position: relative; overflow: hidden; border-radius: 20px;
  border: 2px solid var(--line2);
  background: radial-gradient(circle at 50% 40%, #232b4a, #0d1120 75%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6), 0 20px 50px -20px rgba(0, 0, 0, 0.8);
}
.frame.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%; border: 4px solid var(--line2); border-top-color: var(--teal); animation: spin 0.8s linear infinite;
}
.is-won .frame { border-color: var(--ok); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.18), 0 20px 50px -20px rgba(34, 197, 94, 0.6); }
.is-lost .frame { border-color: var(--bad); }

.ability-frame { width: min(300px, 70vw); aspect-ratio: 1; display: grid; place-items: center; }
.ability-frame img { width: 62%; height: 62%; object-fit: contain; filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.35)); will-change: transform; }

.pixel-frame { width: min(320px, 72vw); aspect-ratio: 1; }
.pixel-frame canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }

.map-frame { width: min(720px, 100%); aspect-ratio: 16 / 9; }
.map-frame img { width: 100%; height: 100%; object-fit: cover; will-change: transform; transition: filter 0.3s; }

.emoji-row { display: flex; gap: clamp(8px, 2vw, 16px); justify-content: center; flex-wrap: wrap; padding: 10px 0; }
.emoji-card { width: clamp(62px, 15vw, 100px); aspect-ratio: 1; perspective: 600px; }
.emoji-inner { position: relative; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(.2, .9, .3, 1.3); transform-style: preserve-3d; }
.emoji-card.flipped .emoji-inner { transform: rotateY(180deg); }
.emoji-inner span {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid var(--line2);
}
.emoji-inner .front { background: repeating-linear-gradient(45deg, #1b2240, #1b2240 10px, #20284a 10px, #20284a 20px); font-family: var(--display); font-size: 34px; color: var(--muted); }
.emoji-inner .back { background: radial-gradient(circle, #2a3358, #151b31); transform: rotateY(180deg); font-size: clamp(32px, 8vw, 54px); }

.callout-q { margin: 0; font-size: 20px; text-align: center; }
.callout-q b:first-child { color: var(--gold); font-family: var(--display); font-size: 1.2em; text-transform: uppercase; }
.minimap-frame { width: min(560px, 100%); padding: 10px; background: radial-gradient(circle at 50% 50%, #1e2647, #0c1020 80%); }
.minimap { position: relative; width: 100%; aspect-ratio: 1; cursor: crosshair; }
.minimap img { width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.5)); }
.hint-zone {
  position: absolute; border-radius: 50%; transform: translate(-50%, -50%); opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(245, 184, 61, 0.22), rgba(245, 184, 61, 0.06) 70%);
  border: 2px dashed rgba(245, 184, 61, 0.7);
  transition: opacity 0.5s, width 0.4s, height 0.4s, left 0.4s, top 0.4s;
}
.pin { position: absolute; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%); border: 3px solid #fff; pointer-events: none; animation: pin 0.35s cubic-bezier(.2, .9, .3, 1.8); }
.pin span {
  position: absolute; left: 50%; bottom: 140%; transform: translateX(-50%); white-space: nowrap;
  font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: rgba(10, 13, 24, 0.9); border: 1px solid var(--line2);
}
.pin.bad { background: var(--bad); }
.pin.good { background: var(--ok); }
.pin.target { background: var(--gold); width: 24px; height: 24px; box-shadow: 0 0 0 0 rgba(245, 184, 61, 0.7); animation: pin 0.35s cubic-bezier(.2, .9, .3, 1.8), beacon 1.4s 0.35s infinite; z-index: 2; }
.pin.target span { color: var(--gold); font-size: 14px; }
@keyframes pin { from { transform: translate(-50%, -50%) scale(0); } to { transform: translate(-50%, -50%) scale(1); } }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(245, 184, 61, 0.7); } 100% { box-shadow: 0 0 0 22px rgba(245, 184, 61, 0); } }

/* --- saisie */
.guess { position: relative; width: min(520px, 100%); }
.guess-field { display: flex; gap: 10px; }
.guess-field input {
  flex: 1; min-width: 0; background: rgba(0, 0, 0, 0.35); border: 2px solid var(--line2); color: var(--text);
  border-radius: 14px; padding: 14px 18px; font-size: 18px; font-weight: 600; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.guess-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.16); }
.guess-field input:disabled { opacity: 0.5; }
.guess-go { font-size: 20px; padding: 0 20px; }
.suggest {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 8px); margin: 0; padding: 6px; list-style: none;
  background: #151b31; border: 1px solid var(--line2); border-radius: 14px; max-height: 300px; overflow-y: auto;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8);
}
.suggest li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.suggest li img { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; background: #232b4a; }
.suggest li em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); font-weight: 500; }
.suggest li.active, .suggest li:hover { background: rgba(34, 211, 238, 0.14); }

.tried { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: rgba(229, 72, 93, 0.14); border: 1px solid rgba(229, 72, 93, 0.5); font-weight: 600; font-size: 14px;
  animation: pin 0.3s cubic-bezier(.2, .9, .3, 1.6);
}
.chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* --- classique */
.legend { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg.ok::before, .lg.partial::before, .lg.bad::before { content: ''; width: 12px; height: 12px; border-radius: 4px; }
.lg.ok::before { background: var(--ok); }
.lg.partial::before { background: var(--partial); }
.lg.bad::before { background: var(--bad); }
.ct { width: 100%; overflow-x: auto; padding-bottom: 4px; }
.ct-head, .ct-row { display: grid; grid-template-columns: 1.3fr repeat(5, 1fr); gap: 8px; min-width: 640px; }
.ct-head div { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; text-align: center; padding-bottom: 6px; border-bottom: 2px solid var(--line2); }
.ct-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.ct-agent { display: flex; align-items: center; gap: 10px; font-weight: 700; padding: 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); animation: enter 0.3s; }
.ct-agent img { width: 48px; height: 48px; border-radius: 10px; background: #232b4a; }
.ct-cell {
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 6px;
  border-radius: 12px; font-weight: 700; font-size: 14px; min-height: 60px; position: relative;
  animation: flip 0.5s var(--d) both cubic-bezier(.2, .9, .3, 1.3);
}
.ct-cell img { width: 22px; height: 22px; }
.ct-cell.ok { background: var(--ok); color: #052e12; }
.ct-cell.partial { background: var(--partial); color: #3b2300; }
.ct-cell.bad { background: var(--bad); color: #fff; }
.ct-cell.unknown { background: #3a4260; color: #cdd3e6; }
.ct-cell.ok img { filter: brightness(0.2); }
.ct-cell .arrow { font-size: 16px; }
@keyframes flip { from { transform: rotateX(90deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- réponse */
#result:empty { display: none; }
#result { margin-top: 22px; }
.result-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; animation: enter 0.45s cubic-bezier(.2, .9, .3, 1.3); }
.answer {
  display: flex; align-items: center; gap: 16px; padding: 12px 22px 12px 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.05); border: 2px solid var(--line2);
}
.answer.win { border-color: var(--ok); background: linear-gradient(90deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.03)); }
.answer.lose { border-color: var(--bad); background: linear-gradient(90deg, rgba(229, 72, 93, 0.16), rgba(229, 72, 93, 0.03)); }
.answer-img { position: relative; width: 84px; height: 84px; flex: none; }
.answer-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; background: #232b4a; }
.answer-img.wide { width: 150px; }
.answer-extra { position: absolute; right: -10px; bottom: -10px; width: 40px !important; height: 40px !important; padding: 6px; background: #0d1120 !important; border: 2px solid var(--line2); border-radius: 50% !important; }
.answer-kicker { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--muted); }
.answer.win .answer-kicker { color: var(--ok); }
.answer.lose .answer-kicker { color: var(--bad); }
.answer-name { font-family: var(--display); font-size: 30px; font-weight: 700; text-transform: uppercase; line-height: 1.05; }
.answer-sub { color: var(--muted); font-weight: 600; }
.answer-stats { display: flex; gap: 12px; margin-top: 6px; font-weight: 600; font-size: 14px; color: #c5cbe0; flex-wrap: wrap; }
.plus { color: var(--gold); font-weight: 800; }

/* ------------------------------------------------ lobby */
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lobby-grid .settings-card { grid-column: 1 / -1; }
.lobby-grid h3, .mp-side h3 { margin: 0 0 14px; font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.04em; }
.count { color: var(--muted); font-size: 16px; }
.code-card { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: center; gap: 8px; }
.code-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }
.room-code { display: flex; gap: 8px; margin: 4px 0 8px; }
.room-code span {
  width: clamp(50px, 12vw, 68px); aspect-ratio: 0.85; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: clamp(32px, 8vw, 46px);
  border-radius: 14px; background: linear-gradient(180deg, #232b4a, #151b31); border: 2px solid var(--line2);
  box-shadow: 0 6px 0 #0a0d18; animation: enter 0.5s backwards;
}
.room-code span:nth-child(2) { animation-delay: 0.06s; }
.room-code span:nth-child(3) { animation-delay: 0.12s; }
.room-code span:nth-child(4) { animation-delay: 0.18s; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); animation: enter 0.35s; }
.player-list li.me { background: rgba(34, 211, 238, 0.1); }
.pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pname em { color: var(--muted); font-style: normal; font-weight: 500; }
.tag { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--gold); }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 11px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 18px; color: #0a0d18; background: var(--c);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 55%, #000);
}
.avatar.xl { width: 70px; height: 70px; font-size: 34px; border-radius: 20px; }

.setting { margin-bottom: 18px; }
.setting:last-child { margin-bottom: 0; }
.setting > label { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper > b { font-family: var(--display); font-size: 30px; min-width: 44px; text-align: center; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--line2); background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 7px 13px;
  font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.chip-btn.on { background: var(--teal); color: #04222a; border-color: var(--teal); }
.chip-btn:disabled, .mode-toggle:disabled { cursor: default; }
.mode-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-toggle {
  border: 2px solid var(--line2); background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 9px 14px;
  font-weight: 700; cursor: pointer; opacity: 0.55; transition: all 0.15s;
}
.mode-toggle.on { opacity: 1; border-color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.lobby-start { display: flex; flex-direction: column; align-items: center; margin-top: 26px; }
.waiting { font-size: 18px; color: var(--muted); font-weight: 600; }
.dots i { font-style: normal; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* ------------------------------------------------ partie multi */
.round-badge { font-family: var(--display); font-size: 18px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.round-badge b { color: var(--text); font-size: 24px; }
.mp-layout { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
.timer {
  min-width: 64px; height: 44px; border-radius: 12px; display: grid; place-items: center; padding: 0 12px;
  font-family: var(--display); font-size: 26px; font-weight: 700; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line2);
}
.timer.hurry { color: #fff; background: var(--red); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.timebar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin: -4px 0 18px; }
.timebar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--gold), var(--teal)); transition: width 0.1s linear; }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); transition: background 0.3s; }
.board li.me { outline: 1px solid rgba(34, 211, 238, 0.5); }
.board li.solved { background: rgba(34, 197, 94, 0.16); }
.board .avatar { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.board .pos { width: 18px; text-align: center; font-weight: 700; color: var(--muted); }
.pstate { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.board li.solved .pstate { color: var(--ok); font-size: 16px; }
.pscore { font-family: var(--display); min-width: 44px; text-align: right; }
#mpStatus:empty { display: none; }
#mpStatus { margin-top: 18px; display: flex; justify-content: center; }
.solved-banner {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-radius: 16px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.04)); border: 2px solid var(--ok);
  animation: enter 0.4s cubic-bezier(.2, .9, .3, 1.4);
}
.solved-banner .big { font-size: 38px; }

.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(6, 8, 16, 0.72); backdrop-filter: blur(8px); animation: fade 0.25s;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.countdown { text-align: center; }
.cd-kicker { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); font-weight: 700; }
.cd-mode { font-family: var(--display); font-size: clamp(34px, 7vw, 56px); font-weight: 700; text-transform: uppercase; color: var(--c); margin-top: 6px; }
.cd-num { font-family: var(--display); font-size: clamp(110px, 24vw, 200px); font-weight: 700; line-height: 1; animation: count 1s ease-out; text-shadow: 0 0 60px rgba(255, 77, 94, 0.6); }
.cd-desc { color: #b8c0d8; font-size: 18px; margin-top: 8px; }
@keyframes count { from { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }

.round-result {
  width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 22px;
  padding: 22px; display: flex; flex-direction: column; gap: 16px; animation: enter 0.4s cubic-bezier(.2, .9, .3, 1.3);
}
.round-result .answer { align-self: stretch; }
.rr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rr-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); animation: enter 0.35s backwards; }
.rr-list li:nth-child(2) { animation-delay: 0.06s; }
.rr-list li:nth-child(3) { animation-delay: 0.12s; }
.rr-list li:nth-child(4) { animation-delay: 0.18s; }
.rr-list li.me { outline: 1px solid rgba(34, 211, 238, 0.5); }
.rr-list li.miss { opacity: 0.55; }
.rr-list .pos { width: 28px; text-align: center; font-weight: 700; font-size: 18px; }
.rr-list .avatar { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.ptime { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 14px; }
.rr-list .plus { min-width: 54px; text-align: right; }
.rr-next { text-align: center; color: var(--muted); font-weight: 600; }
.rr-next b { color: var(--text); font-family: var(--display); font-size: 20px; }

/* ------------------------------------------------ final */
.final { text-align: center; padding-top: 20px; }
.final-title { font-family: var(--display); font-size: clamp(46px, 9vw, 90px); margin: 0; text-transform: uppercase; background: linear-gradient(90deg, var(--gold), #fff3c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.final-sub { color: #b8c0d8; font-size: 18px; margin: 6px 0 30px; }
.podium { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 200px)); justify-content: center; align-items: end; gap: 12px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: rise 0.7s cubic-bezier(.2, .9, .3, 1.3) backwards; min-width: 0; }
.pod-1 { animation-delay: 0.5s; }
.pod-2 { animation-delay: 0.25s; }
@keyframes rise { from { opacity: 0; transform: translateY(60px); } }
.pod-name { font-weight: 800; font-size: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-score { color: var(--gold); font-weight: 700; }
.pod-step {
  width: 100%; display: grid; place-items: center; border-radius: 16px 16px 6px 6px; margin-top: 6px;
  font-family: var(--display); font-size: 44px; font-weight: 700; border: 1px solid var(--line2);
}
.pod-1 .pod-step { height: 170px; background: linear-gradient(180deg, rgba(245, 184, 61, 0.55), rgba(245, 184, 61, 0.1)); }
.pod-2 .pod-step { height: 120px; background: linear-gradient(180deg, rgba(203, 213, 225, 0.45), rgba(203, 213, 225, 0.08)); }
.pod-3 .pod-step { height: 90px; background: linear-gradient(180deg, rgba(217, 119, 6, 0.45), rgba(217, 119, 6, 0.08)); }
.pod-1 .avatar { box-shadow: 0 0 0 4px var(--gold), 0 0 40px rgba(245, 184, 61, 0.6); }
.final-list { max-width: 420px; margin: 24px auto 0; text-align: left; }
.final-list b { margin-left: auto; font-family: var(--display); }
.final-actions { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 32px; }

/* ------------------------------------------------ toasts & confettis */
.toasts { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 520px); }
.toast {
  padding: 10px 18px; border-radius: 14px; background: #1b2240; border: 1px solid var(--line2); font-weight: 600;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.7); animation: toastIn 0.35s cubic-bezier(.2, .9, .3, 1.5); transition: opacity 0.35s, transform 0.35s;
  text-align: center; word-break: break-word;
}
.toast.good { border-color: var(--ok); }
.toast.bad { border-color: var(--bad); }
.toast.gold { border-color: var(--gold); background: linear-gradient(90deg, #3b2c0b, #1b2240); }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.9); } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ------------------------------------------------ responsive */
@media (max-width: 860px) {
  .mp-layout { grid-template-columns: 1fr; }
  .mp-side { order: -1; padding: 14px; }
  .mp-side h3 { display: none; }
  .board { flex-direction: row; overflow-x: auto; }
  .board li { flex: none; }
  .lobby-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hud { grid-template-columns: repeat(2, 1fr); }
  .hud-item b { font-size: 22px; }
  .modes-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .mode-card { padding: 14px 12px 12px; }
  .mode-icon { font-size: 30px; }
  .mode-name { font-size: 18px; }
  .mode-desc { font-size: 12.5px; }
  .game-card-head { flex-wrap: wrap; }
  .pill span { display: none; }
  .answer-name { font-size: 24px; }
  .answer-img { width: 64px; height: 64px; }
  .answer-img.wide { width: 110px; }
  .podium { gap: 6px; }
  .avatar.xl { width: 52px; height: 52px; font-size: 26px; }
  .pod-1 .pod-step { height: 130px; }
  .pod-2 .pod-step { height: 95px; }
  .pod-3 .pod-step { height: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
