:root {
  --bg: #ffe9b8;
  --panel: #fffaf0;
  --line: #e9d6ae;
  --text: #2b2a33;
  --muted: #6d6452;
  --blue: #1d5fd8;
  --amber: #f59e0b;
  --amber-text: #b45309;
  --red: #c62828;
  --hud: rgba(28, 32, 44, 0.86);
  --hud-text: #ffffff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  /* Fond sombre : même si une bande apparaissait, elle ne serait jamais blanche. */
  background: #090f1c;
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

/* --extend : bande que l'iPhone oublie en bas de l'écran, en mode application. */
html { height: calc(100% + var(--extend, 0px)); }

#stage { position: fixed; inset: 0 0 calc(-1 * var(--extend, 0px)); }
#stage canvas { display: block; }

.screen {
  position: fixed;
  inset: 0 0 calc(-1 * var(--extend, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  overflow-y: auto;
}

.panel {
  width: 100%;
  max-width: 380px;
  margin: auto;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.center { text-align: center; }

h1 { margin: 0 0 20px; font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 26px; }
h3 { margin: 18px 0 6px; font-size: 16px; }
p { margin: 0; }

.eyebrow { margin-bottom: 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.blue { color: var(--blue); }
.amber { color: var(--amber-text); }
.label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 14px; }
.error { min-height: 20px; margin-top: 12px; color: var(--red); font-size: 14px; }

button {
  min-height: 46px;
  padding: 0 14px;
  color: var(--text);
  background: #fff1d6;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.primary { width: 100%; color: #17120a; background: var(--amber); border-color: var(--amber); }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.choices button { padding: 0 4px; font-size: 15px; }
.choices .active { border-color: var(--amber); color: var(--amber-text); background: #fff; }

.separator { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 14px; }
.separator::before, .separator::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  -webkit-user-select: text;
  user-select: text;
}

.join-hint { margin-top: 8px; font-size: 13px; }

/* Viseur de QR code en plein écran. */
.scanner { position: fixed; inset: 0 0 calc(-1 * var(--extend, 0px)); z-index: 20; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(68vw, 280px);
  aspect-ratio: 1;
  border: 4px solid #fde047;
  border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  animation: scanner-pulse 1.4s ease-in-out infinite;
}
@keyframes scanner-pulse { 50% { transform: translate(-50%, -50%) scale(1.04); } }
.scanner-text {
  position: absolute;
  top: calc(28px + var(--safe-top));
  left: 16px;
  right: 16px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
#scanner-close {
  position: absolute;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  min-width: 160px;
  transform: translateX(-50%);
}

.corner { position: absolute; top: calc(12px + var(--safe-top)); right: 12px; z-index: 2; }

.big-code { margin-bottom: 10px; font-size: 44px; font-weight: 800; letter-spacing: 0.14em; color: var(--amber-text); }
.qr {
  display: block;
  width: min(62vw, 230px);
  height: auto;
  margin: 0 auto 14px;
  border-radius: 10px;
  image-rendering: pixelated;
}
.url { margin: 6px 0 16px; font-size: 15px; font-weight: 600; word-break: break-all; -webkit-user-select: text; user-select: text; }
.waiting { margin-bottom: 16px; }

/* Interface de jeu */
#hud { position: fixed; inset: 0 0 calc(-1 * var(--extend, 0px)); }
#touch { position: absolute; inset: 0; touch-action: none; }
#stick {
  position: absolute;
  right: calc(110px + var(--safe-right));
  bottom: calc(110px + var(--safe-bottom));
  width: 0;
  height: 0;
  opacity: 0.6;
  pointer-events: none;
}
#stick.active { opacity: 1; }
#stick::before {
  content: "";
  position: absolute;
  left: -100px;
  top: -100px;
  width: 200px;
  height: 200px;
  border: 2.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: rgba(28, 32, 44, 0.16);
  box-shadow: 0 0 0 1px rgba(28, 32, 44, 0.35);
}
#knob {
  position: absolute;
  left: -24px;
  top: -24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(28, 32, 44, 0.5);
}
/* Sirène allumée : la boule du pad clignote rouge et bleu. */
#knob.siren-on { animation: siren-knob 0.5s steps(2) infinite; }
@keyframes siren-knob {
  0% { box-shadow: 0 0 0 4px #ef4444, 0 0 16px #ef4444; }
  100% { box-shadow: 0 0 0 4px #3b82f6, 0 0 16px #3b82f6; }
}

.hud-top {
  position: absolute;
  top: calc(8px + var(--safe-top));
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
}
.chip {
  justify-self: start;
  min-height: 30px;
  padding: 3px 11px;
  color: var(--hud-text);
  background: var(--hud);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  pointer-events: auto;
}
.chip[data-role="cop"] { color: #9dc2ff; }
.chip[data-role="thief"] { color: #ffb74d; }
.game-menu-chip { min-width: 44px; min-height: 40px; font-size: 20px; padding: 0; }
.timer {
  padding: 1px 11px;
  color: var(--hud-text);
  background: var(--hud);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Tableau de bord : argent, essence et sirène, regroupés en bas à gauche. */
.dash {
  position: absolute;
  left: calc(10px + var(--safe-left));
  bottom: calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: clamp(120px, calc(100vw - 232px), 158px);
  pointer-events: none;
}
.money, .fuel {
  background: var(--hud);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  box-shadow: 0 3px 10px rgba(40, 30, 20, 0.3);
}
.money { padding: 5px 9px 6px; color: var(--hud-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-row { display: flex; align-items: baseline; gap: 4px; }
.money-icon { font-size: 15px; }
#money-stash { color: #fde047; font-size: 16px; font-weight: 900; }
.money-goal { margin-left: auto; color: rgba(255, 255, 255, 0.65); font-size: 10.5px; font-weight: 700; }
.money-bar { position: relative; height: 7px; margin-top: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.money-virtual {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: repeating-linear-gradient(115deg, #60a5fa 0 6px, #3b82f6 6px 12px);
  border-radius: 4px;
  transition: width 0.4s ease-out;
}
.money-fill {
  position: relative;
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(115deg, #fbbf24 0 6px, #f59e0b 6px 12px);
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}
#money-carried { display: block; margin-top: 3px; color: #93c5fd; font-size: 11.5px; font-weight: 700; }
.money.flash { animation: pop-in 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both; }
.dash-row { display: flex; gap: 6px; }

.fuel { flex: 1; align-self: flex-end; min-width: 0; max-width: 96px; padding: 3px 2px 2px; }
.fuel svg { display: block; width: 100%; }
.fuel-arc { fill: none; stroke: #fff; stroke-width: 3.5; }
.fuel-arc--low { stroke: #ef4444; }
.fuel-tick { fill: none; stroke: #fff; stroke-width: 2; }
.fuel-letter { fill: #fff; font-size: 12px; font-weight: 800; text-anchor: middle; }
.fuel-letter--low { fill: #fca5a5; }
.fuel-pump { fill: rgba(255, 255, 255, 0.4); fill-rule: evenodd; }
.fuel-needle { stroke: #fb923c; stroke-width: 3; stroke-linecap: round; }
.fuel-hub { fill: #fff; }
.fuel.low { border-color: #ef4444; animation: fuel-alert 0.8s ease-in-out infinite; }
.fuel.refueling { border-color: #60a5fa; box-shadow: 0 0 10px #60a5fa; }
@keyframes fuel-alert { 50% { background: rgba(185, 28, 28, 0.92); } }

/* Gadgets du voleur : deux emplacements à côté de la jauge, utilisables d'un toucher. */
.gadgets { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gadget {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
  padding: 2px 6px;
  color: var(--hud-text);
  background: var(--hud);
  border: 1.5px solid #fbbf24;
  border-radius: 11px;
  box-shadow: 0 3px 10px rgba(40, 30, 20, 0.3), 0 0 8px rgba(251, 191, 36, 0.45);
  font: inherit;
  pointer-events: auto;
  touch-action: manipulation;
}
.gadget:active { transform: scale(0.94); }
.gadget--new { animation: pop-in 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both; }
.gadget--empty { justify-content: center; border-color: rgba(255, 255, 255, 0.25); box-shadow: none; opacity: 0.55; }
.gadget-icon { font-size: 17px; line-height: 1; }
.gadget-name { overflow: hidden; font-size: 10.5px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }

#siren-anchor { position: absolute; width: 0; height: 0; pointer-events: none; }
#siren-arrow {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 40px;
  height: 40px;
  background: linear-gradient(90deg, #3b82f6 0 50%, #ef4444 50% 100%);
  clip-path: polygon(100% 50%, 0 0, 22% 50%, 0 100%);
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
}

#banner {
  position: absolute;
  top: calc(44px + var(--safe-top));
  left: 16px;
  right: 16px;
  text-align: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}
.banner--count { font-size: 76px !important; font-weight: 800 !important; }

/* Messages : hors du cercle de vision, pour ne jamais cacher la voiture. */
#messages {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
#status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}
#robbery, #securing {
  width: min(100%, 300px);
  padding: 5px 11px 7px;
  color: var(--hud-text);
  background: rgba(180, 83, 9, 0.94);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(40, 30, 20, 0.35);
  animation: pop-in 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
.money-line { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.money-line strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.bar { height: 5px; margin-top: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.28); border-radius: 3px; }
.bar-fill { width: 0; height: 100%; background: #fff; }
#robbery.alarmed { background: rgba(198, 40, 40, 0.95); animation: pop-in 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both, blink 0.5s steps(2) infinite; }
#securing { background: rgba(29, 95, 216, 0.95); }
#bank-prompt {
  padding: 6px 13px;
  color: #fff;
  background: rgba(15, 125, 90, 0.96);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  animation: pop-in 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}

/* Messages qui surgissent en rebondissant, puis s'envolent. */
#popups {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}
.popup {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  padding: 5px 14px 6px;
  color: #fff;
  text-align: center;
  background: var(--hud);
  border: 2.5px solid #fff;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(40, 30, 20, 0.4);
  transform-origin: 50% 80%;
  animation: popup-life 2.6s both;
}
.popup strong { font-size: 18px; font-weight: 800; line-height: 1.15; }
.popup span { font-size: 12.5px; font-weight: 600; }
.popup[data-kind="good"] { background: #16a34a; }
.popup[data-kind="warn"] { background: #d97706; }
.popup[data-kind="bad"] { background: #dc2626; }
.popup[data-kind="money"] { color: #3b2200; background: #fcd34d; }

@keyframes popup-life {
  0% { opacity: 0; transform: translateY(14px) scale(0.3) rotate(calc(var(--tilt, 0deg) * -3)); }
  9% { opacity: 1; transform: translateY(-5px) scale(1.16) rotate(var(--tilt, 0deg)); }
  15% { transform: translateY(1px) scale(0.95) rotate(calc(var(--tilt, 0deg) * -0.6)); }
  21% { transform: translateY(0) scale(1) rotate(var(--tilt, 0deg)); }
  84% { opacity: 1; transform: translateY(0) scale(1) rotate(var(--tilt, 0deg)); }
  100% { opacity: 0; transform: translateY(-32px) scale(0.86) rotate(var(--tilt, 0deg)); }
}
@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.4); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes blink { 50% { filter: brightness(1.3); } }

.coin {
  position: absolute;
  color: #fde047;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #7c2d12, 0 0 4px #7c2d12, 0 2px 6px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  pointer-events: none;
  animation: coin-rise 1s ease-out both;
}
@keyframes coin-rise {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -6px) scale(1.25); }
  100% { opacity: 0; transform: translate(-50%, -62px) scale(0.95); }
}

/* Argent qui vole : du coffre à la voiture, puis en pluie au moment du dépôt. */
/* Au-dessus de l'écran de fin : les confettis du classement se fêtent devant le panneau. */
#fx { position: absolute; z-index: 9; inset: 0; overflow: hidden; pointer-events: none; }
.fly {
  position: absolute;
  top: 0;
  left: 0;
  font-size: var(--size, 22px);
  line-height: 1;
  animation: fly var(--ms, 650ms) ease-in both;
  animation-delay: var(--delay, 0ms);
}
@keyframes fly {
  0% { opacity: 0; transform: translate(var(--x0), var(--y0)) scale(0.5) rotate(0deg); }
  15% { opacity: 1; }
  55% { transform: translate(var(--xm), var(--ym)) scale(1.25) rotate(calc(var(--rot) * 0.5)); }
  100% { opacity: 0.85; transform: translate(var(--x1), var(--y1)) scale(0.6) rotate(var(--rot)); }
}
/* Fête du dépôt : éclair, tremblement et texte encore plus gros pour un méga butin. */
.screen-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, var(--flash) 0%, transparent 70%);
  animation: screen-flash 0.7s ease-out both;
}
@keyframes screen-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.shake-1 { animation: shake 0.35s linear; --shake: 4px; }
.shake-2 { animation: shake 0.5s linear; --shake: 8px; }
.shake-3 { animation: shake 0.8s linear; --shake: 13px; }
@keyframes shake {
  10%, 50%, 90% { transform: translate(calc(var(--shake) * -1), calc(var(--shake) * 0.5)); }
  30%, 70% { transform: translate(var(--shake), calc(var(--shake) * -0.5)); }
  100% { transform: none; }
}
.big-text.big-text--long { white-space: pre-line; }
.big-text.big-text--long { font-size: clamp(30px, 11vw, 50px); line-height: 1.05; }
.big-text.big-text--mega {
  color: #fff7ae;
  font-size: clamp(30px, 10.5vw, 54px);
  -webkit-text-stroke: 2.5px #7c2d12;
  text-shadow: 0 5px 0 #b45309, 0 0 24px #fde047, 0 10px 18px rgba(0, 0, 0, 0.45);
  animation-duration: 2.2s;
}
.refuel {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  color: #fff;
  background: #2563eb;
  border: 2.5px solid #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.45);
  /* Propriété à part : les animations de rebond ne cassent pas le centrage. */
  translate: -50% -100%;
  pointer-events: none;
  animation: pop-in 0.35s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
.refuel.bump { animation: refuel-bump 0.3s ease-out; }
@keyframes refuel-bump { 40% { transform: scale(1.15); } }
.refuel-icon { font-size: 20px; }
.refuel-bar { width: 74px; height: 9px; overflow: hidden; background: rgba(255, 255, 255, 0.3); border-radius: 5px; }
.refuel-fill { height: 100%; background: #fde047; border-radius: 5px; transition: width 0.25s linear; }
#refuel-text { min-width: 40px; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; text-align: right; }

.coin--fuel {
  color: #93c5fd;
  text-shadow: 0 1px 0 #1e3a8a, 0 0 4px #1e3a8a, 0 2px 6px rgba(0, 0, 0, 0.5);
}

.big-text {
  position: absolute;
  top: calc(44px + var(--safe-top));
  left: 0;
  right: 0;
  color: #fde047;
  font-size: clamp(30px, 11vw, 54px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  -webkit-text-stroke: 2px #7c2d12;
  text-shadow: 0 5px 0 #7c2d12, 0 10px 18px rgba(0, 0, 0, 0.45);
  animation: big-text 1.5s both;
}
@keyframes big-text {
  0% { opacity: 0; transform: scale(0.2) rotate(-14deg); }
  18% { opacity: 1; transform: scale(1.3) rotate(5deg); }
  30% { transform: scale(0.92) rotate(-3deg); }
  42% { transform: scale(1.05) rotate(1deg); }
  50%, 78% { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.5) rotate(0deg); }
}

/* Arrestation : texte blanc cerclé de bleu, gyrophares qui balaient l'écran. */
.big-text.big-text--arrest { color: #fff; -webkit-text-stroke: 2px #1e3a8a; text-shadow: -5px 0 0 #ef4444, 5px 0 0 #3b82f6, 0 10px 18px rgba(0, 0, 0, 0.5); animation-duration: 1.9s; }
.strobe { position: absolute; inset: 0; pointer-events: none; animation: strobe 0.5s steps(1) 3 both; }
@keyframes strobe {
  0% { background: radial-gradient(ellipse at 15% 50%, rgba(239, 68, 68, 0.45), transparent 60%); }
  50% { background: radial-gradient(ellipse at 85% 50%, rgba(59, 130, 246, 0.45), transparent 60%); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .strobe { animation: none; }
  .scanner-frame, #knob.siren-on, .shake-1, .shake-2, .shake-3 { animation: none; }
  .screen-flash { animation: popup-fade 0.7s both; }
  .fly, .big-text { animation: popup-fade 0.8s both; transform: translate(var(--x1, 0), var(--y1, 0)); }
  #robbery, #robbery.alarmed, #securing, #bank-prompt, .money.flash, .fuel.low { animation: none; }
  .popup { animation: popup-fade 2.6s both; }
  .coin { animation-name: popup-fade; }
}
@keyframes popup-fade {
  0%, 85% { opacity: 1; }
  100% { opacity: 0; }
}

#end {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 16px;
  background: rgba(40, 30, 20, 0.5);
}
#end h2 { margin-bottom: 8px; font-size: 34px; }
#end .muted { margin-bottom: 14px; }
#end-vote { min-height: 20px; margin-top: 12px; }

/* Règles */
.rules { z-index: 10; align-items: flex-start; background: rgba(40, 30, 20, 0.55); }
.rules-panel { max-width: 520px; user-select: text; -webkit-user-select: text; }
.rules-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note {
  margin-top: 12px;
  padding: 10px 12px;
  color: #7a4a06;
  background: rgba(248, 177, 60, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 8px;
  font-size: 14px;
}
#install-hint { margin-top: 4px; }
#rules-body ul { margin: 0; padding-left: 20px; color: #3b3a44; font-size: 15px; }
#rules-body li { margin-bottom: 4px; }

/* Règles illustrées : une carte par thème, avec une petite scène animée. */
.rule-card {
  margin-top: 14px;
  padding: 0 0 10px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.rule-card h3 { margin: 10px 14px 4px; }
.rule-card ul { margin: 0 14px 0 0 !important; }
.rv {
  position: relative;
  height: 92px;
  overflow: hidden;
  background: linear-gradient(180deg, #d9f2ee, #fff1d6);
  border-bottom: 1px solid var(--line);
}
.rv-emoji { position: absolute; font-size: 30px; line-height: 1; }
.rv-tag {
  position: absolute;
  padding: 3px 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(40, 30, 20, 0.25);
}
.rv-tag--gold { color: #3b2200; background: #fcd34d; }
.rv-tag--bad { background: #dc2626; }
.rv-tag--warn { background: #f97316; }
.rv-tag--blue { background: #2563eb; }

/* Le but : le voleur file au repaire, le flic aux trousses. */
.rv-road { position: absolute; left: 0; right: 0; top: 50px; height: 26px; background: #8b8d96; }
.rv-chase-thief { top: 46px; animation: rv-chase 4s linear infinite; }
.rv-chase-cop { top: 46px; animation: rv-chase 4s linear infinite 0.45s; }
.rv-chase-lair { top: 10px; right: 18px; }
.rv-chase-tag { top: 12px; left: 16px; animation: rv-pulse 1.6s ease-in-out infinite; }
@keyframes rv-chase { from { left: -40px; } to { left: calc(100% - 60px); } }

/* Les banques : les quatre tailles, et les billets qui s'envolent. */
.rv-chips { position: absolute; inset: 12px 10px auto; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.rv-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: 3px 9px; color: #fff; font-size: 14px; font-weight: 900;
  background: #12996f; border-radius: 10px; animation: rv-pop 4s ease-in-out infinite;
}
.rv-chip b { font-size: 11px; font-weight: 700; opacity: 0.9; }
.rv-chip:nth-child(2) { animation-delay: 0.25s; }
.rv-chip:nth-child(3) { animation-delay: 0.5s; }
.rv-chip--gold { color: #3b2200; background: #eab308; animation-delay: 0.75s; }
.rv-bill { font-size: 20px; bottom: -24px; animation: rv-rise 2.4s ease-out infinite; }
.rv-bill--1 { left: 20%; }
.rv-bill--2 { left: 50%; animation-delay: 0.8s; }
.rv-bill--3 { left: 78%; animation-delay: 1.6s; }
@keyframes rv-rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-110px) rotate(25deg); opacity: 0; } }
@keyframes rv-pop { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.12); } }

/* Le repaire : l'argent quitte la voiture, la barre monte, JACKPOT. */
.rv-lair-car { left: 14%; top: 14px; }
.rv-lair-cash { left: 22%; top: 12px; font-size: 22px; animation: rv-deposit 3s ease-in-out infinite; }
.rv-lair-home { right: 14%; top: 10px; }
.rv-progress { position: absolute; left: 14%; right: 14%; bottom: 14px; height: 10px; overflow: hidden; background: rgba(0, 0, 0, 0.1); border-radius: 5px; }
.rv-progress i { display: block; height: 100%; background: repeating-linear-gradient(115deg, #fbbf24 0 6px, #f59e0b 6px 12px); animation: rv-fill 3s ease-in-out infinite; }
.rv-lair-jackpot { right: 10%; top: 44px; animation: rv-jackpot 3s ease-in-out infinite; }
@keyframes rv-deposit { 0%, 15% { left: 22%; opacity: 1; } 55% { left: 74%; opacity: 1; } 60%, 100% { left: 74%; opacity: 0; } }
@keyframes rv-fill { 0%, 50% { width: 30%; } 65%, 100% { width: 62%; } }
@keyframes rv-jackpot { 0%, 55% { opacity: 0; transform: scale(0.4); } 65% { opacity: 1; transform: scale(1.15); } 75%, 92% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }

/* Le contrôle : contact sans argent, le flic reste bloqué. */
.rv-control-thief { top: 36px; left: 52%; }
.rv-control-cop { top: 36px; animation: rv-bump 3s ease-in-out infinite; }
.rv-control-tag { top: 8px; left: 50%; translate: -50% 0; animation: rv-show 3s ease-in-out infinite; }
@keyframes rv-bump { 0% { left: 10%; } 35%, 85% { left: calc(52% - 30px); filter: none; } 45%, 55%, 65%, 75% { filter: grayscale(1) opacity(0.5); } 100% { left: 10%; } }
@keyframes rv-show { 0%, 33% { opacity: 0; } 40%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* Sécuriser : le flic reste arrêté, l'anneau se remplit en 5 s. */
.rv-secure-bank { left: calc(50% - 50px); top: 22px; font-size: 38px; }
.rv-secure-cop { left: calc(50% + 14px); top: 32px; }
.rv-ring {
  position: absolute; left: calc(50% + 4px); top: 22px; width: 50px; height: 50px; border-radius: 50%;
  background: conic-gradient(#2563eb var(--p, 0%), rgba(37, 99, 235, 0.15) 0);
  mask: radial-gradient(circle, transparent 54%, #000 56%);
  animation: rv-ring 4s linear infinite;
}
.rv-secure-tag { right: 8%; top: 32px; animation: rv-stamp 4s ease-in-out infinite; }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@keyframes rv-ring { 0% { --p: 0%; } 70%, 100% { --p: 100%; } }
@keyframes rv-stamp { 0%, 70% { opacity: 0; transform: scale(1.8) rotate(-12deg); } 78%, 95% { opacity: 1; transform: scale(1) rotate(-6deg); } 100% { opacity: 0; } }

/* L'alerte : la flèche se resserre à chaque alarme ; le signalement est orange. */
.rv-radar { position: absolute; left: 50%; top: 6px; width: 80px; height: 80px; translate: -50% 0; border: 2px dashed rgba(0, 0, 0, 0.15); border-radius: 50%; }
.rv-wedge {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from calc(60deg - var(--s, 45deg)), #dc2626 0 calc(var(--s, 45deg) * 2), transparent 0);
  mask: radial-gradient(circle, transparent 58%, #000 60%);
  animation: rv-narrow 6s steps(1) infinite;
}
.rv-radar-cop { left: 50%; top: 50%; font-size: 24px; translate: -50% -50%; }
.rv-alert-tag { left: 8%; top: 14px; }
.rv-report-tag { right: 6%; bottom: 12px; }
@property --s { syntax: '<angle>'; inherits: false; initial-value: 45deg; }
@keyframes rv-narrow { 0% { --s: 45deg; } 33% { --s: 30deg; } 66% { --s: 15deg; } }

/* La sirène : deux touches au centre du pad. */
.rv-pad { position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; translate: -50% -50%; border: 2px solid rgba(40, 30, 20, 0.35); border-radius: 50%; background: rgba(28, 32, 44, 0.08); }
.rv-knob { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; translate: -50% -50%; display: flex; align-items: center; justify-content: center; font-size: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(28, 32, 44, 0.4); animation: siren-knob 0.5s steps(2) infinite; }
.rv-tap { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; translate: -50% -50%; border: 3px solid #fde047; border-radius: 50%; opacity: 0; animation: rv-tap 2.4s ease-out infinite; }
.rv-tap--2 { animation-delay: 0.25s; }
.rv-siren-tag { right: 8%; top: 14px; }
@keyframes rv-tap { 0% { opacity: 0.9; transform: scale(0.6); } 25% { opacity: 0; transform: scale(1.8); } 100% { opacity: 0; } }

/* L'essence : la jauge monte à la pompe. */
.rv-fuel-pump { left: 12%; top: 26px; font-size: 34px; }
.rv-fuelbar { position: absolute; left: 50%; top: 32px; display: flex; align-items: center; gap: 6px; padding: 4px 10px; translate: -50% 0; color: #fff; background: #2563eb; border: 2px solid #fff; border-radius: 999px; }
.rv-fuelbar div { width: 80px; height: 9px; overflow: hidden; background: rgba(255, 255, 255, 0.3); border-radius: 5px; }
.rv-fuelbar i { display: block; height: 100%; background: #fde047; animation: rv-fuel 4s linear infinite; }
.rv-fuel-tag { right: 6%; bottom: 10px; }
@keyframes rv-fuel { from { width: 10%; } to { width: 100%; } }

/* La conduite : on tire le pouce, la voiture suit et dérape. */
.rv-pad--drive { left: 26%; }
.rv-knob--drive { animation: rv-drive 3s ease-in-out infinite; }
.rv-drive-car { left: 64%; top: 30px; animation: rv-steer 3s ease-in-out infinite; }
.rv-skid { position: absolute; left: 58%; top: 62px; width: 60px; height: 6px; border-top: 3px dotted rgba(40, 30, 20, 0.35); animation: rv-show 3s ease-in-out infinite; }
@keyframes rv-drive { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(18px, -12px); } 60% { transform: translate(-16px, 10px); } }
@keyframes rv-steer { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-30deg) translateX(8px); } 60% { transform: rotate(150deg); } }
@keyframes rv-pulse { 50% { transform: scale(1.08); } }

@media (prefers-reduced-motion: reduce) {
  .rv * { animation: none !important; }
}
/* Les emojis de voiture regardent à gauche : on les retourne pour qu'ils roulent vers la droite. */
.rv-chase-thief, .rv-chase-cop, .rv-lair-car, .rv-control-cop, .rv-control-thief { scale: -1 1; }
.rv-secure-tag { top: 56px; right: 5%; }
.rv-fuel-tag { top: 8px; bottom: auto; }

/* Accueil : commandes d'arcade, insignes de police et affiche Wanted. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#menu { color: #fff; padding: calc(22px + var(--safe-top)) max(24px, var(--safe-left)) calc(28px + var(--safe-bottom)); background: radial-gradient(ellipse at 8% 45%, #123e62 0, transparent 55%), radial-gradient(ellipse at 95% 60%, #4b1e2d 0, transparent 50%), #090f1c; }
#menu::before { content: ''; position: fixed; inset: 0 0 calc(-1 * var(--extend, 0px)); pointer-events: none; background: repeating-linear-gradient(115deg, transparent 0 100px, #ffffff03 100px 104px, transparent 104px 140px); }
.menu-shell { width: 100%; max-width: 1120px; min-width: 0; margin: auto; position: relative; }
.menu-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.game-mark { display: flex; align-items: center; gap: 9px; font-size: 11px; letter-spacing: .1em; font-weight: 1000; font-style: italic; color: #b4cfe4; }
.game-mark > span { color: #ffd55e; font-size: 25px; text-shadow: 0 2px #95601e; }
#rules-open { display: flex; align-items: center; gap: 8px; min-height: 39px; padding: 0 15px; background: linear-gradient(#3b5069, #243349); border: 2px solid #7890ac; color: #fff; border-radius: 12px; font-size: 12px; font-weight: 900; box-shadow: 0 4px 0 #060d19, inset 0 2px #ffffff25; transform: rotate(2deg); }
#rules-open > span { display: grid; place-items: center; width: 22px; height: 22px; color: #1a2b40; background: #ffdb68; border-radius: 50%; font-size: 16px; font-weight: 1000; }
.menu-layout { display: grid; grid-template-columns: minmax(0, 1.23fr) minmax(0, 1fr); align-items: center; gap: 42px; }
.menu-layout > * { min-width: 0; }
.menu-hero { position: relative; min-height: 570px; overflow: hidden; border-radius: 24px; border: 2px solid #3d6583; background: #10253d; isolation: isolate; box-shadow: 0 7px 0 #050c17, 0 25px 60px #0006; }
.menu-hero::after { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(#0c2034 0%, #0c2034c9 22%, transparent 44%, transparent 72%, #091726 100%); }
.chase-art { position: absolute; z-index: -2; left: 0; bottom: 28px; width: 100%; height: auto; }
.hero-copy { padding: 30px 25px 0; }
.hero-tag { display: flex; align-items: center; gap: 8px; color: #9cc8df; font-size: 9px; letter-spacing: .14em; font-weight: 800; }
.hero-tag > span { height: 7px; width: 7px; border-radius: 50%; background: #55e3dd; box-shadow: 0 0 12px #55e3dd; }
#menu h1 { margin: 15px 0 10px; font-size: clamp(42px, 4.6vw, 64px); line-height: 1; letter-spacing: -.065em; font-weight: 1000; font-style: italic; color: #fff; text-shadow: 0 4px 0 #356381, 0 8px 18px #0006; }
#menu h1 > span { display: block; margin-top: 11px; font-size: .51em; color: #ffc04b; letter-spacing: -.045em; text-shadow: 0 3px 0 #8e4b20; }
.hero-subtitle { color: #c4d4e4; font-size: 12px; }
.hero-bottom { position: absolute; bottom: 22px; left: 25px; right: 25px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hero-bottom > span:last-child { max-width: 140px; color: #b7cadd; font-size: 10px; text-align: right; }
.versus { display: flex; align-items: center; gap: 10px; font-size: 12px; font-style: italic; }
.versus b:first-child { color: #69caff; }.versus b:last-child { color: #ffc04b; }
.versus i { display: grid; place-items: center; height: 29px; width: 29px; background: #df533b; border: 2px solid #ff956d; border-radius: 8px; transform: rotate(-9deg); font-size: 11px; font-weight: 900; box-shadow: 0 3px #6b201d; }
#menu .menu-panel { padding: 10px 3px 5px; margin: 0; max-width: none; border: 0; background: none; border-radius: 0; position: relative; }
.menu-panel-heading { text-align: center; position: relative; margin-bottom: 24px; }
.lightbar { display: flex; gap: 5px; width: 91px; height: 20px; padding: 3px; margin: 0 auto 12px; background: #10131c; border: 2px solid #627489; border-radius: 9px 9px 3px 3px; box-shadow: 0 3px #020811; transform: rotate(-4deg); }
.lightbar i { flex: 1; border-radius: 5px 5px 1px 1px; background: linear-gradient(#8ce5ff, #1176ef); box-shadow: 0 0 20px #268cff88; }.lightbar i:last-child { background: linear-gradient(#ffa09a, #ef344a); box-shadow: 0 0 20px #f43a5388; }
#menu h2 { font-size: clamp(28px, 2.9vw, 40px); font-style: italic; font-weight: 1000; line-height: 1; text-transform: uppercase; letter-spacing: -.045em; text-shadow: 2px 4px 0 #060c19; transform: rotate(-3deg); }
#menu h2 > span { display: block; font-size: 12px; letter-spacing: .1em; margin-top: 10px; color: #ffda64; }
#menu .choices { gap: 11px; margin-bottom: 27px; align-items: center; }
#menu .choices button { --edge: #559edb; --base: #184a83; position: relative; min-width: 0; min-height: 174px; display: flex; flex-direction: column; align-items: center; padding: 12px 4px 14px; border: 3px solid var(--edge); border-radius: 17px; color: #fff; background: radial-gradient(ellipse at 50% 15%, #ffffff28, transparent 70%), var(--base); box-shadow: 0 7px 0 #050b17, inset 0 3px 0 #ffffff25; transition: transform .16s, filter .16s; transform: rotate(-3deg); }
#menu .choices [data-pick="thief"] { --edge: #e9b562; --base: #764023; transform: rotate(2deg); background: repeating-linear-gradient(0deg, #00000005 0 2px, transparent 2px 5px), radial-gradient(ellipse at 50% 15%, #ffffff30, transparent 70%), var(--base); }
#menu .choices [data-pick="random"] { --edge: #bd9be8; --base: #593589; transform: rotate(4deg); }
.role-stamp { color: #e2f2ff; font: 1000 9px/1.2 monospace; letter-spacing: .12em; margin-bottom: 5px; }
#menu .choices svg { width: 68px; height: 68px; margin-bottom: 7px; overflow: visible; filter: drop-shadow(0 4px 0 #0006); }
.badge-edge { fill: #f6c657; stroke: #ffeab4; stroke-width: 2; }.badge-center { fill: #2870b4; stroke: #a67520; stroke-width: 2; }.badge-star { fill: #ffe388; }
.thief-hat { fill: #1e1c29; stroke: #55404b; stroke-width: 2; }.thief-face { fill: #ffc08b; }.thief-mask { fill: #252334; }.thief-eyes { fill: #fff9d9; }.thief-smile { fill: none; stroke: #6b3426; stroke-width: 3; stroke-linecap: round; }
.dice-edge { fill: #bb8e38; stroke: #fff1c2; stroke-width: 2; }.dice-face { fill: #ffe6a3; }.dice-dots { fill: #62408c; }
#menu .choices strong { color: #fff; font-size: 18px; font-weight: 1000; font-style: italic; letter-spacing: -.045em; text-shadow: 0 2px #0008; white-space: nowrap; }
#menu .choices small { font-size: 9px; margin-top: 3px; font-weight: 700; color: #fff0d6; }
.role-selected { display: none; }
#menu .choices .active { border-color: #fff0a9; box-shadow: 0 7px 0 #66431e, 0 0 0 3px #ffca47, 0 0 28px #ffca4730, inset 0 3px 0 #ffffff40; transform: translateY(-7px) rotate(-2deg); }
#menu .choices .active .role-selected { display: grid; place-items: center; position: absolute; right: -9px; top: -11px; width: 26px; height: 26px; border-radius: 50%; color: #242237; background: #ffdc62; border: 2px solid #fff4c2; box-shadow: 0 3px #8b581e; font-size: 17px; font-weight: 1000; }
#menu #create { position: relative; display: flex; align-items: center; justify-content: center; gap: 15px; min-height: 83px; padding: 10px 18px; color: #143b28; background: linear-gradient(170deg, #d1ff80, #7eda3d 55%, #57b92e); border: 3px solid #d9ffa0; border-radius: 18px; box-shadow: 0 7px #277523, 0 10px 0 3px #07120c, inset 0 3px #f0ffc0; transform: rotate(-2deg); text-shadow: 0 1px #e4ffab; }
.start-copy { display: flex; flex-direction: column; font-size: clamp(25px, 2.7vw, 34px); font-weight: 1000; font-style: italic; line-height: 1; letter-spacing: -.04em; }
.start-copy small { font-size: 10px; letter-spacing: .08em; font-style: normal; text-transform: uppercase; margin-top: 7px; }
.start-arrow { font-size: 26px; filter: drop-shadow(0 2px #e4ffab); }.speed-lines { font-size: 25px; letter-spacing: -.2em; opacity: .65; margin-left: auto; }
.create-hint { margin-top: 19px; text-align: center; font-size: 10px; font-weight: 800; color: #b5c4d8; }
#menu .separator { gap: 10px; margin: 24px 0 18px; font-size: 10px; font-weight: 1000; color: #ffdb68; font-style: italic; }
#menu .separator::before, #menu .separator::after { height: 7px; background: repeating-linear-gradient(120deg, #ffcd4d 0 7px, #1c2634 7px 14px); border-radius: 2px; }
#join-form { padding: 13px 14px 11px; background: #182536; border: 2px solid #586b83; border-radius: 14px; box-shadow: 0 5px #040b16, inset 0 2px #ffffff14; position: relative; }
#menu .label { display: flex; justify-content: space-between; align-items: center; margin: 0 0 9px; font: 900 10px/1.4 monospace; letter-spacing: .04em; color: #b2c7e0; }
#menu .label > span:last-child { color: #e2b452; font-size: 10px; }
#menu .join-row { gap: 9px; }
#menu .join-row input { height: 48px; background: linear-gradient(#fffcdf, #dbddcd); border: 3px solid #a0adba; outline-offset: 4px; border-radius: 7px; color: #1c304f; font: 1000 22px/1 monospace; text-align: center; letter-spacing: .16em; box-shadow: inset 0 2px #0002, 0 3px #060c18; }
#menu .join-row input::placeholder { color: #66758a; font-size: 16px; letter-spacing: 0; opacity: 1; }
#menu .join-row button { min-height: 48px; padding: 0 10px; color: #fff; background: linear-gradient(#4ea7ed, #2668c5); border: 2px solid #91d6ff; border-radius: 9px; box-shadow: 0 4px #133768, inset 0 2px #ffffff33; font-weight: 1000; font-size: 11px; font-style: italic; text-shadow: 0 2px #23518d; }
#menu .join-row button > span { margin-left: 4px; }
#menu .join-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; color: #b0c4db; font-size: 9px; }
.join-hint svg { flex-shrink: 0; width: 21px; height: 21px; fill: none; stroke: #b0c4db; stroke-width: 1.7; }
#menu .error { color: #ffada4; min-height: 0; margin-top: 0; font-weight: 700; }#menu .error:not(:empty) { margin-top: 14px; }
#menu .note { color: #e5c98c; background: #ffb9320c; border-color: #ffb93240; font-size: 11px; margin-top: 14px; }
#menu button:focus-visible, #menu input:focus-visible { outline: 3px solid #fff; outline-offset: 6px; }
@media (hover: hover) { #menu button:hover { filter: brightness(1.15); } #menu .choices button:hover { transform: translateY(-7px) rotate(0); } }
#menu button:active, #menu .choices button:active { transform: translateY(4px) rotate(0); }#menu #create:active { transform: translateY(5px) rotate(-2deg); box-shadow: 0 2px #277523, 0 5px 0 3px #07120c; }
@keyframes siren-blue { 50% { opacity: .55; } }
@media (prefers-reduced-motion: no-preference) { .lightbar i { animation: siren-blue 2s ease-in-out infinite; }.lightbar i:last-child { animation-delay: 1s; } }
@media (max-width: 760px) {
  #menu { padding: calc(12px + var(--safe-top)) max(16px, var(--safe-left)) calc(25px + var(--safe-bottom)); }
  .menu-shell { max-width: 460px; }.menu-topbar { margin-bottom: 16px; }.game-mark { font-size: 9px; }
  #rules-open { font-size: 11px; padding: 0 10px; min-height: 36px; }
  .menu-layout { grid-template-columns: minmax(0, 1fr); gap: 21px; }
  .menu-hero { min-height: 290px; border-radius: 22px; }.hero-copy { padding: 18px 19px 0; }.hero-tag { font-size: 8px; }
  #menu h1 { font-size: clamp(38px, 11.5vw, 55px); margin-top: 12px; }#menu h1 > span { font-size: .47em; margin-top: 8px; }
  .hero-subtitle { font-size: 10px; }.chase-art { bottom: 23px; }
  .menu-hero::after { background: linear-gradient(#0c2034eb, #0c20346b 35%, transparent 56%, #091726c9 100%); }
  .hero-bottom { bottom: 14px; left: 19px; right: 19px; }.hero-bottom > span:last-child { font-size: 9px; max-width: 120px; }.versus { font-size: 11px; gap: 8px; }.versus i { width: 24px; height: 24px; font-size: 9px; }
  #menu .menu-panel { padding: 0 4px; }.menu-panel-heading { margin-bottom: 20px; }.lightbar { width: 74px; height: 17px; margin-bottom: 10px; }
  #menu h2 { font-size: 29px; }#menu h2 > span { font-size: 10px; margin-top: 7px; }
  #menu .choices { gap: 10px; margin-bottom: 24px; }#menu .choices button { min-height: 150px; padding-top: 9px; }
  #menu .choices svg { width: 57px; height: 57px; margin-bottom: 5px; }#menu .choices strong { font-size: 16px; }#menu .choices small { font-size: 8px; }.role-stamp { font-size: 8px; }
  #menu #create { min-height: 76px; }.start-copy { font-size: 29px; }.create-hint { font-size: 9px; }
}
@media (max-width: 360px) { #menu .choices strong { font-size: 14px; }#menu .choices small { font-size: 7px; }#join-form { padding: 11px 9px; }#menu .join-row button { font-size: 10px; padding: 0 7px; }.start-copy { font-size: 26px; }.game-mark { letter-spacing: 0; } }
@media (prefers-reduced-motion: reduce) { #menu * { transition: none !important; } }

/* Téléphone en paysage : le cadre tient dans la hauteur de l'écran, la voiture reste visible. */
@media (orientation: landscape) and (max-height: 520px) {
  .menu-topbar { margin-bottom: 12px; }
  .menu-layout { align-items: start; gap: 24px; }
  .menu-hero { min-height: max(250px, calc(100dvh - 100px)); }
  .hero-copy { padding: 16px 20px 0; }
  #menu h1 { font-size: clamp(32px, 5vw, 46px); margin-top: 8px; }
  .chase-art { bottom: 0; }
  .hero-bottom { bottom: 12px; }
}

/* ===== Pages de menu au style de l'accueil : règles, QR code de création, fin de partie. ===== */
.dark-screen { color: #fff; background: radial-gradient(ellipse at 8% 45%, #123e62 0, transparent 55%), radial-gradient(ellipse at 95% 60%, #4b1e2d 0, transparent 50%), #090f1c; }
.rules.dark-screen { background: rgba(6, 11, 22, 0.92); }
.dark-panel {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 18px 18px 20px;
  color: #dce6f2;
  text-align: center;
  background: #10253d;
  border: 2px solid #3d6583;
  border-radius: 22px;
  box-shadow: 0 7px 0 #050c17, 0 25px 60px #0006;
}
.dark-title { margin: 0 0 14px; color: #fff; font-size: 28px; font-weight: 1000; font-style: italic; line-height: 1; letter-spacing: -0.045em; text-transform: uppercase; text-shadow: 2px 4px 0 #060c19; transform: rotate(-2deg); }
.dark-title > span { display: block; margin-top: 8px; color: #ffda64; font-size: 11px; letter-spacing: 0.1em; }
.dark-label { margin: 14px 0 2px; color: #b2c7e0; font: 900 10px/1.4 monospace; letter-spacing: 0.08em; }
.dark-muted { color: #b0c4db; font-size: 12px; }
.dark-button {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: linear-gradient(#3b5069, #243349);
  border: 2px solid #7890ac;
  border-radius: 12px;
  font-weight: 900;
  box-shadow: 0 4px 0 #060d19, inset 0 2px #ffffff25;
}
.dark-button:active { transform: translateY(3px); box-shadow: 0 1px 0 #060d19; }

.wait-panel .big-code { margin: 0 0 10px; color: #ffc04b; font: 1000 44px/1 monospace; letter-spacing: 0.18em; text-shadow: 0 3px 0 #8e4b20; }
.qr-frame { display: inline-block; padding: 10px; background: #fff; border: 4px solid #ffcd4d; border-radius: 18px; box-shadow: 0 6px 0 #6b4a12, 0 0 30px #ffca4740; transform: rotate(-1.5deg); }
.qr-frame .qr { width: min(54vw, 210px); margin: 0; border-radius: 6px; }
.wait-panel .url { margin: 4px 0 12px; color: #9cc8df; font-size: 12px; }
.wait-panel .waiting { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; font-weight: 800; }
.waiting-dot { width: 9px; height: 9px; border-radius: 50%; background: #55e3dd; box-shadow: 0 0 12px #55e3dd; animation: waiting-pulse 1.2s ease-in-out infinite; }
@keyframes waiting-pulse { 50% { opacity: 0.25; transform: scale(0.7); } }

/* Règles : cartes sombres, illustrations conservées. */
.rules-panel { max-width: 540px; text-align: left; user-select: text; -webkit-user-select: text; }
.rules-panel .rules-head { align-items: flex-start; }
.rules-panel .dark-title { text-align: left; }
.rules-panel .note { color: #e5c98c; background: #ffb9320c; border-color: #ffb93240; }
.rules-panel .rule-card { background: #182536; border: 2px solid #586b83; box-shadow: 0 5px #040b16; }
.rules-panel .rule-card h3 { color: #ffda64; font-style: italic; font-weight: 1000; text-transform: uppercase; letter-spacing: -0.02em; }
.rules-panel #rules-body ul { color: #dce6f2; }
.rules-panel .rv { background: linear-gradient(180deg, #1f4466, #2b2340); border-bottom: 2px solid #3d6583; }
.rules-panel .rv-road { background: #4a5568; }
.rules-panel .rv-pad { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.06); }
.rules-panel .rv-skid { border-top-color: rgba(255, 255, 255, 0.35); }
.rules-panel .rv-radar { border-color: rgba(255, 255, 255, 0.2); }

/* Fin de partie. */
#end { overflow-y: auto; padding: calc(16px + var(--safe-top)) max(16px, var(--safe-left)) calc(20px + var(--safe-bottom)); }
#end .end-panel { max-width: 540px; padding: 12px 16px 20px; }
.end-art-frame { position: relative; overflow: hidden; margin: 0 0 14px; border-radius: 13px; background: #0a1728; border: 1px solid #597895; isolation: isolate; }
.end-art { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
/* Reflet qui balaie l'image une fois révélée : doré pour les voleurs, rouge et bleu pour la police. */
.end-art-frame::after { content: ''; position: absolute; inset: 0; pointer-events: none; transform: translateX(-130%); background: linear-gradient(105deg, transparent 35%, #fff5c890 50%, transparent 65%); }
#end[data-winner="cop"] .end-art-frame::after { background: linear-gradient(105deg, transparent 28%, #3b82f680 44%, #ef444480 56%, transparent 72%); }
#end[data-winner="cop"] .end-panel { border-color: #6caee6; box-shadow: -10px 0 45px #1966f52b, 10px 0 45px #f5264720, 0 7px 0 #050c17; }
#end[data-winner="thief"] .end-panel { border-color: #e9bd67; box-shadow: 0 0 50px #ffc34625, 0 7px 0 #050c17; }
#end[data-winner="thief"] .lightbar { display: none; }
/* Majuscules par le style : le nom reste reconnaissable pour la traduction (« 🤖 Bot Normal »). */
#end .end-panel #end-versus { margin: 0 0 10px; text-transform: uppercase; }
#end .end-panel #end-detail { font-size: 13px; }
#end .end-panel .end-replay { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }
#end .end-panel .end-replay button { width: 100%; margin: 0; min-height: 52px; font-size: 14px; line-height: 1.15; padding: 6px 8px; }
#end .end-panel .end-replay button.chosen { outline: 3px solid #ffda64; outline-offset: 1px; }
#end .end-panel #end-vote:empty { min-height: 0; margin: 0 0 10px; }
@media (max-height: 540px) and (orientation: landscape) {
  #end .end-panel { max-width: 820px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: center; padding: 14px; }
  #end .end-art-frame { grid-column: 1; grid-row: 1 / span 8; margin: 0; }
  #end .end-panel > :not(.end-art-frame) { grid-column: 2; }
  #end .end-panel .lightbar { margin-bottom: 6px; }
  #end .end-panel h2 { font-size: 28px; }
  #end .end-panel .end-replay button { min-height: 44px; font-size: 13px; }
}
#end { background: rgba(6, 11, 22, 0.7); }

/* Fin de partie : le voile tombe, le panneau monte, l'image se révèle, puis le titre claque. */
@media (prefers-reduced-motion: no-preference) {
  #end.reveal { animation: end-backdrop 0.5s ease-out both; }
  #end.reveal .end-panel { animation: end-panel 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) 0.1s both; }
  #end.reveal .end-art { animation: end-art 1.4s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both; }
  #end.reveal .end-art-frame::after { animation: end-sheen 1.1s ease-in-out 1.2s both; }
  #end.reveal h2 { animation: end-title 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) 0.8s both; }
  #end.reveal .end-panel > :not(.end-art-frame):not(h2):not(.lightbar) { animation: end-rise 0.45s ease-out 1.05s both; }
}
@keyframes end-backdrop { from { background-color: rgba(6, 11, 22, 0); } }
@keyframes end-panel { from { opacity: 0; transform: translateY(70px) scale(0.9); } }
@keyframes end-art {
  0% { opacity: 0; transform: scale(1.35); filter: blur(12px) brightness(2.2) saturate(0.4); }
  35% { opacity: 1; }
  100% { transform: scale(1); filter: none; }
}
@keyframes end-sheen { from { transform: translateX(-130%); } to { transform: translateX(130%); } }
@keyframes end-title { from { opacity: 0; transform: scale(2.4) rotate(-6deg); } }
@keyframes end-rise { from { opacity: 0; transform: translateY(14px); } }
.end-panel h2 { margin: 0 0 8px; color: #fff; font-size: 40px; font-weight: 1000; font-style: italic; letter-spacing: -0.05em; text-transform: uppercase; text-shadow: 0 4px 0 #356381, 0 8px 18px #0006; }
.end-panel .muted { color: #c4d4e4; }
.end-panel .primary { min-height: 60px; color: #143b28; background: linear-gradient(170deg, #d1ff80, #7eda3d 55%, #57b92e); border: 3px solid #d9ffa0; border-radius: 16px; font-weight: 1000; font-style: italic; box-shadow: 0 6px #277523, 0 8px 0 3px #07120c; }
.end-panel #end-menu { margin-top: 4px; color: #fff; background: linear-gradient(#3b5069, #243349); border: 2px solid #7890ac; border-radius: 12px; box-shadow: 0 4px 0 #060d19; }
.end-panel #end-vote { color: #ffda64; font-weight: 800; }

/* ===== Accueil sur un seul écran en portrait : l'image s'adapte à la place restante. ===== */
@media (orientation: portrait) and (max-width: 760px) {
  #menu { overflow-y: auto; padding-top: calc(10px + var(--safe-top)); padding-bottom: calc(12px + var(--safe-bottom)); }
  .menu-shell { display: flex; flex-direction: column; min-height: 100%; }
  .menu-topbar { margin-bottom: 1.2dvh; }
  .menu-layout { flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 1.6dvh; }
  .menu-hero { flex: 1 1 0; min-height: 150px; }
  .chase-art { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 72%; }
  .hero-copy { padding: 1.8dvh 18px 0; }
  #menu h1 { font-size: clamp(30px, 5.4dvh, 52px); margin: 1dvh 0 0.8dvh; }
  .hero-subtitle { display: none; }
  .menu-panel-heading { margin-bottom: 1.6dvh; }
  .lightbar { margin-bottom: 0.8dvh; }
  #menu h2 { font-size: clamp(22px, 3.4dvh, 29px); }
  #menu h2 > span { margin-top: 0.6dvh; }
  #menu .choices { margin-bottom: 2dvh; }
  #menu .choices button { min-height: clamp(96px, 16dvh, 150px); padding: 1dvh 4px; }
  #menu .choices svg { width: clamp(36px, 6.5dvh, 57px); height: clamp(36px, 6.5dvh, 57px); }
  #menu #create { min-height: clamp(56px, 8.5dvh, 76px); }
  .start-copy { font-size: clamp(22px, 3.4dvh, 29px); }
  .create-hint { margin-top: 1.4dvh; }
  #menu .separator { margin: 1.6dvh 0 1.2dvh; }
  #join-form { padding: 1.2dvh 12px 1dvh; }
  #menu .join-hint { margin-top: 0.8dvh; }
}
/* Très petits écrans : on retire le superflu plutôt que de faire défiler. */
@media (orientation: portrait) and (max-height: 700px) {
  .lightbar, .create-hint, .hero-tag, .hero-bottom > span:last-child { display: none; }
  #menu .choices small { display: none; }
  #menu .label { margin-bottom: 5px; }
}

/* ===== Écrans de menu en paysage sur téléphone : on demande de tourner l'appareil. ===== */
.rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  body:not([data-screen="game"]) .rotate-hint {
    position: fixed;
    inset: 0 0 calc(-1 * var(--extend, 0px));
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    text-align: center;
    background: radial-gradient(ellipse at 30% 40%, #123e62 0, transparent 60%), #090f1c;
  }
  .rotate-hint p { margin: 0; font-size: 26px; font-weight: 1000; font-style: italic; text-transform: uppercase; letter-spacing: -0.04em; }
  .rotate-hint span { color: #ffda64; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; }
  .rotate-phone { font-size: 54px; animation: rotate-phone 2s ease-in-out infinite; }
}
@keyframes rotate-phone { 0%, 20% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }

/* Mode solo : lien discret sous le grand bouton, au style de l'accueil. */
.solo-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 38px;
  margin-top: 12px;
  padding: 4px 12px;
  color: #dce6f2;
  background: #1a2c42;
  border: 2px dashed #5a7896;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.solo-button b { color: #ffda64; font-weight: 1000; font-style: italic; }
@media (orientation: portrait) and (max-width: 760px) {
  .solo-button { margin-top: 1.2dvh; min-height: clamp(32px, 4.6dvh, 40px); }
}
@media (orientation: portrait) and (max-height: 700px) {
  .solo-button { min-height: 30px; margin-top: 6px; font-size: 11px; }
  #menu .separator { margin: 1dvh 0 0.8dvh; }
}

/* Messages en haut de l'écran : compacts, le plus récent en premier, jamais sur la voiture. */
#messages { overflow: hidden; }
#popups { flex-direction: column-reverse; }
.popup { padding: 4px 13px 5px; }
.popup strong { font-size: 16.5px; }
.popup span { font-size: 12px; }
#robbery, #securing { padding: 4px 11px 6px; }

/* Choix du niveau du bot. */
.solo-levels { z-index: 12; background: rgba(6, 11, 22, 0.94); }
.level-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.level-list button {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 8px 14px;
  color: #fff;
  text-align: left;
  background: #182536;
  border: 2px solid #586b83;
  border-radius: 14px;
  box-shadow: 0 5px #040b16;
}
.level-face { grid-row: span 2; font-size: 30px; }
.level-list strong { font-size: 19px; font-weight: 1000; font-style: italic; text-transform: uppercase; letter-spacing: -0.03em; }
.level-list small { color: #b0c4db; font-size: 11.5px; }
.level-list [data-level="easy"] { border-color: #4ade80; }
.level-list [data-level="normal"] { border-color: #ffcd4d; }
.level-list [data-level="hard"] { border-color: #f87171; }
.level-list .chosen { background: #22344c; box-shadow: 0 5px #040b16, 0 0 0 3px #ffffff40; }
.level-list button:active { transform: translateY(3px); box-shadow: 0 2px #040b16; }

/* Grands textes de fête : sous la voiture en portrait, pour ne pas couvrir les messages du haut. */
.big-text { top: var(--big-text-top, calc(44px + var(--safe-top))); left: var(--big-text-left, 0); right: var(--big-text-right, 0); }
/* La taille suit la place libre calculée par le jeu (placeBigText). */
.big-text, .big-text.big-text--long, .big-text.big-text--mega { font-size: min(var(--big-text-size, 54px), clamp(30px, 11vw, 54px)); }

/* Pseudo : pastille dans le bandeau de l'accueil et fenêtre de saisie. */
.pseudo-chip { flex: 0 1 auto; min-width: 0; max-width: 42%; display: flex; align-items: center; gap: 6px; min-height: 36px; margin: 0 8px; padding: 0 10px; color: #fff; background: #182536; border: 2px solid #586b83; border-radius: 12px; font-size: 12px; box-shadow: 0 4px 0 #060d19; transform: rotate(-1.5deg); }
.pseudo-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.pseudo-chip i { color: #ffda64; font-style: normal; }
.pseudo-chip.empty b { color: #ffda64; }
.pseudo-chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #060d19; }
.pseudo-panel input { width: 100%; height: 52px; margin: 4px 0 10px; background: linear-gradient(#fffcdf, #dbddcd); border: 3px solid #a0adba; border-radius: 9px; color: #1c304f; font: 900 21px/1 system-ui, sans-serif; text-align: center; box-shadow: inset 0 2px #0002, 0 3px #060c18; }
.pseudo-panel .error { min-height: 1.2em; margin: 6px 0 10px; }
.pseudo-actions { display: flex; gap: 10px; justify-content: center; }
.pseudo-actions .dark-button { flex: 1; }
.pseudo-save { color: #1b2a3e; background: linear-gradient(#ffe27a, #f2b736); border-color: #fff0b3; }
@media (max-width: 360px) { .pseudo-chip { margin: 0 4px; padding: 0 7px; font-size: 11px; } }
/* Sur téléphone, le nom du jeu figure déjà sous l'image : l'étoile seule laisse la place au pseudo. */
.game-mark em { font-style: inherit; }
@media (max-width: 430px) { .game-mark em { display: none; } .pseudo-chip { flex: 1 1 auto; max-width: none; margin-left: 4px; } }

/* Coupe tous les sons du jeu, avec préférence conservée sur ce téléphone. */
.sound-toggle { flex-shrink: 0; display: inline-grid; place-items: center; width: 38px; min-height: 36px; padding: 0; color: #fff; background: #243349; border: 2px solid #7890ac; border-radius: 11px; font-size: 18px; box-shadow: 0 3px #060d19; }
.menu-topbar .sound-toggle { margin-left: 7px; }
.sound-toggle[aria-pressed="false"] { background: #171f2e; border-color: #56677e; }
.hud-actions { justify-self: end; display: flex; gap: 7px; align-items: center; pointer-events: auto; }
.hud-actions .sound-toggle { width: 34px; min-height: 30px; font-size: 15px; }
.tire-status { padding: 6px 8px; color: #ffe4b0; background: rgba(99, 35, 26, 0.95); border: 2px solid #f6a155; border-radius: 11px; font-size: 11px; font-weight: 900; box-shadow: 0 3px 0 #251218; }
.tire-status small { display: block; color: #fff0d4; font-size: 8px; margin-top: 2px; }
.refuel[data-mode="repair"] { width: max-content; max-width: calc(100vw - 32px); white-space: nowrap; }
.refuel[data-mode="repair"] #refuel-text { font-size: 13px; }
.refuel[data-mode="repair"] .refuel-bar { flex-shrink: 0; }

/* État du voleur : le flagrant et le risque lié au butin restent distincts. */
.wanted-status { padding: 6px 8px 7px; color: #d8ffe7; background: rgba(12, 65, 45, .95); border: 2px solid #65d69b; border-radius: 11px; box-shadow: 0 3px 0 #071c15; }
.wanted-status strong { display: block; white-space: nowrap; font-size: 11px; font-weight: 1000; font-style: italic; }
.wanted-status small { display: block; margin-top: 3px; font-size: 8px; line-height: 1.35; font-weight: 700; }
.wanted-status[data-state="wanted"] { color: #fff; background: rgba(145, 26, 35, .96); border-color: #ff8f78; box-shadow: 0 3px 0 #3d101b, 0 0 12px #ff47472b; }
.wanted-status[data-state="loaded"] { color: #ffecc2; background: rgba(92, 58, 15, .96); border-color: #f8c55b; box-shadow: 0 3px 0 #2c1c08; }

/* Mode de jeu : duel ou deux contre deux, juste au-dessus du choix du camp. */
#menu .mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: -10px auto 14px; max-width: 260px; padding: 3px; background: #0b1424; border: 2px solid #3a4d66; border-radius: 999px; box-shadow: 0 3px 0 #050b17; }
#menu .mode-switch button { min-height: 30px; border: 0; border-radius: 999px; background: transparent; color: #9fb2c9; font: 900 italic 12px/1 system-ui, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
#menu .mode-switch button.active { background: linear-gradient(#ffd75a, #f1a92c); color: #3b2200; box-shadow: inset 0 2px #fff3b0; }
@media (max-height: 760px) { #menu .mode-switch { margin: -6px auto 1.2dvh; } #menu .mode-switch button { min-height: 26px; } }

/* Salon de la partie à quatre. */
.wait-seats { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wait-seats li { padding: 8px 10px; border-radius: 10px; background: #1b2a40; border: 2px solid #3a4d66; color: #fff; font-weight: 800; font-size: 13px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-seats li[data-role="cop"] { border-color: #559edb; }
.wait-seats li[data-role="thief"] { border-color: #f08a3c; }
.wait-seats li.free { color: #7f93ab; border-style: dashed; font-weight: 600; }

.wanted-status[data-state="watched"] { color: #fff7d6; background: rgba(120, 72, 10, .96); border-color: #ffb547; box-shadow: 0 3px 0 #2c1c08, 0 0 10px #ffb54740; animation: watched-blink 1s steps(2) infinite; }
@keyframes watched-blink { 50% { border-color: #fff1c2; } }

/* Salon à quatre : une colonne par équipe. */
.wait-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; text-align: left; }
.wait-team { padding: 8px; border-radius: 12px; background: #142236; border: 2px solid #3a4d66; }
.wait-team[data-role="cop"] { border-color: #559edb; }
.wait-team[data-role="thief"] { border-color: #f08a3c; }
.wait-team h3 { margin: 0 0 6px; font-size: 13px; font-weight: 1000; font-style: italic; color: #fff; text-transform: uppercase; }
.wait-team .seat { margin: 0 0 5px; padding: 6px 8px; border-radius: 8px; background: #1f3149; color: #fff; font-weight: 800; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-team .seat.you { background: #2b4a2f; box-shadow: inset 0 0 0 2px #65d69b; }
.wait-team .seat.free { background: transparent; border: 2px dashed #3a4d66; color: #7f93ab; font-weight: 600; }
.wait-team button { width: 100%; min-height: 32px; margin-top: 2px; border: 0; border-radius: 8px; background: linear-gradient(#ffd75a, #f1a92c); color: #3b2200; font-weight: 1000; font-size: 12px; }

.wanted-status[data-state="hidden"] { color: #e6fffb; background: rgba(15, 76, 80, .96); border-color: #5eead4; box-shadow: 0 3px 0 #06262a; }

/* Tableau de fin : une ligne par joueur. */
.end-stats { display: grid; gap: 5px; margin: 8px 0 10px; text-align: left; }
.end-row { position: relative; padding: 6px 9px; border-radius: 9px; background: #16243a; border-left: 4px solid #f08a3c; }
.end-row[data-role="cop"] { border-left-color: #559edb; }
.end-row.you { background: #213b2a; }
.end-row strong { display: block; color: #fff; font-size: 13px; font-weight: 900; }
.end-row span { display: block; margin-top: 2px; color: #c6d3e2; font-size: 11.5px; font-weight: 700; line-height: 1.35; }

/* Partie à quatre : qui est en prison, et depuis quand, tant que ça dure (en tête du tableau de bord). */
.jail-status {
  padding: 5px 8px 6px;
  color: #fff;
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid #94a3b8;
  border-radius: 11px;
  box-shadow: 0 3px 0 #0b1220;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
  white-space: pre-line;
}
.jail-status.mine { border-color: #f87171; box-shadow: 0 3px 0 #3d101b, 0 0 12px rgba(248, 113, 113, 0.4); }

/* Code secret du pseudo : pour le reprendre ailleurs. */
.pseudo-code-row input { width: 60%; height: 46px; margin: 0 auto 8px; display: block; background: linear-gradient(#fffcdf, #dbddcd); border: 3px solid #f2b736; border-radius: 9px; color: #1c304f; font: 900 22px/1 system-ui, sans-serif; letter-spacing: .3em; text-align: center; }
.pseudo-code-info { margin: 6px 0 4px; padding: 8px 10px; color: #fff; background: #0f2a1d; border: 2px solid #65d69b; border-radius: 10px; font-size: 13px; font-weight: 700; }
.pseudo-code-info b { display: block; margin: 4px 0; color: #ffda64; font-size: 26px; letter-spacing: .25em; }
.pseudo-code-info .pseudo-code-change { display: block; margin: 8px auto 0; padding: 6px 12px; color: #ffda64; background: transparent; border: 2px solid #ffda64; border-radius: 999px; font: 800 12px/1 system-ui, sans-serif; cursor: pointer; }
.pseudo-newcode { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.pseudo-newcode input { flex: 1; min-width: 0; height: 46px; background: linear-gradient(#fffcdf, #dbddcd); border: 3px solid #f2b736; border-radius: 9px; color: #1c304f; font: 900 22px/1 system-ui, sans-serif; letter-spacing: .3em; text-align: center; }
.pseudo-newcode button { flex: none; height: 46px; padding: 0 14px; }
.pseudo-code-info small { display: block; color: #bfe9d1; font-size: 11px; font-weight: 600; }

/* Peu de place : le message se réduit à son titre plutôt que d'être coupé. */
.popup.compact span { display: none; }

/* Sous la barre du braquage : la prime de qui tient jusqu'au bout, en pastille dorée vivante. */
.robbery-bonus {
  display: table;
  margin: 6px auto 0;
  padding: 3px 12px 4px;
  color: #3b2200;
  background: linear-gradient(#ffe27a, #f5b53a);
  border: 2px solid #fff7c2;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 3px 0 #92400e, 0 0 6px rgba(253, 224, 71, 0.5);
  /* Un reflet doré qui passe de temps en temps, sans agiter la pastille. */
  background-image: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%), linear-gradient(#ffe27a, #f5b53a);
  background-size: 250% 100%, 100% 100%;
  background-position: 120% 0, 0 0;
  animation: bonus-shine 3.2s ease-in-out infinite;
}
/* Aux moments clés (10 s, puis 5 s restantes), un seul rebond. */
.robbery-bonus.tick { animation: bonus-tick 0.5s cubic-bezier(0.2, 1.8, 0.4, 1), bonus-shine 3.2s ease-in-out infinite; }
/* Les cinq dernières secondes : elle rougit et bat doucement, sans trembler. */
.robbery-bonus.final {
  color: #fff;
  background: linear-gradient(#ff7a45, #e11d48);
  border-color: #ffe4e6;
  box-shadow: 0 3px 0 #7f1d1d, 0 0 14px rgba(255, 90, 60, 0.9);
  background-image: none;
  font-size: 14px;
  animation: bonus-beat 0.9s ease-in-out infinite;
}
.robbery-bonus.final.tick { animation: bonus-tick 0.5s cubic-bezier(0.2, 1.8, 0.4, 1), bonus-beat 0.9s ease-in-out 0.5s infinite; }
@keyframes bonus-shine { 0%, 55% { background-position: 120% 0, 0 0; } 85%, 100% { background-position: -20% 0, 0 0; } }
@keyframes bonus-beat { 50% { transform: scale(1.06); } }
@keyframes bonus-glow { 50% { box-shadow: 0 3px 0 #92400e, 0 0 14px rgba(253, 224, 71, 0.95); filter: brightness(1.08); } }
@keyframes bonus-tick { 0% { transform: scale(1); } 35% { transform: scale(1.22) rotate(-3deg); } 100% { transform: scale(1); } }
@keyframes bonus-shake { 0%, 100% { translate: 0 0; } 25% { translate: -1.5px 0; rotate: -2deg; } 75% { translate: 1.5px 0; rotate: 2deg; } }
/* Comptes à rebours qui s'affolent : alarme imminente, sécurisation presque finie. */
#robbery-state.urgent, #securing-state.urgent { color: #fff7ae; font-weight: 900; animation: urgent-pulse 0.5s ease-in-out infinite; }
@keyframes urgent-pulse { 50% { transform: scale(1.15); } }
#robbery-state, #securing-state { display: inline-block; transform-origin: right center; }
@media (prefers-reduced-motion: reduce) { .robbery-bonus, .robbery-bonus.tick, .robbery-bonus.final, #robbery-state.urgent, #securing-state.urgent { animation: none; } }

/* Langue : pastille dans la barre du menu, et liste des langues. */
.lang-chip { display: flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 9px; color: #fff; background: #182536; border: 2px solid #586b83; border-radius: 12px; font-size: 12px; font-weight: 900; box-shadow: 0 4px 0 #060d19; }
.lang-chip b { font-weight: 900; }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 14px; }
.lang-list button { min-height: 46px; padding: 6px 10px; color: #fff; background: #1b2a40; border: 2px solid #3a4d66; border-radius: 12px; font-size: 16px; font-weight: 800; }
.lang-list button[aria-pressed="true"] { color: #1b2a3e; background: linear-gradient(#ffe27a, #f2b736); border-color: #fff0b3; }
/* Le nom du jeu, en haut à gauche, ouvre les crédits. */
button.game-mark { padding: 0; background: none; border: 0; cursor: pointer; }
.credits-name { display: block; font-size: 1em; color: #fff; }
.credits-panel .rule-card ul { padding-left: 18px; }
#rules-credits { margin-top: 12px; width: 100%; }
/* Arabe : chaque texte se lit de droite à gauche, la mise en page du jeu ne bouge pas. */
:root[data-rtl="true"] :where(p, li, h2, h3, strong, small, span, b, button, label, .popup) { unicode-bidi: plaintext; }
:root[data-rtl="true"] :where(.rule-card, .popup, #messages, .dark-panel) { direction: rtl; }

/* Signaler ou bloquer un joueur, depuis le tableau de fin. */
.end-row:has(.end-flag) { padding-right: 40px; }
.end-flag { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: #24354f; color: #c6d3e2; font-size: 15px; }
.report-sheet { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(3, 8, 16, 0.72); }
.report-sheet[hidden] { display: none; }
.report-card { display: grid; gap: 8px; width: min(100%, 340px); padding: 16px; border-radius: 14px; background: #101b2c; color: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.report-card h3 { margin: 0; font-size: 17px; font-weight: 900; }
.report-name { margin: 0; color: #f0c64a; font-weight: 900; overflow-wrap: anywhere; }
.report-card button { min-height: 42px; border: 0; border-radius: 10px; background: #1d2d45; color: #fff; font-weight: 800; text-align: left; padding: 0 12px; }
.report-card button:disabled { opacity: 0.45; }
.report-card #report-close { text-align: center; background: transparent; color: #c6d3e2; }
.report-note { margin: 0; color: #9fb0c6; font-size: 12px; line-height: 1.35; }
.report-done { min-height: 1em; margin: 0; color: #7fdc9a; font-size: 13px; font-weight: 800; }
.rule-card a { color: #f0c64a; overflow-wrap: anywhere; }

/* Version complète : lien du menu, cadenas, panneau de comparaison. */
.edition-link { display: block; width: 100%; padding: 2px 8px; border: 0; background: transparent; color: #9fb2c9; font-size: 12px; font-weight: 700; }
.edition-link b { color: #ffda64; font-weight: 900; text-decoration: underline; text-underline-offset: 2px; }
.end-edition { margin: 4px 0 8px; }
/* Pastille du menu, dans le coin de l'image : version gratuite → flèche, version complète → coche. */
.edition-pill { position: absolute; z-index: 2; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px; border: 2px solid #ffda64; border-radius: 999px; background: #0c2034d9; color: #ffda64; font: 900 italic 12px/1 system-ui, sans-serif; box-shadow: 0 3px 0 #050c17, 0 0 18px #ffc34640; }
.edition-pill::after { content: '➜'; font-style: normal; }
:root[data-edition="full"] .edition-pill { border-color: #7fdc9a80; color: #fff; background: #0c2034b3; box-shadow: 0 3px 0 #050c17; }
:root[data-edition="full"] .edition-pill::after { content: '✓'; color: #7fdc9a; }
@media (orientation: portrait) and (max-width: 760px) {
  .edition-pill { top: auto; bottom: 12px; right: 12px; min-height: 26px; padding: 3px 10px; font-size: 11px; }
  /* La pastille prend la place du petit slogan, en bas à droite de l'image. */
  .hero-bottom > span:last-child { display: none; }
}
.lock { margin-inline-start: 4px; font-size: 0.85em; }
:root[data-edition="full"] .lock { display: none; }
.edition-panel { max-width: 460px; }
.edition-reason { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: #3a2a0c; color: #ffda64; font-weight: 800; font-size: 13px; }
.edition-table { width: 100%; border-collapse: collapse; margin: 4px 0 10px; font-size: 13px; color: #dce6f2; }
.edition-table th, .edition-table td { padding: 6px 4px; border-bottom: 1px solid #23324a; text-align: center; }
.edition-table tbody th { text-align: start; font-weight: 700; color: #c6d3e2; }
.edition-table thead th { color: #9fb2c9; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.edition-table td:last-child { color: #ffda64; font-weight: 900; }
.edition-status { margin: 8px 0; color: #7fdc9a; font-weight: 900; }
.edition-form { display: flex; gap: 8px; margin: 10px 0 4px; }
.edition-form input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid #3a4d66; background: #0b1424; color: #fff; font: 900 18px/1 ui-monospace, monospace; letter-spacing: 0.12em; text-transform: uppercase; }
.edition-form[hidden] { display: none; }

/* Phares du voleur, la nuit : allumés, la puce est jaune ; éteints, elle s'assombrit. */
.lights-toggle { background: rgba(255, 214, 102, 0.22); }
.lights-toggle.dark { background: rgba(15, 23, 42, 0.85); filter: grayscale(0.4); }

/* Menu en jeu : mêmes cartes que le choix du niveau, gros bouton vert comme en fin de partie. */
.drive-overlay { background: rgb(6 11 22 / 80%); }
.drive-card { max-width: 360px; padding-bottom: 18px; }
.drive-card .dark-title { margin-block: 4px 12px; }
.drive-city { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 14px; padding: 4px 12px; color: #fff; background: #0b1424; border: 2px solid #3a4d66; border-radius: 999px; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
.drive-city > span { font-size: 15px; }
.drive-go {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 60px; margin: 0;
  color: #143b28; background: linear-gradient(170deg, #d1ff80, #7eda3d 55%, #57b92e);
  border: 3px solid #d9ffa0; border-radius: 16px;
  font-size: 22px; font-weight: 1000; font-style: italic; letter-spacing: -0.03em; text-transform: uppercase;
  box-shadow: 0 6px #277523, 0 8px 0 3px #07120c;
}
.drive-go > span { font-size: 17px; font-style: normal; }
.drive-go:active { transform: translateY(4px); box-shadow: 0 2px #277523, 0 4px 0 3px #07120c; }
.drive-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 20px 0 16px; }
.drive-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: 96px; padding: 10px 4px 9px;
  color: #fff; background: #182536; border: 2px solid #586b83; border-radius: 14px;
  box-shadow: 0 5px #040b16;
}
.drive-tile:active { transform: translateY(3px); box-shadow: 0 2px #040b16; }
.drive-tile strong { font-size: 15px; font-weight: 1000; font-style: italic; letter-spacing: -0.03em; text-transform: uppercase; line-height: 1.1; }
.drive-tile small { max-width: 100%; overflow: hidden; color: #b0c4db; font-size: 10.5px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.drive-icon { display: grid; place-items: center; width: 34px; height: 34px; font-size: 26px; line-height: 1; }
.drive-icon--help { color: #1a2b40; background: #ffdb68; border-radius: 50%; font-size: 23px; font-weight: 1000; box-shadow: 0 3px #8e6a16; }
.drive-tile--help { border-color: #ffcd4d; }
.drive-tile--lang { border-color: #6caee6; }
.drive-tile--sound { border-color: #4ade80; }
.drive-tile--sound[aria-pressed="false"] { border-color: #586b83; }
.drive-tile--sound[aria-pressed="false"] .drive-icon { filter: grayscale(1); opacity: 0.7; }
.drive-quit {
  width: 100%; min-height: 46px; margin: 0;
  color: #ffd8d6; background: linear-gradient(#4a2a35, #2c1a24); border: 2px solid #d06566; border-radius: 12px;
  font-weight: 900; box-shadow: 0 4px 0 #060d19, inset 0 2px #ffffff1a;
}
.drive-quit:active { transform: translateY(3px); box-shadow: 0 1px 0 #060d19; }
.drive-confirm p { margin: 4px 0 16px; color: #fff; font-size: 16px; font-weight: 800; }
.drive-confirm .drive-go { margin-bottom: 12px; }
/* Choix de la ville : cartes comme celles des niveaux, deux par ligne. */
.city-panel { max-width: 440px; }
.city-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.city-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; min-height: 112px; padding: 10px 6px 9px;
  color: #fff; text-align: center; background: #182536; border: 2px solid #586b83; border-radius: 14px;
  box-shadow: 0 5px #040b16;
}
.city-card:active { transform: translateY(3px); box-shadow: 0 2px #040b16; }
.city-face { font-size: 32px; line-height: 1.15; }
.city-card strong { font-size: 16px; font-weight: 1000; font-style: italic; letter-spacing: -0.03em; line-height: 1.1; text-transform: uppercase; }
.city-card small { color: #b0c4db; font-size: 11px; line-height: 1.25; }
.city-card.chosen { background: #22344c; box-shadow: 0 5px #040b16, 0 0 0 3px #ffffff40; }
.city-card--random { border-color: #ffcd4d; }
.city-card--base { border-color: #9dc2ff; }
.city-card--river { border-color: #45c4ff; }
.city-card--night { border-color: #a77bff; }
.city-card--old { border-color: #ff9a5c; }
.city-card--port { border-color: #4ade80; }
@media (max-height: 700px) {
  .city-card { min-height: 92px; padding-block: 6px; }
  .city-face { font-size: 26px; }
}

/* Classement : pastille dans l'image du menu, et un écran à onglets. */
.ranking-pill { position: relative; z-index: 2; flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 11px; color: #ffda64; background: #0c2034d9; border: 2px solid #ffda64; border-radius: 999px; font: 900 italic 12px/1 system-ui, sans-serif; box-shadow: 0 3px 0 #050c17, 0 0 18px #ffc34640; }
.ranking-pill > span { font-style: normal; }
/* La pastille du classement est dans la première ligne de l'image, au-dessus du titre : elle ne le
   chevauche plus. Sur grand écran, la pastille de la version complète occupe le coin droit. */
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.hero-top .hero-tag { margin: 0; }
@media not ((orientation: portrait) and (max-width: 760px)) { .hero-top { padding-right: 190px; } }
/* Très petits écrans : la ligne reste pour le classement, seul le slogan disparaît. */
@media (orientation: portrait) and (max-height: 700px) { .hero-top .hero-tag { display: none !important; } .hero-top { justify-content: flex-end; } }
.ranking-pill:active { transform: translateY(2px); box-shadow: 0 1px 0 #050c17; }
.ranking-panel { max-width: 520px; }
.ranking-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0 14px; padding: 5px; background: #0b1424; border: 2px solid #3a4d66; border-radius: 16px; }
.ranking-tabs button { min-height: 40px; padding: 0 4px; color: #b0c4db; background: transparent; border: 0; border-radius: 11px; font-size: 13px; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: -0.02em; }
.ranking-tabs button[aria-selected="true"] { color: #2a1d05; background: linear-gradient(#ffe27a, #f5b324); box-shadow: 0 3px #8e6a16; }
.ranking-me { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; margin-bottom: 14px; padding: 12px 14px; text-align: left; background: #22344c; border: 2px solid #ffcd4d; border-radius: 14px; box-shadow: 0 5px #040b16; }
.ranking-me .rank-big { grid-row: span 3; display: grid; place-items: center; min-width: 58px; height: 58px; padding: 0 6px; color: #2a1d05; background: linear-gradient(#ffe27a, #f5b324); border-radius: 14px; font: 1000 italic 22px/1 system-ui, sans-serif; box-shadow: 0 3px #8e6a16; }
.ranking-me .rank-big.unranked { color: #dce6f2; background: #182536; border: 2px dashed #586b83; box-shadow: none; font-size: 18px; }
.ranking-me strong { color: #fff; font-size: 20px; font-weight: 1000; font-style: italic; letter-spacing: -0.02em; }
.ranking-me strong b { color: #ffda64; }
.ranking-me small { color: #b0c4db; font-size: 12px; }
.ranking-me .ranking-hint { color: #ffda64; font-weight: 800; }
.ranking-list { margin: 0; padding: 0; list-style: none; }
.ranking-list li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; min-height: 46px; margin-bottom: 6px; padding: 6px 12px; text-align: left; background: #182536; border: 2px solid #2c3e55; border-radius: 12px; }
.ranking-list li.you { border-color: #ffcd4d; background: #22344c; }
.ranking-list .pos { color: #8fa6c1; font: 1000 italic 17px/1 system-ui, sans-serif; text-align: center; }
.ranking-list li:nth-child(1) .pos { color: #ffd34d; font-size: 21px; }
.ranking-list li:nth-child(2) .pos { color: #d7e1ec; font-size: 19px; }
.ranking-list li:nth-child(3) .pos { color: #e8a46a; font-size: 18px; }
.ranking-list .who { min-width: 0; overflow: hidden; color: #fff; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.ranking-list .who small { display: block; color: #9fb4cc; font-size: 11px; font-weight: 700; }
.ranking-list .score { color: #ffda64; font: 1000 italic 18px/1 system-ui, sans-serif; }
.ranking-empty { padding: 18px 10px; color: #b0c4db; text-align: center; }
.record-card { margin-bottom: 12px; padding: 12px 14px; text-align: left; background: #182536; border: 2px solid #586b83; border-radius: 14px; box-shadow: 0 5px #040b16; }
.record-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: #ffda64; font-size: 16px; font-weight: 1000; font-style: italic; text-transform: uppercase; letter-spacing: -0.02em; }
.record-card h3 small { margin-left: auto; color: #9fb4cc; font-size: 10px; font-style: normal; letter-spacing: 0.06em; }
.record-row { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; padding: 6px 0; border-top: 1px solid #2c3e55; }
.record-row > span { color: #9fb4cc; font-size: 11px; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.record-row > b { min-width: 0; overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; }
.record-row > b small { display: block; overflow: hidden; color: #9fb4cc; font-size: 11px; font-weight: 700; text-overflow: ellipsis; }
.record-row > strong { color: #ffda64; font: 1000 italic 17px/1 system-ui, sans-serif; }
.record-row.you > b { color: #ffda64; }
.record-row.free > b { color: #7fdc9a; font-style: italic; }
.ranking-how { margin: 12px 4px 0; text-align: left; line-height: 1.45; }
.end-rating { margin: -4px 0 12px; padding: 10px 12px 12px; color: #fff; text-align: left; background: #0b1424; border: 2px solid #ffcd4d; border-radius: 14px; }
.end-rating p { margin: 0; }
.end-rating-line { font-size: 15px; font-weight: 900; text-align: center; }
.end-rating-line b { color: #ffda64; }
.end-rating .up { color: #7fdc9a; }
.end-rating .down { color: #ff9c9c; }
.end-rating .same { color: #b0c4db; }
.end-record { margin-top: 4px !important; color: #ffda64; font-weight: 900; text-align: center; }
.end-board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 10px 2px 6px !important; color: #b0c4db; font-size: 11px; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.end-board-head b { font-size: 12px; letter-spacing: 0; }
.end-board li { min-height: 36px; margin-bottom: 4px; padding: 4px 10px; }
.end-board .pos { font-size: 15px !important; }
.end-board .score { font-size: 15px; }
.end-board-hint { color: #ffda64; font-size: 13px; font-weight: 800; text-align: center; }
.end-board-all { display: block; width: 100%; margin-top: 8px; padding: 6px; color: #ffda64; background: transparent; border: 0; font-size: 13px; font-weight: 900; }

/* Enjeu de la manche au classement : une carte sous la voiture pendant le compte à rebours. */
.challenge-card {
  position: absolute; z-index: 6; left: 50%; top: 50%; width: min(330px, calc(100vw - 32px));
  padding: 12px 14px 14px; color: #fff; text-align: center; pointer-events: none;
  background: #10253df2; border: 3px solid #ffcd4d; border-radius: 18px;
  box-shadow: 0 6px 0 #050c17, 0 18px 40px #0008;
  transform: translate(-50%, 0) rotate(-1.5deg);
  animation: challenge-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.challenge-card.leaving { animation: challenge-out 0.4s ease-in both; }
.challenge-card[data-tone="up"] { border-color: #7fdc9a; }
.challenge-card[data-tone="down"] { border-color: #ff9c9c; }
.challenge-card h3 { margin: 0 0 6px; color: #ffda64; font-size: 20px; font-weight: 1000; font-style: italic; letter-spacing: -0.03em; text-transform: uppercase; }
.challenge-card[data-tone="up"] h3 { color: #a6f0bd; }
.challenge-card[data-tone="down"] h3 { color: #ffc2c2; }
.challenge-card .versus-line { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; font: 1000 italic 26px/1 system-ui, sans-serif; }
.challenge-card .versus-line small { color: #9fb4cc; font-size: 13px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.challenge-card .stakes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.challenge-card .stakes span { padding: 6px 4px; border-radius: 10px; font-size: 14px; font-weight: 900; }
.challenge-card .stakes .win { color: #143b28; background: #a6f0bd; }
.challenge-card .stakes .lose { color: #4a1414; background: #ffc2c2; }
.challenge-card p { margin: 0; color: #dce6f2; font-size: 13px; font-weight: 700; }
@keyframes challenge-in { from { opacity: 0; transform: translate(-50%, 30px) rotate(-1.5deg) scale(0.8); } }
@keyframes challenge-out { to { opacity: 0; transform: translate(-50%, 20px) rotate(-1.5deg) scale(0.9); } }

/* Fin de partie : la cote défile, sa ligne monte (ou descend) au classement, le grade change. */
.rating-value { display: inline-block; min-width: 2.6em; font-variant-numeric: tabular-nums; transition: transform 0.2s; }
.rating-value.counting { transform: scale(1.18); text-shadow: 0 0 14px #ffda64aa; }
.rating-value.gained { animation: gained 0.7s cubic-bezier(0.2, 1.8, 0.4, 1); color: #a6f0bd !important; }
.rating-value.lost { color: #ffc2c2 !important; }
@keyframes gained { 30% { transform: scale(1.45); text-shadow: 0 0 22px #7fdc9a; } }
.rating-delta { display: inline-block; transition: opacity 0.2s; }
.rating-delta:not(.pending) { animation: pop-in 0.45s cubic-bezier(0.2, 1.8, 0.4, 1); }
.rating-delta.pending, .end-board-head b.pending { opacity: 0; }
.end-board-head b:not(.pending) { animation: pop-in 0.45s cubic-bezier(0.2, 1.8, 0.4, 1); }
.grade-tag { display: inline-block; }
.grade-tag.swapped { color: #ffda64; animation: grade-flip 0.6s ease-out; }
.grade-change { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 2px !important; padding: 8px 10px; border-radius: 12px; font-size: 16px; font-weight: 1000; font-style: italic; text-transform: uppercase; letter-spacing: -0.02em; }
.grade-change.up { color: #2a1d05; background: linear-gradient(#ffe27a, #f5b324); box-shadow: 0 3px #8e6a16, 0 0 24px #ffc34660; }
.grade-change.down { margin-top: 4px !important; padding: 0; color: #ffc2c2; background: none; font-size: 13px; font-style: normal; font-weight: 800; text-transform: none; }
.grade-change.down .grade-change-icon { font-size: 15px; }
.grade-change.down:not(.pending) { animation: pop-in 0.4s ease-out; }
.grade-change-icon { font-size: 24px; font-style: normal; }
.grade-change.pending { display: none; }
.grade-change:not(.pending) { animation: stamp 0.55s cubic-bezier(0.2, 1.6, 0.4, 1); }
.end-board li { position: relative; will-change: transform; }
.end-board li.renumbered .pos { animation: pop-in 0.35s cubic-bezier(0.2, 1.8, 0.4, 1); }
.end-board li.moving { z-index: 2; box-shadow: 0 8px 18px #000a, 0 0 0 2px #ffcd4d; }
.end-board li.landed { overflow: hidden; animation: landed 0.9s ease-out; }
/* Un reflet doré traverse sa ligne quand elle arrive. */
.end-board li.landed::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, #ffe27a88 48%, #ffffffaa 52%, transparent 70%); transform: translateX(-110%); animation: shine 0.9s ease-out 0.1s forwards; pointer-events: none; }
@keyframes shine { to { transform: translateX(110%); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.4); } }
@keyframes grade-flip { 0% { transform: rotateX(90deg); } 60% { transform: rotateX(-15deg); } }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.8) rotate(-6deg); } 70% { transform: scale(0.95) rotate(1deg); } }
@keyframes landed { 0% { box-shadow: 0 0 0 0 #ffcd4dcc; } 100% { box-shadow: 0 0 0 14px #ffcd4d00; } }
@media (prefers-reduced-motion: reduce) {
  .rating-delta, .end-board-head b, .grade-tag.swapped, .grade-change, .end-board li.landed { animation: none !important; }
}

/* Comment jouer : en ligne, entre amis, contre un bot. */
.play-panel { max-width: 420px; }
.play-card--online { border-color: #45c4ff !important; }
.play-card--friends { border-color: #ffcd4d !important; }
.play-card--bot { border-color: #a77bff !important; }
.play-card[disabled] { opacity: 0.55; }
/* Recherche d'adversaire : un radar qui balaie. */
.search-panel { max-width: 380px; }
.search-radar { position: relative; width: 150px; height: 150px; margin: 6px auto 10px; border-radius: 50%; background: radial-gradient(circle, #123e62 0, #0b1424 70%); border: 2px solid #3a6f95; overflow: hidden; }
.search-radar i { position: absolute; inset: 22%; border: 1.5px solid #45c4ff55; border-radius: 50%; }
.search-radar i + i { inset: 40%; }
.search-radar::before { content: ''; position: absolute; inset: 0; background: conic-gradient(from 0deg, #45c4ff00 0deg, #45c4ff00 300deg, #45c4ffaa 360deg); animation: radar 2s linear infinite; }
.search-radar b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; }
@keyframes radar { to { transform: rotate(360deg); } }
.search-time { margin: 0; color: #fff; font: 1000 italic 30px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
#search-status { min-height: 2.6em; margin: 8px 0 14px; }
#search-panel .dark-button { width: 100%; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .search-radar::before { animation: none; } }

/* L'aide s'ouvre aussi depuis le menu en jeu : elle passe par-dessus. */
.rules { z-index: 16; }
#lang-panel { z-index: 14; }

/* Ordinateur : invitation à jouer au téléphone. */
.phone-panel { text-align: center; }
.phone-qr { display: block; width: min(220px, 60vw); height: auto; margin: 6px auto 12px; border-radius: 12px; border: 4px solid #ffda64; image-rendering: pixelated; }
.phone-panel .dark-button { width: 100%; margin-top: 8px; }
