/* SixStarMods, carte interactive de Leonida */
:root {
  --night: #0c0d1b;
  --night-2: #18182d;
  --ink: #1f1a3a;
  --muted: #5d5480;
  --soft: #f8f5fc;
  --tint: #efe8f8;
  --edge: #d9cdea;
  --pink: #ffb2c6;
  --label: #8d3f72;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night);
}

body {
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Barre du haut */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 28px;
  padding: 10px max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: var(--night);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand { display: flex; align-items: center; padding: 8px 0; color: #ffffff; text-decoration: none; transition: color 0.2s ease; }
.brand:hover { color: var(--pink); }
.brand svg { display: block; width: 40px; height: auto; fill: currentColor; }

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex: 1 1 auto;
}

.nav a {
  color: #d9cff0;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 11px 0;
}

.nav a:hover { color: #ffffff; }

.nav [aria-current="page"] {
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 9px 0;
  border-bottom: 2px solid var(--pink);
}


/* Corps : panneau + carte */
.body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* Panneau a onglets : recherche et fiche en haut, un onglet par genre, outils, liste. Il se replie (largeur 0) :
   son contenu garde sa largeur dans .panel-in, la carte prend la place. */
.panel {
  flex: 0 0 390px;
  width: 390px;
  min-height: 0;
  overflow: hidden;
  background: var(--soft);
  transition: flex-basis 0.25s ease, width 0.25s ease;
}
.panel-in {
  width: 390px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e6dcf2;
}
.panel-in > * { flex-shrink: 0; }
.panel-closed .panel { flex-basis: 0; width: 0; }

/* Bouton pour replier ou rouvrir le panneau : un onglet sur son bord, au milieu de la hauteur */
.panel-toggle {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 390px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 56px;
  padding: 0;
  border: 1px solid #e6dcf2;
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: var(--soft);
  color: var(--ink);
  box-shadow: 3px 0 10px -4px rgba(10, 6, 30, 0.45);
  transform: translateY(-50%);
  cursor: pointer;
  transition: left 0.25s ease, background-color 0.2s ease;
}
.panel-toggle:hover { background: #ffffff; }
.panel-toggle:focus-visible { outline: 3px solid #e05f93; outline-offset: 2px; }
.panel-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s ease; }
.panel-toggle .pt-label { display: none; }
.panel-closed .panel-toggle { left: 0; }
.panel-closed .panel-toggle svg { transform: rotate(180deg); }
.no-anim .panel, .no-anim .panel-toggle, .no-anim .panel-toggle svg { transition: none !important; }

.top { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 12px; }
.top h1 {
  margin: 0;
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 850;
  font-stretch: 82%;
  font-size: 24px;
  line-height: 1;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--edge);
  border-radius: 14px;
  background: #ffffff;
  color: var(--muted);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search:focus-within { border-color: #e889ae; box-shadow: 0 0 0 4px rgba(255, 178, 198, 0.35); }
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  background: center / 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d5480' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}
.search svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: 500 16px Inter, system-ui, sans-serif;
  color: var(--ink);
  padding: 12px 0;
}

.ic { flex: 0 0 auto; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Fiche du lieu choisi */
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid #e6dcf2;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 20px -16px rgba(31, 26, 58, 0.5);
}
.card-head { display: flex; align-items: center; gap: 12px; }
.card-thumb { flex: 0 0 auto; width: 84px; height: 56px; border-radius: 10px; object-fit: cover; }
.card-icon { flex: 0 0 auto; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: var(--tint); color: #443472; }
.card-icon .ic { width: 24px; height: 24px; }
.card-icon img { width: 36px; height: 36px; }
.card-icon.k-water { background: #e3eef8; color: #2f6596; }
.card-icon.k-area { background: #eef1e2; color: #5f6e2c; }
.card-icon.k-place { background: #fbe9f0; color: #a23f69; }
.card-icon.k-interior { background: #fbefe3; color: #a1592a; }
.card-icon.k-county { background: #ecebf3; color: var(--night); }
.card-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kind {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--label);
}
.card h2 {
  margin: 0;
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 850;
  font-stretch: 82%;
  font-size: 24px;
  line-height: 1.05;
  color: var(--ink);
}
.coords { margin: 0; font: 500 12px "IBM Plex Mono", ui-monospace, monospace; color: var(--ink); }
.coords small { display: block; margin-top: 1px; font: 400 11.5px/1.35 Inter, system-ui, sans-serif; color: var(--muted); }
.card-close { flex: 0 0 auto; align-self: flex-start; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.card-close:hover { background: var(--tint); color: var(--ink); }
.card-close .ic { width: 18px; height: 18px; }

.acts { display: flex; flex-wrap: wrap; gap: 8px; }
.act {
  position: relative;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1.5px solid var(--edge);
  background: #ffffff;
  color: var(--ink);
  font: 650 13.5px Inter, system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
}
.act .ic { width: 18px; height: 18px; }
.act:hover { border-color: #cdb9e6; }
.act.is-main { background: var(--night); border-color: var(--night); color: #ffffff; }
.act[data-done]::after {
  content: attr(data-done);
  position: absolute;
  inset: -1.5px;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: var(--night);
  color: #ffffff;
}

/* Onglets */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  border-bottom: 1.5px solid #e6dcf2;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--soft);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 8px 9px;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab-name { font: 650 14px Inter, system-ui, sans-serif; }
.tab-n { font: 600 11.5px "IBM Plex Mono", ui-monospace, monospace; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: #e05f93; }
.tab.is-empty { opacity: 0.45; }

/* Outils de l'onglet : sur la carte, comte */
.tools { display: flex; align-items: center; gap: 8px; padding: 12px 18px 6px; }
.switch {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: 650 13px Inter, system-ui, sans-serif;
  cursor: pointer;
}
.switch .ic { width: 17px; height: 17px; }
.switch[aria-checked="true"] { background: var(--night); border-color: var(--night); color: #ffffff; }
.county {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font: 600 13px Inter, system-ui, sans-serif;
  cursor: pointer;
}

/* Liste */
.list { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 16px; }
.list > * { flex-shrink: 0; }
.county-link { align-self: flex-start; margin: 4px 10px 6px; padding: 0; border: 0; background: transparent; color: #a23f69; font: 650 13px Inter, system-ui, sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.msg { margin: 6px 10px; font-size: 14px; line-height: 1.45; color: var(--muted); }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font: 500 15px Inter, system-ui, sans-serif;
  color: var(--ink);
  cursor: pointer;
}

.row:hover { background: #f1ebf8; }
.row[aria-pressed="true"] { background: var(--tint); font-weight: 650; }
.row .thumb { flex: 0 0 auto; width: 44px; height: 30px; object-fit: cover; border-radius: 6px; }
.row .blip-ic { flex: 0 0 auto; width: 22px; height: 22px; margin: 0 11px; }
.row .dot { flex: 0 0 auto; width: 12px; height: 12px; margin: 0 16px; border-radius: 50%; background: #ffffff; border: 3px solid #443472; }
.row .dot.k-county { border-radius: 3px; background: var(--night); border-color: var(--night); }
.row .dot.k-town, .row .dot.k-keys { background: var(--night); border-color: var(--night); }
.row .dot.k-area { border-color: #8a9a5b; }
.row .dot.k-water { border-color: #3f78a8; }
.row .dot.k-interior { width: 10px; height: 10px; margin: 0 17px; border-width: 2px; border-color: #b0466f; }
.row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .ref { flex: 0 0 auto; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; font-weight: 600; color: var(--muted); }

.note { margin: 12px 10px 0; font-size: 12.5px; line-height: 1.5; color: #6f6690; }

.tab:focus-visible, .row:focus-visible, .act:focus-visible, .switch:focus-visible, .county:focus-visible,
.card-close:focus-visible, .county-link:focus-visible { outline: 3px solid #e05f93; outline-offset: 2px; }

/* Carte */
.viewport {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #335d83;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.viewport.dragging { cursor: grabbing; }
.viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--pink); }

/* Tuiles de la carte : placees au pixel pres par map.js, sous les reperes */
.tiles { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.tile {
  position: absolute;
  display: block;
  max-width: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  -webkit-user-drag: none;
  user-select: none;
}
.tile.is-ready { opacity: 1; }

/* Couche des reperes : meme cadre que la carte entiere, agrandie par transform */
.layer {
  --inv: 1;
  position: absolute;
  top: 4%;
  bottom: 4%;
  left: 50%;
  aspect-ratio: 16384 / 20480;
  transform: translateX(-50%);
  z-index: 1;
  transform-origin: 50% 50%;
}
/* Pendant un deplacement seulement : la couche est dessinee une fois puis agrandie (fluide). A l'arret, le
   navigateur redessine les noms a la taille de l'ecran : ils restent nets meme de tres pres. */
.layer.is-moving { will-change: transform; }

.pins { position: absolute; inset: 0; }

.pin {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.pin:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; border-radius: 8px; }

/* Lieux et boutiques : un point, le nom dessous quand on est assez pres */
.pin.spot,
.pin.inner {
  width: 30px;
  height: 30px;
  display: none;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%) scale(var(--inv));
}

.pin.spot .dot,
.pin.inner .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #443472;
  box-shadow: 0 2px 6px rgba(36, 29, 69, 0.5);
  transition: transform 0.15s ease;
}
.pin.inner .dot { width: 10px; height: 10px; border-width: 2px; border-color: #b0466f; }

.pin.spot.is-sel .dot,
.pin.inner.is-sel .dot { width: 18px; height: 18px; border-color: var(--pink); }

.pin.spot .tag,
.pin.inner .tag {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font: 600 12px Inter, system-ui, sans-serif;
  color: var(--ink);
  background: #ffffff;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(36, 29, 69, 0.25);
}

/* Comtes : grand nom en capitales, sans repere */
.pin.county { transform: translate(-50%, -50%) scale(var(--inv)); }
.pin.county .tag {
  display: block;
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(12, 13, 27, 0.9), 0 0 14px rgba(12, 13, 27, 0.55);
}
.pin.county.is-sel .tag { color: var(--pink); }

/* Zones, quartiers et plans d'eau : nom seul, quand on est assez pres */
.pin.txt { display: none; transform: translate(-50%, -50%) scale(var(--inv)); }
.pin.txt .tag {
  display: block;
  font: 600 12px Inter, system-ui, sans-serif;
  white-space: nowrap;
  color: #2a2440;
  text-shadow: 0 0 3px #ffffff, 0 0 3px #ffffff, 0 0 2px #ffffff;
}
.pin.water .tag { font-style: italic; color: #eef5ff; text-shadow: 0 1px 3px rgba(12, 13, 27, 0.85); }
.pin.txt.is-sel .tag { color: #b0466f; }

/* Ce qui s'affiche selon l'agrandissement */
.zl-2 .pin.txt { display: block; }
.zl-3 .pin.spot { display: flex; }
.zl-4 .pin.spot .tag { display: block; }
.zl-4 .pin.inner { display: flex; }
.zl-5 .pin.inner .tag { display: block; }
.pin.is-sel { display: flex; z-index: 2; }
.pin.txt.is-sel { display: block; }
.pin.is-sel .tag { display: block; }

.pin.region {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%) scale(var(--inv));
  transform-origin: 50% 100%;
}

.pin.region .tag {
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 15px;
  color: #ffffff;
  background: var(--night);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  box-shadow: 0 6px 16px -6px rgba(36, 29, 69, 0.7);
}

.pin.region .stem { width: 2px; height: 10px; background: var(--night); }
.pin.region .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--night); border: 2px solid #ffffff; transition: transform 0.15s ease; }
.pin.region.is-sel .tag { background: var(--pink); color: var(--ink); }
.pin.region.is-sel .stem,
.pin.region.is-sel .dot { background: var(--pink); }
.pin:hover .dot { transform: scale(1.18); }

/* Calques coupes */
.hide-town .pin.region,
.hide-area .pin.area,
.hide-water .pin.water,
.hide-place .pin.spot,
.hide-interior .pin.inner { display: none; }
/* sauf le lieu choisi alors que son calque etait deja coupe (liste, recherche, lien) */
.hide-town .pin.region.is-forced,
.hide-area .pin.area.is-forced,
.hide-water .pin.water.is-forced,
.hide-place .pin.spot.is-forced,
.hide-interior .pin.inner.is-forced { display: flex; }

/* Blips du jeu (carte 2D seulement) : l'icone du jeu, taille fixe a l'ecran, au-dessus des noms */
.blips { position: absolute; inset: 0; pointer-events: none; }
.pin.blip {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(var(--inv));
}
.pin.blip img { display: block; width: 28px; height: 28px; filter: drop-shadow(0 1px 2px rgba(12, 13, 27, 0.75)); transition: transform 0.15s ease; }
.pin.blip:hover img { transform: scale(1.15); }
.pin.blip.is-sel img { transform: scale(1.3); filter: drop-shadow(0 0 3px #ffffff) drop-shadow(0 1px 3px rgba(12, 13, 27, 0.8)); }
.hide-blip-fishing .pin.blip-fishing { display: none; }
.hide-blip-fishing .pin.blip-fishing.is-forced { display: flex; }

.hint {
  position: absolute;
  z-index: 2;
  left: 16px;
  top: 16px;
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  background: rgba(36, 29, 69, 0.78);
  border-radius: 999px;
  padding: 7px 12px;
  pointer-events: none;
}

.zoom {
  position: absolute;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.zoom button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -8px rgba(10, 6, 30, 0.8);
}

.zoom svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.zoom-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(36, 29, 69, 0.78);
  border-radius: 6px;
  padding: 3px 7px;
}

.credit {
  position: absolute;
  z-index: 2;
  left: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  margin: 0;
  font-size: 12px;
  color: #e6dcfa;
  background: rgba(36, 29, 69, 0.78);
  border-radius: 6px;
  padding: 4px 8px;
  pointer-events: none;
}

button:focus-visible,
a:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }

/* Téléphone : la carte en haut, la liste en dessous */
/* Bouton 2D / 3D */
.mode {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(36, 29, 69, 0.82);
  box-shadow: 0 6px 16px -8px rgba(10, 6, 30, 0.8);
}

.mode button {
  min-width: 48px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #e6dcfa;
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.mode button:hover { color: #ffffff; }
.mode button[aria-pressed="true"] { background: #ffffff; color: var(--ink); }
.mode button[aria-busy="true"] { cursor: progress; background: rgba(255, 255, 255, 0.25); }

/* Jour / nuit (sous le choix 2D / 3D, en haut a droite) */
.amb {
  position: absolute;
  z-index: 3;
  top: 68px;
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(36, 29, 69, 0.82);
  box-shadow: 0 6px 16px -8px rgba(10, 6, 30, 0.8);
}
.mode[hidden] + .amb { top: 16px; }
.amb button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #e6dcfa;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.amb button:hover { color: #ffffff; }
.amb button[aria-pressed="true"] { background: #ffffff; color: var(--ink); }
.amb button:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.amb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Nuit, carte 2D : les tuiles passent par la matrice de nuit (filtre SVG fait par map.js, la meme qu'en 3D) ;
   la mer hors des tuiles prend la couleur de nuit de #335d83 */
.viewport.is-night { background: #0e1426; }   /* fond des tuiles de nuit (mer) */
.is-night .pin.txt .tag,
.is-night .l3-area { color: #e3def3; text-shadow: 0 1px 3px rgba(6, 8, 22, 0.95), 0 0 2px rgba(6, 8, 22, 0.95); }
.is-night .pin.txt.is-sel .tag,
.is-night .l3-area.is-sel { color: var(--pink); }

/* Vue 3D (map3d.js) : la carte 2D reste dessous, cachee */
.is-3d .tiles,
.is-3d .layer,
.is-3d > .hint,
.is-3d > .zoom { visibility: hidden; }

.view3d { position: absolute; inset: 0; z-index: 1; background: rgb(200, 211, 221); cursor: grab; }
.view3d.dragging { cursor: grabbing; }
.view3d canvas { display: block; width: 100%; height: 100%; }

.zoom3d .needle { fill: var(--pink); stroke: var(--ink); stroke-width: 1.6; }

.load3d {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(36, 29, 69, 0.82);
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
  pointer-events: none;
}

/* Noms des lieux en 3D : places par map3d.js, les plus importants d'abord, sans chevauchement */
.labels3d { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.l3 {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  white-space: nowrap;
  cursor: pointer;
  visibility: hidden;
  pointer-events: none;
}
.l3.on { visibility: visible; pointer-events: auto; }
.l3:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; border-radius: 8px; }

.l3-county {
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(12, 13, 27, 0.9), 0 0 14px rgba(12, 13, 27, 0.55);
}

.l3-town,
.l3-keys {
  font-family: Archivo, "Arial Narrow", sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  font-size: 15px;
  color: #ffffff;
  background: var(--night);
  border-radius: 999px;
  padding: 6px 12px;
  box-shadow: 0 6px 16px -6px rgba(36, 29, 69, 0.7);
}

.l3-area {
  font: 600 12px Inter, system-ui, sans-serif;
  color: #2a2440;
  text-shadow: 0 0 3px #ffffff, 0 0 3px #ffffff, 0 0 2px #ffffff;
}

.l3-water {
  font: italic 600 12px Inter, system-ui, sans-serif;
  color: #eef5ff;
  text-shadow: 0 1px 3px rgba(12, 13, 27, 0.85);
}

.l3-place,
.l3-interior {
  font: 600 12px Inter, system-ui, sans-serif;
  color: var(--ink);
  background: #ffffff;
  border-radius: 6px;
  padding: 2px 7px;
  box-shadow: 0 2px 6px rgba(36, 29, 69, 0.25);
}

.l3-county.is-sel { color: var(--pink); }
.l3-town.is-sel,
.l3-keys.is-sel { background: var(--pink); color: var(--ink); }
.l3-area.is-sel,
.l3-water.is-sel { color: #b0466f; }
.l3-place.is-sel,
.l3-interior.is-sel { box-shadow: 0 0 0 3px var(--pink); }

@media (max-width: 760px), (max-height: 620px) {
  .zoom3d .opt { display: none; }
  .zoom3d { gap: 6px; }
  .zoom3d button { width: 40px; height: 40px; }
}

@media (max-width: 760px) {
  .topbar { gap: 6px 18px; }
  .body { flex-direction: column; }
  .viewport { order: 1; flex: 0 0 56%; }
  .panel { order: 3; flex: 1 1 auto; width: auto; overflow-y: auto; transition: none; }
  .panel-in { width: auto; height: auto; border-right: 0; }
  .panel-closed .panel { display: none; }
  .panel-closed .viewport { flex: 1 1 auto; }
  /* sur telephone, le bouton est une barre entre la carte et le panneau */
  .panel-toggle {
    position: static;
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border: 0;
    border-top: 1px solid #e6dcf2;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    font: 650 14px Inter, system-ui, sans-serif;
    transition: none;
  }
  .panel-toggle .pt-label { display: inline; }
  .panel-toggle svg { transform: rotate(-90deg); }
  .panel-closed .panel-toggle svg { transform: rotate(90deg); }
  .top { padding: 14px 16px 10px; }
  .top h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabs { position: sticky; top: 0; z-index: 2; }
  .tools { padding: 10px 16px 4px; }
  .list { flex: 0 0 auto; overflow: visible; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .layer { transition: none !important; }
  .pin .dot { transition: none; }
  .panel, .panel-toggle, .panel-toggle svg { transition: none; }
}

/* Arrivée sur la page : la carte et le panneau apparaissent en douceur */
.body { animation: map-in 0.8s ease backwards; }
@keyframes map-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .body { animation: none; } }

/* Discord : tout a droite de la barre du haut */
.discord { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 999px; color: #d9cff0; text-decoration: none; font-weight: 600; font-size: 14px; transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.discord svg { display: block; width: 18px; height: 18px; fill: currentColor; }
.discord:hover, .discord:focus-visible { color: #ffffff; background: #5865f2; border-color: #5865f2; }
@media (max-width: 640px) {
  .discord { width: 36px; padding: 0; justify-content: center; }
  .discord span { display: none; }
  .topbar { column-gap: 16px; }
  .nav { column-gap: 16px; }
}
