/* Communes en commun
   Mise en page : colonne de saisie et liste à gauche, carte à droite ; empilé (saisie, carte, liste) sur téléphone.
   Identité : le panneau d'entrée d'agglomération (blanc, liseré rouge) pour la saisie, la bande bleue des plaques
   pour les départements, une couleur par joueur. */
:root {
  --bg: #eef1f4;
  --panel: #f8f9fb;
  --ink: #17212c;
  --muted: #5b6673;
  --line: #d4dae1;
  --land: #dde3ea;
  --land-stroke: #b3bdc9;
  --region-stroke: #6c7888;
  --sign-red: #c8102e;
  --sign-bg: #ffffff;
  --sign-ink: #111418;
  --plate: #1f3f99;
  --plate-ink: #ffffff;
  --dot-stroke: #ffffff;
  --ok: #1d7a46;
  --err: #b0122b;
  --focus: #1f3f99;
  --row-flash: rgba(200, 16, 46, 0.10);
  --shadow: 0 1px 2px rgba(23, 33, 44, 0.08), 0 4px 14px rgba(23, 33, 44, 0.06);
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;

  /* Couleurs des joueurs (32, voir PALETTE_SIZE dans functions.php) */
  --p0: #c8102e; --p1: #1f5fd1; --p2: #178a45; --p3: #e06c00; --p4: #7b3fc4;
  --p5: #00879a; --p6: #d4307f; --p7: #6f8a00; --p8: #8a5523; --p9: #303a9e;
  --p10: #c99a00; --p11: #00a37f; --p12: #f2554a; --p13: #4f6b8a; --p14: #96195d;
  --p15: #2b95e8; --p16: #a8621a; --p17: #3c4148; --p18: #9a6be0; --p19: #58a832;
  --p20: #7d1128; --p21: #173f6e; --p22: #0e6340; --p23: #b0179e; --p24: #0fb5d4; --p25: #f0975a;
  --p26: #7a7340; --p27: #6d7ff0; --p28: #4a1d5e; --p29: #c8a46e; --p30: #00c060; --p31: #4e2a14;
  --pc: var(--muted);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151c; --panel: #151c25; --ink: #e6ebf1; --muted: #95a1af; --line: #283342;
    --land: #1f2834; --land-stroke: #364356; --region-stroke: #6a7a8f;
    --sign-red: #d8243f; --sign-bg: #f1f2ee; --sign-ink: #111418;
    --plate: #2f57c9; --plate-ink: #ffffff;
    --dot-stroke: #0f151c; --ok: #4cc382; --err: #ff6b7f; --focus: #6f94ff;
    --row-flash: rgba(255, 79, 102, 0.14);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
    --p0: #ff4f66; --p1: #5b8cff; --p2: #3ccf7a; --p3: #ff9a3c; --p4: #a77bff;
    --p5: #2cc6d8; --p6: #ff6fb0; --p7: #a8c932; --p8: #c98a4f; --p9: #7f89ff;
    --p10: #f2c53d; --p11: #3fe0b5; --p12: #ff8a7f; --p13: #8fa9c7; --p14: #e05ca3;
    --p15: #6cc0ff; --p16: #e0a060; --p17: #c4cad2; --p18: #c7a6ff; --p19: #92dd5e;
    --p20: #d2556f; --p21: #7aa6dd; --p22: #5cc596; --p23: #ef6ad9; --p24: #66e0f5; --p25: #ffb98a;
    --p26: #bdb57a; --p27: #a3b0ff; --p28: #a97ac0; --p29: #e2c99a; --p30: #4deb93; --p31: #b08060;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151c; --panel: #151c25; --ink: #e6ebf1; --muted: #95a1af; --line: #283342;
  --land: #1f2834; --land-stroke: #364356; --region-stroke: #6a7a8f;
  --sign-red: #d8243f; --sign-bg: #f1f2ee; --sign-ink: #111418;
  --plate: #2f57c9; --plate-ink: #ffffff;
  --dot-stroke: #0f151c; --ok: #4cc382; --err: #ff6b7f; --focus: #6f94ff;
  --row-flash: rgba(255, 79, 102, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.25);
  --p0: #ff4f66; --p1: #5b8cff; --p2: #3ccf7a; --p3: #ff9a3c; --p4: #a77bff;
  --p5: #2cc6d8; --p6: #ff6fb0; --p7: #a8c932; --p8: #c98a4f; --p9: #7f89ff;
  --p10: #f2c53d; --p11: #3fe0b5; --p12: #ff8a7f; --p13: #8fa9c7; --p14: #e05ca3;
  --p15: #6cc0ff; --p16: #e0a060; --p17: #c4cad2; --p18: #c7a6ff; --p19: #92dd5e;
  --p20: #d2556f; --p21: #7aa6dd; --p22: #5cc596; --p23: #ef6ad9; --p24: #66e0f5; --p25: #ffb98a;
  --p26: #bdb57a; --p27: #a3b0ff; --p28: #a97ac0; --p29: #e2c99a; --p30: #4deb93; --p31: #b08060;
  color-scheme: dark;
}
.pc-0 { --pc: var(--p0); } .pc-1 { --pc: var(--p1); } .pc-2 { --pc: var(--p2); } .pc-3 { --pc: var(--p3); }
.pc-4 { --pc: var(--p4); } .pc-5 { --pc: var(--p5); } .pc-6 { --pc: var(--p6); } .pc-7 { --pc: var(--p7); }
.pc-8 { --pc: var(--p8); } .pc-9 { --pc: var(--p9); } .pc-10 { --pc: var(--p10); } .pc-11 { --pc: var(--p11); }
.pc-12 { --pc: var(--p12); } .pc-13 { --pc: var(--p13); } .pc-14 { --pc: var(--p14); } .pc-15 { --pc: var(--p15); }
.pc-16 { --pc: var(--p16); } .pc-17 { --pc: var(--p17); } .pc-18 { --pc: var(--p18); } .pc-19 { --pc: var(--p19); }
.pc-20 { --pc: var(--p20); } .pc-21 { --pc: var(--p21); } .pc-22 { --pc: var(--p22); } .pc-23 { --pc: var(--p23); }
.pc-24 { --pc: var(--p24); } .pc-25 { --pc: var(--p25); } .pc-26 { --pc: var(--p26); } .pc-27 { --pc: var(--p27); }
.pc-28 { --pc: var(--p28); } .pc-29 { --pc: var(--p29); } .pc-30 { --pc: var(--p30); } .pc-31 { --pc: var(--p31); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.app {
  display: grid;
  grid-template-columns: minmax(330px, 410px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "controls map" "list map";
  height: 100%;
}

/* ---------- saisie ---------- */
.controls {
  grid-area: controls;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.masthead { display: flex; align-items: center; gap: 10px; }
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 0.86rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--sign-red); text-decoration: none;
}
.brand:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.net { font-size: 0.78rem; color: var(--err); }
.chip-btn {
  margin-left: auto;
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 11px;
  font-size: 0.8rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip-btn:hover { border-color: var(--muted); }
.chip-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 2px 6px;
  margin: -3px -7px;
  width: calc(100% + 14px);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
}
.title-input::placeholder { color: var(--muted); opacity: 0.7; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--focus); background: var(--bg); }

.me { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatch-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  padding: 0; cursor: pointer; flex: none;
}
.swatch-btn:hover { border-color: var(--muted); }
.swatch-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatch { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--pc); }
.swatch.is-unset { background: repeating-conic-gradient(var(--line) 0 25%, var(--panel) 0 50%) 50% / 8px 8px; }
.pseudo-input {
  flex: 1 1 140px; min-width: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  padding: 5px 9px; font-weight: 500;
}
.pseudo-input:focus { outline: none; border-color: var(--focus); }
.me-note { flex-basis: 100%; font-size: 0.8rem; color: var(--muted); }

.palette {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.palette button {
  aspect-ratio: 1; max-width: 100%; border-radius: 50%; border: 2px solid transparent; padding: 0;
  background: var(--pc); cursor: pointer; position: relative;
  transition: transform 0.12s ease;
}
.palette button:hover:not(:disabled) { transform: scale(1.12); }
.palette button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.palette button.is-mine { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--bg); }
.palette button:disabled { cursor: not-allowed; opacity: 0.28; }

.link-btn {
  border: 0; background: none; padding: 2px 0; cursor: pointer; color: var(--muted); font-size: 0.82rem;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.link-btn:hover, .link-btn[aria-expanded="true"] { color: var(--ink); }
.link-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.device {
  display: grid; gap: 12px;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  font-size: 0.86rem;
}
.device-mine { display: grid; gap: 2px; }
.device-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.device-code {
  font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums; user-select: all;
}
.device-help { color: var(--muted); }
.device-claim { display: grid; gap: 6px; margin: 0; }
.device-claim label { color: var(--muted); }
.device-row { display: flex; gap: 8px; }
.device-row input {
  flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 5px 9px;
}
.device-row input:focus { outline: none; border-color: var(--focus); }
.device-row button {
  border: 0; border-radius: 8px; background: var(--plate); color: var(--plate-ink); padding: 5px 14px;
  font-weight: 600; cursor: pointer;
}
.device-row button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.device-row button:disabled { opacity: 0.6; cursor: progress; }

form.sign-form { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.sign {
  position: relative;
  background: var(--sign-bg);
  border: 5px solid var(--sign-red);
  border-radius: 14px;
  box-shadow: 0 0 0 3px var(--sign-bg), 0 0 0 4px var(--line), var(--shadow);
  margin: 4px;
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.sign:focus-within { box-shadow: 0 0 0 3px var(--sign-bg), 0 0 0 6px var(--focus), var(--shadow); }
.sign.is-locked { opacity: 0.55; }
.sign input {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--sign-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.05rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  padding: 12px 12px 10px;
  outline: none;
  text-overflow: ellipsis;
}
.sign input::placeholder { color: #9aa1a9; font-weight: 600; letter-spacing: 0.05em; font-size: 0.9em; }
.sign input:disabled { cursor: not-allowed; }
.sign.shake { animation: shake 0.32s ease; }
@keyframes shake {
  20% { transform: translateX(-6px) rotate(-0.6deg); }
  45% { transform: translateX(5px) rotate(0.5deg); }
  70% { transform: translateX(-3px); }
  100% { transform: none; }
}
.hint { margin: 0; color: var(--muted); font-size: 0.84rem; text-align: center; }
.hint .quota { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }
.hint .quota.is-low { color: var(--err); }
.feedback { min-height: 2.6em; margin: 0; font-size: 0.92rem; color: var(--muted); }
.feedback.ok { color: var(--ink); }
.feedback.ok strong { color: var(--ok); }
.feedback.err { color: var(--err); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.stat .value {
  font-family: var(--font-display); font-weight: 600; font-size: 2.05rem; line-height: 1.05;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stat .sub { font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.share-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--land); overflow: hidden; }
.share-bar span { display: block; height: 100%; width: 0; background: var(--sign-red); transition: width 0.5s cubic-bezier(.2,.8,.2,1); }

/* ---------- liste et classement ---------- */
.list-pane {
  grid-area: list;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.tabs { display: flex; gap: 4px; padding: 0 22px; border-top: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; padding: 10px 4px 8px; margin-right: 14px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem; color: var(--muted); border-bottom: 2px solid transparent;
}
.tabs button span { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sign-red); }
.tabs button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.list-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 22px 10px;
  border-bottom: 1px solid var(--line);
}
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; background: var(--bg); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  padding: 4px 9px; border-radius: 6px; cursor: pointer; font-size: 0.82rem; font-weight: 500; color: var(--muted);
  white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.segmented input:checked + label { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }
.dep-filter { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.dep-filter select {
  max-width: 230px; font-size: 0.85rem; font-weight: 500; color: var(--ink);
  padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
}
.dep-filter select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.list-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
ol.list { list-style: none; margin: 0; padding: 6px 12px 16px; }
.row {
  display: grid;
  grid-template-columns: 2.9em minmax(0, 1fr) auto 1.8em;
  align-items: center;
  column-gap: 10px;
  padding: 6px 8px 6px 12px;
  border-radius: 8px;
  box-shadow: inset 3px 0 0 var(--pc);
}
.row:hover, .row.is-hl { background: var(--bg); }
.row.enter { animation: rowIn 0.42s cubic-bezier(.2,.8,.2,1), flash 1.6s ease-out; }
.row.leave { animation: rowOut 0.22s ease forwards; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes flash { from { background: var(--row-flash); } to { background: transparent; } }
@keyframes rowOut { to { opacity: 0; transform: translateX(10px); } }
.plate {
  justify-self: start; min-width: 2.4em; padding: 1px 4px 0; border-radius: 3px;
  background: var(--plate); color: var(--plate-ink);
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; text-align: center;
  font-variant-numeric: tabular-nums;
}
.who { display: flex; flex-direction: column; min-width: 0; }
.name { font-weight: 500; overflow-wrap: anywhere; }
.meta { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meta .by { color: var(--pc); font-weight: 600; }
.pop { color: var(--muted); font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.del {
  width: 1.8em; height: 1.8em; border: 0; border-radius: 6px; background: none; color: var(--muted);
  cursor: pointer; font-size: 1.05rem; line-height: 1; opacity: 0.55;
}
.row:hover .del { opacity: 1; }
.del:hover { background: var(--row-flash); color: var(--err); }
.del:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; opacity: 1; }
.empty { padding: 22px; margin: 0; color: var(--muted); }
.empty strong { color: var(--ink); font-weight: 600; }

table.ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking th {
  text-align: left; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 8px 6px;
}
.ranking th:first-child, .ranking td:first-child { padding-left: 22px; }
.ranking th:last-child, .ranking td:last-child { padding-right: 22px; }
.ranking td { padding: 8px; border-top: 1px solid var(--line); }
.ranking .num { text-align: right; white-space: nowrap; }
.ranking .player { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ranking .rank { width: 1.4em; color: var(--muted); font-size: 0.84rem; text-align: right; flex: none; }
.ranking .swatch { width: 14px; height: 14px; flex: none; }
.ranking .pname { font-weight: 500; overflow-wrap: anywhere; }
.ranking .you { font-size: 0.75rem; color: var(--muted); margin-left: 4px; }
.ranking tr.is-me td { background: var(--bg); }

.credits { margin: 0; padding: 10px 22px 14px; font-size: 0.74rem; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- carte ---------- */
.map-pane { grid-area: map; position: relative; min-width: 0; min-height: 0; padding: 18px; }
.map-pane svg { display: block; width: 100%; height: 100%; touch-action: pan-x pan-y; cursor: grab; }
.map-pane svg.zoomed { touch-action: none; }
.map-pane svg:active { cursor: grabbing; }
.land { fill: var(--land); stroke: var(--land-stroke); stroke-width: 0.5px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.regions { fill: none; stroke: var(--region-stroke); stroke-width: 0.9px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.inset-frame { fill: none; stroke: var(--line); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.inset-label { fill: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.dot {
  fill: var(--pc); fill-opacity: 0.86; stroke: var(--dot-stroke); stroke-width: 0.6px; vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center;
}
.dot.is-hl { fill-opacity: 1; stroke: var(--ink); stroke-width: 1.6px; }
.dot.enter { animation: dotIn 0.5s cubic-bezier(.3,1.6,.5,1); }
.dot.leave { animation: dotOut 0.25s ease forwards; }
@keyframes dotIn { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes dotOut { to { transform: scale(0); opacity: 0; } }
.ring {
  fill: none; stroke: var(--pc); stroke-width: 1.5px; vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center;
  animation: ring 0.9s ease-out forwards;
}
.ring.is-other { stroke-width: 2.5px; animation-duration: 1.4s; }
@keyframes ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(4); opacity: 0; } }

.zoom-ctl { position: absolute; right: 22px; top: 22px; display: flex; flex-direction: column; gap: 6px; }
.zoom-ctl button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-size: 1.1rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.zoom-ctl button:hover { border-color: var(--muted); }
.zoom-ctl button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.zoom-ctl #replay { font-size: 0.85rem; margin-top: 6px; }

.replay-bar {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: grid; grid-template-columns: auto auto auto; align-items: center; column-gap: 14px; row-gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 10px 14px; max-width: calc(100% - 32px);
}
.replay-date { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay-count { color: var(--muted); font-size: 0.84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay-bar button {
  border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 0.84rem;
}
.replay-bar button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.replay-progress { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--land); overflow: hidden; }
.replay-progress span { display: block; height: 100%; width: 0; background: var(--sign-red); }

.toasts {
  position: absolute; left: 22px; bottom: 22px; display: flex; flex-direction: column-reverse; gap: 6px;
  pointer-events: none; max-width: min(340px, calc(100% - 44px));
}
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 7px 11px; font-size: 0.86rem;
  animation: toastIn 0.3s cubic-bezier(.2,.8,.2,1);
}
.toast .swatch { width: 10px; height: 10px; flex: none; }
.toast b { font-weight: 600; }
.toast.leave { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(4px); } }

.tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px 9px; font-size: 0.84rem; line-height: 1.35; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
}
.tip b { font-weight: 600; }
.tip span { color: var(--muted); font-variant-numeric: tabular-nums; }
.tip .by { color: var(--pc); font-weight: 600; }

/* ---------- accueil ---------- */
.page-home { min-height: 100%; }
.home {
  max-width: 640px; margin: 0 auto; padding: 56px 20px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 26px; text-align: center;
}
.home-sign {
  position: relative; display: flex; flex-direction: column; align-items: center;
  background: var(--sign-bg); color: var(--sign-ink);
  border: 8px solid var(--sign-red); border-radius: 22px;
  box-shadow: 0 0 0 5px var(--sign-bg), 0 0 0 6px var(--line), var(--shadow);
  padding: 22px 34px 18px; margin: 6px;
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  line-height: 1; font-size: clamp(2.2rem, 1.4rem + 4vw, 3.6rem);
  animation: signIn 0.7s cubic-bezier(.2,.9,.25,1.2);
  max-width: 100%;
}
.home-sign span:last-child { font-size: 0.6em; letter-spacing: 0.08em; margin-top: 6px; }
.home-sign-end::after {
  content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 9px; background: var(--sign-red);
  transform: rotate(-12deg); border-radius: 2px;
}
@keyframes signIn { from { opacity: 0; transform: translateY(10px) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
.home-lead { margin: 0; font-size: 1.12rem; max-width: 34em; text-wrap: balance; }
.home-form { margin: 0; }
.big-btn {
  border: 0; border-radius: 12px; background: var(--sign-red); color: #fff; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 12px 28px; box-shadow: var(--shadow); transition: transform 0.15s ease, filter 0.15s ease;
}
.big-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.big-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.home-facts { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; text-align: left; max-width: 32em; color: var(--muted); }
.home-facts li { padding-left: 18px; position: relative; }
.home-facts li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 8px; height: 8px; border-radius: 50%; background: var(--sign-red); }
.home-credits { margin: 0; font-size: 0.78rem; color: var(--muted); }

/* ---------- téléphone / tablette ---------- */
@media (max-width: 860px) {
  .app {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas: "controls" "map" "list";
  }
  .controls, .list-pane { border-right: 0; }
  .controls { padding: 16px 16px 10px; }
  .map-pane { padding: 6px 16px; aspect-ratio: 1000 / 781; max-width: 100%; }
  .tabs, .list-head, .empty, .credits { padding-left: 16px; padding-right: 16px; }
  .ranking th:first-child, .ranking td:first-child { padding-left: 16px; }
  .ranking th:last-child, .ranking td:last-child { padding-right: 16px; }
  ol.list { padding: 6px 6px 12px; }
  .list-scroll { overflow: visible; }
  .zoom-ctl { right: 20px; top: 8px; flex-direction: row; }
  .zoom-ctl button { width: 30px; height: 30px; }
  .zoom-ctl #replay { margin-top: 0; margin-left: 4px; }
  .stat .value { font-size: 1.8rem; }
  .toasts { left: 20px; bottom: 10px; }
  .replay-bar { bottom: 10px; padding: 8px 10px; column-gap: 10px; }
  .replay-date { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
