.scene {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 620px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 58%, #0d1428 0%, #05070f 68%);
}

.scene__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.scene__canvas.is-drag { cursor: grabbing; }
.scene__canvas.is-cible { cursor: pointer; }

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: clamp(1.2rem, 3vw, 2.6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
}

.hud > * { pointer-events: auto; }

.hud__titre {
  grid-column: 1;
  grid-row: 1;
  max-width: 30ch;
}

.hud__titre h1 {
  font-size: clamp(2.5rem, 6.4vw, 5.2rem);
  margin-bottom: 1.1rem;
}

.hud__sous {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 40ch;
}

.recherche {
  grid-column: 2;
  grid-row: 1;
  width: min(310px, 42vw);
  position: relative;
}

.recherche__label {
  display: block;
  font-family: var(--data);
  font-size: 10px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
  text-align: right;
}

.recherche__champ {
  border-bottom: 1px solid var(--line-fort);
  transition: border-color 0.25s ease;
}

.recherche__champ:focus-within { border-color: var(--flandre); }

.recherche input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.28rem;
  padding: 0.45rem 0;
  text-align: right;
}

.recherche input::placeholder { color: #4d5772; }
.recherche input:focus { outline: none; }
.recherche input::-webkit-search-cancel-button { filter: invert(1) opacity(0.4); }

.recherche__aide {
  margin: 0.55rem 0 0;
  font-family: var(--data);
  font-size: 10.5px;
  color: #5f6880;
  text-align: right;
}

.recherche__liste {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 44vh;
  overflow-y: auto;
  background: rgba(10, 14, 29, 0.94);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  display: none;
}

.recherche__liste.is-ouvert { display: block; }

.recherche__liste li { border-bottom: 1px solid var(--line); }
.recherche__liste li:last-child { border-bottom: 0; }

.recherche__liste button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  width: 100%;
  background: none;
  border: 0;
  color: var(--text);
  padding: 0.62rem 0.85rem;
  text-align: left;
  cursor: pointer;
  font-family: var(--body);
  font-size: 14px;
  transition: background 0.15s ease;
}

.recherche__liste button:hover,
.recherche__liste button:focus-visible { background: rgba(47, 225, 208, 0.1); }

.recherche__liste b { font-weight: 600; }

.recherche__liste span {
  font-family: var(--data);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.legende {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  max-width: 260px;
}

.legende__titre {
  font-family: var(--data);
  font-size: 10px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

.legende__liste {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}

.legende__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.24rem 0;
  font-size: 13px;
}

.legende__pastille {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.legende__item--f .legende__pastille { background: var(--flandre); box-shadow: 0 0 11px var(--flandre); }
.legende__item--w .legende__pastille { background: var(--wallonie); box-shadow: 0 0 11px var(--wallonie); }
.legende__item--b .legende__pastille { background: var(--bruxelles); box-shadow: 0 0 11px var(--bruxelles); }

.legende__nom { flex: 1; }

.legende__val {
  font-family: var(--data);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.legende__note {
  font-size: 11.5px;
  line-height: 1.5;
  color: #5f6880;
}

.reglages {
  grid-column: 2;
  grid-row: 3;
  align-self: end;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 0.45rem;
}

.reglages__groupe {
  border: 0;
  margin: 0;
  padding: 0;
  text-align: right;
}

.reglages__legend {
  font-family: var(--data);
  font-size: 10px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
  padding: 0;
}

.reglages__boutons { display: flex; gap: 0.35rem; }

.puce {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--data);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 0.42rem 0.72rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.puce:hover { color: var(--text); border-color: var(--line-fort); }

.puce.is-actif {
  color: var(--ink);
  background: var(--flandre);
  border-color: var(--flandre);
}

.puce--large { padding: 0.42rem 0.85rem; }

.aide-souris {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
  justify-self: center;
  margin: 0;
  font-family: var(--data);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  color: #4d5772;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.aide-souris.is-masque { opacity: 0; }

.etiquette {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  color: rgba(234, 236, 244, 0.85);
  text-shadow: 0 0 12px rgba(5, 7, 15, 0.95), 0 0 4px rgba(5, 7, 15, 1);
  pointer-events: none;
  white-space: nowrap;
  will-change: transform;
}

.etiquette--pole {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.etiquette--pole.est-f { color: var(--flandre); }
.etiquette--pole.est-w { color: var(--wallonie); }
.etiquette--pole.est-b { color: var(--bruxelles); }

.fiche {
  position: absolute;
  top: 0;
  right: 0;
  width: min(370px, 90vw);
  height: 100%;
  background: rgba(8, 11, 23, 0.93);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  overflow-y: auto;
  transform: translateX(101%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 5;
}

.fiche.is-ouvert { transform: translateX(0); }

.fiche__fermer {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.fiche__fermer:hover { color: var(--text); border-color: var(--line-fort); }

.fiche__rang {
  font-family: var(--data);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

.fiche__nom {
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  margin-bottom: 0.5rem;
  word-break: break-word;
}

.fiche__total {
  font-family: var(--data);
  font-size: 15px;
  color: var(--flandre);
  font-variant-numeric: tabular-nums;
  margin-bottom: 2rem;
}

.fiche__unite { color: var(--muted); font-size: 12px; }

.fiche__bloc {
  padding-top: 1.4rem;
  margin-bottom: 1.4rem;
  border-top: 1px solid var(--line);
}

.fiche__label {
  font-family: var(--data);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.fiche__indice {
  color: var(--bruxelles);
  letter-spacing: 0.05em;
  text-transform: none;
}

.barre {
  display: flex;
  height: 7px;
  overflow: hidden;
  margin-bottom: 0.9rem;
}

.barre i { display: block; height: 100%; }
.barre .est-f { background: var(--flandre); }
.barre .est-w { background: var(--wallonie); }
.barre .est-b { background: var(--bruxelles); }

.fiche__chiffres {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fiche__chiffres li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.32rem 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fiche__chiffres li:last-child { border-bottom: 0; }

.fiche__chiffres b {
  font-family: var(--data);
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fiche__phrase {
  font-size: 13.5px;
  line-height: 1.58;
  color: #c3c9db;
}

.fiche__communes {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: com;
}

.fiche__communes li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.42rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
}

.fiche__communes li::before {
  counter-increment: com;
  content: counter(com);
  font-family: var(--data);
  font-size: 10px;
  color: #4d5772;
  flex: none;
  width: 12px;
}

.fiche__communes em {
  font-style: normal;
  flex: 1;
}

.fiche__communes b {
  font-family: var(--data);
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.fiche__presence {
  font-size: 12px;
  color: #5f6880;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

@media (max-width: 991px) {
  .hud {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
  }
  .hud__titre { grid-column: 1; grid-row: 1; }
  .recherche { grid-column: 1; grid-row: 2; width: 100%; }
  .recherche__label, .recherche input, .recherche__aide { text-align: left; }
  .legende { grid-row: 4; max-width: none; }
  .legende__note { display: none; }
  .reglages { grid-column: 1; grid-row: 4; justify-self: end; }
  .aide-souris { display: none; }
  .etiquette { font-size: 11px; }
}

@media (max-width: 575px) {
  .scene { height: 92vh; }
  .hud__sous { display: none; }
  .legende__liste { display: flex; gap: 0.9rem; margin-bottom: 0; }
  .legende__item { font-size: 11.5px; }
  .legende__val { display: none; }
  .reglages__legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fiche { transition: none; }
}

.calque-etiquettes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.sans-js {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: var(--ink);
  padding: clamp(2rem, 6vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sans-js h2 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  max-width: 18ch;
  margin-bottom: 1rem;
}

.sans-js ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
  columns: 2;
  font-family: var(--data);
  font-size: 13px;
  color: var(--muted);
}

.sans-js p { font-size: 13px; color: var(--muted); }
