:root {
  --bg: #0b0f0e; --panel: #121816; --panel2: #1a221f; --line: #2c3833; --text: #e8e4d8; --dim: #9aa39c;
  --gold: #f2b91f; --gold-dim: #8a6d22; --red: #e8604a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, "Segoe UI", Roboto, sans-serif; }
body { display: flex; flex-direction: column; }
/* Sous le bandeau de la coque des outils (outil-shell), la carte prend toute la hauteur restante. */
.carte-tete { padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.carte-titre { margin: 0; font-size: 20px; }
#app { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 340px; }
#map { position: relative; background: #0d1210; }
.leaflet-container { background: #0d1210; font: inherit; } /* autour de la carte : sombre, comme le site (demandé le 21/11) */
.leaflet-control-attribution { display: none; }

/* bord : graduations km */
.edge { position: absolute; z-index: 500; pointer-events: none; font: 600 11px/1 ui-monospace, Consolas, monospace; color: #1d2422; }
.edge span { position: absolute; background: rgba(242,185,31,.9); padding: 2px 4px; border-radius: 3px; transform: translateX(-50%); white-space: nowrap; }
.edge span:not(.km) { background: rgba(15,20,18,.85); color: #f2b91f; }
.edge-x { left: 0; right: 340px; top: 6px; height: 16px; }
.edge-z { top: 0; bottom: 0; left: 6px; width: 40px; }
.edge-z span { transform: translateY(-50%); }

.cursor-box { position: absolute; z-index: 500; left: 50%; bottom: 10px; transform: translateX(calc(-50% - 170px)); pointer-events: none;
  background: rgba(11,15,14,.86); border: 1px solid var(--gold-dim); border-radius: 8px; padding: 5px 10px; font: 600 13px ui-monospace, Consolas, monospace; display: flex; gap: 12px; }
.cursor-box #cursorGrid { color: var(--gold); }

#side { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
#side header { position: relative; }
.kicker { color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: .04em; }
h1 small { display: block; font-size: 12px; color: var(--dim); font-weight: 400; letter-spacing: 0; }
#langBtn { position: absolute; right: 0; top: 0; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.label { color: var(--gold); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.label-row { display: flex; justify-content: space-between; align-items: center; }
.big { font: 700 20px ui-monospace, Consolas, monospace; }
.sub { color: var(--dim); font-size: 12px; margin: 0; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row.small { gap: 12px; }
.btn { background: var(--gold); color: #1a1405; border: 0; border-radius: 6px; padding: 6px 10px; font-weight: 700; cursor: pointer; font-size: 12.5px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.mini { background: transparent; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.mini:disabled { opacity: .4; cursor: default; }
.link { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }
.search { display: flex; gap: 6px; }
.search input { flex: 1; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: 13px ui-monospace, Consolas, monospace; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.list li:hover { background: rgba(242,185,31,.08); }
.list li b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li small { color: var(--dim); font-family: ui-monospace, Consolas, monospace; }
.list li button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; }
.list .empty { color: var(--dim); font-size: 12px; cursor: default; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; color: var(--dim); }
.legend i { display: inline-block; width: 14px; height: 5px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
footer { margin-top: auto; }

/* éléments posés sur la carte */
.pin-target { width: 18px; height: 18px; border: 2px solid var(--red); border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.pin-mark { background: var(--c, var(--gold)); color: #1a1405; border-radius: 4px; padding: 1px 5px; font: 700 11px system-ui; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.4); transform: translate(-50%, -100%); position: absolute; }
.pin-mark::after { content: ""; position: absolute; left: 50%; top: 100%; border: 5px solid transparent; border-top-color: var(--c, var(--gold)); transform: translateX(-50%); }
.hill { font: 600 10px system-ui; color: #4a3a22; text-shadow: 0 0 2px #fff, 0 0 2px #fff; white-space: nowrap; transform: translate(-50%, -50%); position: absolute; }
.hill::before { content: "▲"; font-size: 8px; margin-right: 2px; }
.ent { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid rgba(0,0,0,.6); }
.ent.other { border-radius: 50%; width: 8px; height: 8px; }

#toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(calc(-50% - 170px)); background: var(--gold); color: #1a1405; font-weight: 700; padding: 8px 14px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 1000; }
#toast.on { opacity: 1; }

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 60vh 1fr; }
  #side { border-left: 0; border-top: 1px solid var(--line); }
  .edge-x { right: 0; }
  .cursor-box, #toast { transform: translateX(-50%); }
}

/* noms de lieux, du plus important au plus discret */
.place { position: absolute; transform: translate(-50%, -50%) scale(var(--ps, 1)); white-space: nowrap; pointer-events: none; color: #222; font-family: system-ui, "Segoe UI", sans-serif;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.p-capital { font: 800 17px system-ui; letter-spacing: .02em; }
.p-town { font: 700 15px system-ui; }
.p-village { font: 600 12.5px system-ui; }
.p-local { font: 500 11px system-ui; color: #3a3a3a; }
.p-poi { font: italic 500 11px system-ui; color: #4a4036; }
.p-hill { font: 600 10px system-ui; color: #6a4a1e; letter-spacing: .08em; }
.p-island { font: italic 600 12px system-ui; color: #333; }
.p-water, .p-bay { font: italic 500 11.5px system-ui; color: #1f5f8b; }
.p-sea { font: italic 600 14px system-ui; color: #1f5f8b; letter-spacing: .15em; }
.p-region { font: 600 12px system-ui; color: rgba(60,60,60,.55); letter-spacing: .3em; }

/* calques */
.layers { display: flex; flex-direction: column; gap: 3px; }
.layer { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; border: 1px solid transparent; }
.layer.on { border-color: var(--gold-dim); background: rgba(242,185,31,.08); }
.layer.off .lname { opacity: .45; text-decoration: line-through; }
.layer input[type=color] { width: 20px; height: 20px; padding: 0; border: 0; background: none; cursor: pointer; }
.layer .lname { flex: 1; cursor: pointer; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer small { color: var(--dim); font-family: ui-monospace, Consolas, monospace; }
.layer button { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 14px; padding: 0 2px; }
.layer button:hover { color: var(--gold); }
.list .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.list select { background: var(--bg); color: var(--dim); border: 1px solid var(--line); border-radius: 4px; font-size: 11px; max-width: 90px; }
/* choix de la carte (Everon, Kolguyev) */
.choix-carte { font: inherit; font-weight: 800; color: inherit; background: transparent; border: 1px solid #8a6d22; border-radius: 6px; padding: 0 4px; cursor: pointer; }
.choix-carte option { background: #121816; color: #e8e4d8; font-size: 14px; }
