:root {
  color-scheme: light;
  --ui-bg: rgba(250, 251, 253, .88);
  --ui-fort: rgba(255, 255, 255, .95);
  --ui-texte: #18202a;
  --ui-doux: #4f5b69;
  --ui-bord: rgba(20, 30, 46, .14);
  --ui-ombre: 0 8px 24px rgba(15, 23, 42, .18);
  --ui-survol: rgba(20, 53, 105, .08);
  --ui-accent: #133569;
  --ui-actif: #133569;
  --ui-actif-texte: #fff;
  --ui-filet: rgba(20, 30, 46, .1);
  --plan-bord: rgba(255, 255, 255, .92);
  --plan-filtre: none;
  --plaque-bleu: #133569;
  --marge: 14px;
  --haut-panneau: 54px;
  font: 13px/1.4 system-ui, sans-serif;
}
:root[data-theme="sombre"] {
  color-scheme: dark;
  --ui-bg: rgba(18, 22, 29, .84);
  --ui-fort: rgba(22, 27, 36, .96);
  --ui-texte: #f3f6fa;
  --ui-doux: #bdc8d6;
  --ui-bord: rgba(255, 255, 255, .16);
  --ui-ombre: 0 8px 26px rgba(0, 0, 0, .36);
  --ui-survol: rgba(255, 255, 255, .10);
  --ui-accent: #90baff;
  --ui-actif: #3b75d2;
  --ui-filet: rgba(255, 255, 255, .10);
  --plan-bord: rgba(24, 30, 40, .86);
  --plan-filtre: brightness(.82) contrast(1.08) saturate(.88);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #cdd6de; }
#scene { position: fixed; inset: 0; }
.surface {
  background: var(--ui-bg); color: var(--ui-texte); border: 1px solid var(--ui-bord);
  box-shadow: var(--ui-ombre); backdrop-filter: blur(14px);
}
.mono { font-family: ui-monospace, Menlo, monospace; font-variant-numeric: tabular-nums; }
.attenue { color: var(--ui-doux); }
.lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--ui-accent); }
:where(button, a, input, summary):focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
button[aria-pressed="true"], button.actif { background: var(--ui-actif); color: var(--ui-actif-texte); }

#plaque {
  position: fixed; z-index: 5; top: var(--marge); left: var(--marge); width: min(266px, calc(100vw - 2 * var(--marge)));
  border-radius: 12px; overflow: hidden;
}
.plaque {
  min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 12px;
  background: var(--plaque-bleu); color: #f7f9fc; border-bottom: 1px solid #ffffff29;
  box-shadow: inset 0 0 0 2px var(--plaque-bleu), inset 0 0 0 3px #dce6f761;
}
.plaque-titre {
  display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 1px; padding: 0; margin-right: 4px;
  border: 0; background: transparent; text-align: left; line-height: 1.2;
}
.plaque small { font-size: 9px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #e0e8f5; }
.plaque small, .plaque span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plaque span { font-size: 13px; font-weight: 700; }
.plaque-bouton {
  display: grid; place-items: center; flex: 0 0 26px; height: 26px; padding: 0;
  border: 1px solid #ffffff38; border-radius: 7px; background: #ffffff1a; font-size: 12px;
}
.plaque button:focus-visible { outline-color: #fff; }
.plaque-bouton:hover, .plaque-bouton[aria-expanded="true"] { background: #ffffff3d; }
#bloc-recherche { background: var(--ui-fort); }
#recherche-lieu {
  width: 100%; border: 0; border-radius: 0; padding: 7px 11px; color: inherit; background: transparent; font-size: 12px;
}
#recherche-lieu:focus-visible { outline-offset: -2px; }
#recherche-lieu::placeholder { color: var(--ui-doux); }
#suggestions-lieux { max-height: min(198px, 27dvh); overflow: auto; border-top: 1px solid var(--ui-filet); }
.suggestion { padding: 5px 11px; cursor: pointer; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: var(--ui-survol); }
#position { padding: 7px 11px; font-size: 11px; border-top: 1px solid var(--ui-filet); }
#position-coordonnees { background: transparent; border: 0; border-radius: 4px; padding: 0 3px; }
#position-coordonnees:hover { background: var(--ui-survol); }

#commandes { position: fixed; z-index: 5; top: var(--marge); right: var(--marge); display: flex; gap: 7px; }
.pilule {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; height: 32px;
  padding: 0 11px; border-radius: 999px; font-size: 11.5px; transition: border-color .15s, background .15s;
}
.pilule:hover, .pilule[aria-expanded="true"] { border-color: var(--ui-accent); background: var(--ui-fort); }
.pilule.carre { width: 32px; justify-content: center; padding: 0; font-size: 14px; }
#copier-lien { min-width: 77px; justify-content: center; padding-inline: 7px; }
.panneau {
  position: fixed; z-index: 7; top: var(--haut-panneau); right: var(--marge); width: min(240px, calc(100vw - 2 * var(--marge)));
  max-height: calc(100dvh - var(--haut-panneau) - 46px); overflow: auto;
  padding: 11px 13px; border-radius: 12px; font-size: 11.5px;
}
.panneau h2 { display: flex; justify-content: space-between; gap: 4px; margin: 0 0 8px; font-size: 12px; }
.panneau h2 output { white-space: nowrap; font-size: 11px; }
.panneau a { font-weight: 600; text-decoration: none; }
.panneau a:hover { text-decoration: underline; }
#etat-monde { margin: 7px 0 0; }
.ligne { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--ui-filet); }
.ligne:last-child { border-bottom: 0; }
#vitesses { align-items: flex-start; flex-direction: column; }
#panneau-vitesse { width: min(276px, calc(100vw - 2 * var(--marge))); }
#panneau-vitesse h2 { flex-wrap: wrap; align-items: baseline; }
#panneau-vitesse .ligne { align-items: flex-start; flex-direction: column; }
#facteur-course { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; overflow: hidden; }
#facteur-course button { padding-inline: 2px; text-align: center; }
.groupe { display: flex; flex-wrap: wrap; gap: 4px; }
.curseur { display: block; width: 100%; margin: 4px 0 8px; cursor: pointer; }
input { accent-color: var(--ui-actif); }
.segments { display: inline-flex; border: 1px solid var(--ui-bord); border-radius: 7px; }
.segments button { padding: 3px 6px; border: 0; background: transparent; color: var(--ui-doux); font-size: 10.5px; white-space: nowrap; }
.segments button:first-child { border-radius: 6px 0 0 6px; }
.segments button:last-child { border-radius: 0 6px 6px 0; }
.segments button:hover { background: var(--ui-survol); }
.segments button[aria-pressed="true"] { background: var(--ui-actif); color: var(--ui-actif-texte); font-weight: 600; }
:is(.panneau, #fiche) button:not(.segments button) {
  padding: 3px 8px; border: 1px solid var(--ui-bord); border-radius: 6px; background: var(--ui-fort); font-size: 11px;
}
:is(.panneau, #fiche) button:not(.segments button):hover { border-color: var(--ui-accent); }
:is(.panneau, #fiche) button.actif:not(.segments button) { background: var(--ui-actif); color: var(--ui-actif-texte); }

#rail-regional { padding: 5px 8px; font-size: 11px; flex-wrap: wrap; }
#rail-regional label { display: inline-flex; align-items: center; gap: 4px; }

#plan {
  position: fixed; z-index: 4; bottom: var(--marge); left: var(--marge); width: 142px; height: 98px;
  border: 2px solid var(--plan-bord); border-radius: 12px; overflow: hidden; background: #dbe9ee; box-shadow: var(--ui-ombre);
  transition: width .22s cubic-bezier(.2,.8,.2,1), height .22s cubic-bezier(.2,.8,.2,1);
}
#mini-carte { display: block; width: 100%; height: 100%; filter: var(--plan-filtre); cursor: crosshair; touch-action: none; }
#commandes-zoom, #vue-ensemble, #zoom-plan { position: absolute; border-radius: 8px; }
#commandes-zoom { bottom: 6px; right: 6px; display: grid; }
#commandes-zoom button, #vue-ensemble { display: grid; place-items: center; width: 24px; padding: 0; }
#commandes-zoom button { height: 22px; border: 0; background: transparent; font-size: 14px; font-weight: 700; }
#commandes-zoom button:first-child { border-bottom: 1px solid var(--ui-filet); }
#commandes-zoom button:hover, #vue-ensemble:hover { background: var(--ui-fort); }
#vue-ensemble { bottom: 6px; left: 6px; height: 24px; }
#vue-region { position: absolute; bottom: 6px; left: 34px; height: 24px; padding: 0 5px; border-radius: 8px; font-size: 10px; }
#vue-region:hover { background: var(--ui-fort); }
#zoom-plan { top: 6px; left: 6px; padding: 1px 6px; font-size: 9.5px; opacity: 0; transition: opacity .15s; pointer-events: none; }
#plan:is(:hover, :focus-within, .agrandi) #zoom-plan { opacity: 1; }

#credit-sources {
  position: fixed; z-index: 5; right: var(--marge); bottom: var(--marge); display: inline-flex; align-items: center;
  height: 24px; padding: 0 9px; border-radius: 999px; font-size: 10.5px; text-decoration: none; white-space: nowrap;
}
.credit-extra { max-width: 0; opacity: 0; overflow: hidden; transition: max-width .24s ease, opacity .18s ease, margin-left .2s ease; }
#credit-sources:is(:hover, :focus-visible) .credit-extra { max-width: 140px; opacity: 1; margin-left: 6px; }

#fiche {
  position: fixed; z-index: 6; top: var(--haut-panneau); right: var(--marge); width: min(360px, calc(100vw - 2 * var(--marge)));
  max-height: calc(100dvh - var(--haut-panneau) - 46px); overflow: auto; border-radius: 12px; padding: 11px 13px;
}
#fiche h2 { margin: 0 28px 6px 0; font-size: 14px; }
#fiche .id { color: var(--ui-doux); font: 12px ui-monospace, monospace; overflow-wrap: anywhere; }
#fiche table { width: 100%; border-collapse: collapse; margin-top: 6px; }
#fiche td { padding: 3px 4px; border-top: 1px solid var(--ui-filet); vertical-align: top; }
#fiche td:first-child { color: var(--ui-doux); }
#fiche td:last-child { font: 11.5px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; }
#fiche details { margin-top: 8px; border-top: 1px solid var(--ui-bord); padding-top: 4px; }
#fiche summary { cursor: pointer; color: var(--ui-doux); }
#fiche button:not(#fermer-fiche) { margin: 8px 6px 0 0; }
#fermer-fiche { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; }
#suivi-individuel { border-top: 1px solid var(--ui-bord); margin-top: 12px; padding-top: 10px; }
#suivi-individuel h3 { margin: 0; font-size: 14px; }
#suivi-individuel .aide-suivi { color: var(--ui-doux); font-size: 12px; }
#suivi-individuel :is(.borne-suivi, time) { font: 12px/1.5 ui-monospace, monospace; }
#suivi-individuel ol { list-style: none; padding: 0; margin: 8px 0; }
#suivi-individuel li { border-left: 3px solid var(--ui-accent); padding: 5px 0 5px 9px; margin: 8px 0; overflow-wrap: anywhere; }
#suivi-individuel li p { margin: 3px 0; }

#chargement {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 20;
  max-width: min(520px, calc(100% - 32px)); margin: 0; padding: 12px 16px; border-radius: 12px; text-align: center;
}
@media (max-width: 560px) {
  :root { --marge: 8px; --haut-panneau: 126px; }
  #commandes { top: 84px; }
  #plaque:has(#position:not([hidden]), #suggestions-lieux:not([hidden])) { z-index: 8; }
  #plan:is(:hover, :focus-within, .agrandi) { bottom: 38px; }
  #credit-sources:is(:hover, :focus-visible) { z-index: 6; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
.plaque-titre:has(#commune:not([hidden]), #nom-rue:not([hidden])) #plaque-defaut { display: none; }
.plaque-titre:has(#nom-rue[hidden]) #commune { font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; color: inherit; }

#fiche-lieu {
  position: relative; max-height: max(96px, calc(100dvh - 294px)); overflow: auto;
  padding: 10px 11px; background: var(--ui-fort); border-top: 1px solid var(--ui-filet);
}
#fiche-lieu h2 { margin: 0 30px 3px 0; font-size: 16px; line-height: 1.25; }
#fiche-lieu h2:focus { outline: none; }
#adresse-lieu { margin: 0 0 8px; font-size: 12px; }
#adresse-lieu:empty { display: none; }
#fiche-lieu h3 { margin: 9px 0 3px; font-size: 12px; }
#fiche-lieu button, #filtre-lieux {
  border: 1px solid var(--ui-bord); background: transparent; color: inherit; border-radius: 7px; padding: 4px 7px;
}
#fiche-lieu button:hover { background: var(--ui-survol); }
#fermer-lieu { position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; font-size: 16px; line-height: 1; }
.actions-lieu { display: flex; gap: 5px; margin-top: 8px; }
#fiche-lieu :is(#aller-lieu, button[aria-pressed="true"]) { background: var(--ui-actif); color: var(--ui-actif-texte); }
#proximite-camera { margin-top: 8px; font-size: 11px; }
#filtres-lieux { display: flex; flex-wrap: wrap; gap: 4px; margin: 9px 0 7px; }
#filtres-lieux button { border-radius: 999px; font-size: 11px; }
#filtre-lieux { width: 100%; font-size: 12px; }
.liste-lieux { padding-top: 4px; font-size: 12px; }
#fiche-lieu .ligne-lieu {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; text-align: left;
  column-gap: 5px; border: 0; border-bottom: 1px solid var(--ui-filet); padding: 6px 2px;
}
.ligne-lieu .attenue { grid-column: 1; font-size: 11px; }
.distance-lieu { grid-area: 1 / 2; font-size: 10px; }
.statut-lieu { grid-column: 2; color: var(--ui-doux); font-size: 10px; }
.statut-lieu.ouvert { color: var(--ui-accent); }

#plan:is(:hover, :focus-within, .agrandi, .plongee) { width: min(360px, calc(100vw - 2 * var(--marge))); height: min(258px, 42dvh); }
#plaque:has(#fiche-lieu:not([hidden])) #fiche-lieu { max-height: max(96px, calc(100dvh - 382px)); }
#icones-plan { position: absolute; inset: 0; pointer-events: none; display: none; }
#plan:is(:hover, :focus-within, .agrandi, .plongee) #icones-plan { display: block; }
.icone-lieu {
  position: absolute; display: grid; place-items: center; transform: translate(-50%, -50%);
  border: 1px solid var(--ui-bord); border-radius: 50%; background: var(--ui-fort); color: var(--ui-accent);
  width: 19px; height: 19px; padding: 0; font-size: 10px; font-weight: 750; pointer-events: auto;
}
.icone-lieu:is(:hover, .selection) { color: var(--ui-actif-texte); background: var(--ui-actif); z-index: 1; }
#bonhomme {
  position: absolute; top: 6px; right: 6px; display: grid; place-items: center; padding: 0;
  width: 26px; height: 27px; border-radius: 8px; color: #946000; opacity: 0;
  cursor: grab; touch-action: none;
}
:root[data-theme="sombre"] #bonhomme { color: #ffcf55; }
#plan:is(:hover, :focus-within, .agrandi, .plongee) #bonhomme { opacity: 1; }
#bonhomme svg { pointer-events: none; }
#bonhomme[aria-pressed="true"] { background: #ffcf55; color: #422700; }
#plan.plongee #icones-plan button { pointer-events: none; }
#visee-plongee {
  position: fixed; z-index: 19; width: 19px; height: 19px; border: 2px solid #ffce50; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 1px #352600, inset 0 0 0 1px #352600;
}

#fiche .fiche-choix-habitant { margin-top: 10px; border-top: 1px solid var(--ui-filet); }
.fiche-choix-habitant h3 { margin: 10px 0 3px; font-size: 13px; }
.fiche-choix-habitant h4 { margin: 7px 0 3px; font-size: 12px; }
.fiche-choix-habitant p { margin: 3px 0; }
.fiche-choix-habitant [role="status"] { color: var(--ui-doux); }
.fiche-choix-habitant [role="status"]:empty { display: none; }
.fiche-choix-habitant ul { margin: 4px 0; padding-left: 18px; }
