:root {
  --bg: #0a1230; --bg2: #111c44; --fg: #eaf1ff; --mut: #8ea2d4; --line: #1c2a61; --acc: #1f5bff; --acc2: #00c8ff;
  --exploitee: #2f6bff; --lgv: #ff1477; --neutralisee: #ff9f1c; --fermee: #8d97b0; --declassee: #56648a;
  --glow: 0 0 0 1px rgba(0, 200, 255, .45), 0 0 16px rgba(0, 110, 255, .45);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--fg); background: var(--bg); }
#map { position: absolute; inset: 0 0 0 380px; }

#side {
  position: absolute; left: 0; top: 0; bottom: 0; width: 380px; display: flex; flex-direction: column; z-index: 2;
  background: radial-gradient(120% 60% at 0% 0%, rgba(31, 91, 255, .28), transparent 60%), var(--bg);
  border-right: 1px solid rgba(0, 200, 255, .35); box-shadow: 4px 0 24px rgba(0, 60, 255, .25);
}
#side header { padding: 12px 14px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(0,60,255,.22), transparent); }
.brand { font-weight: 800; font-size: 19px; letter-spacing: .3px; background: linear-gradient(90deg, #fff 30%, #6fd8ff); -webkit-background-clip: text; background-clip: text; color: transparent; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.logo { width: 26px; height: 26px; background: url(icon.svg) center / contain no-repeat; filter: drop-shadow(0 0 6px rgba(0, 170, 255, .7)); }
.search { position: relative; }
#q { width: 100%; padding: 9px 11px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); color: var(--fg); outline: none; }
#q:focus { border-color: var(--acc2); box-shadow: var(--glow); }
#q::placeholder { color: #6f84b8; }
#results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 60vh; overflow: auto; z-index: 5;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.45), var(--glow);
}
.res { padding: 8px 11px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; border-bottom: 1px solid var(--line); }
.res:last-child { border-bottom: 0; }
.res:hover, .res.on { background: linear-gradient(90deg, rgba(31,91,255,.35), rgba(0,200,255,.08)); }
.res .t { font-weight: 600; }
.res .s { color: var(--mut); font-size: 12px; margin-left: auto; text-align: right; }
.res .k { font-size: 10px; text-transform: uppercase; color: var(--mut); width: 44px; flex: none; }

#panel { flex: 1; overflow: auto; padding: 14px; }
.welcome { color: var(--mut); font-size: 14px; line-height: 1.5; }
.welcome code { background: var(--bg2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: var(--fg); }
h2 { margin: 0 0 4px; font-size: 20px; line-height: 1.2; }
h3 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--acc2); }
.sub { color: var(--mut); font-size: 13px; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(31, 91, 255, .18); border: 1px solid rgba(0, 200, 255, .35); color: #bfe9ff; }
.tag.lgv { background: linear-gradient(135deg, #ff1477, #ff5fa8); color: #fff; border-color: transparent; }
.close { float: right; border: 0; background: none; font-size: 20px; color: var(--mut); cursor: pointer; line-height: 1; }
.row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.row:hover { background: rgba(31, 91, 255, .22); }
.row .pk { margin-left: auto; font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--mut); white-space: nowrap; }
.row .nm { overflow: hidden; text-overflow: ellipsis; }
.row.static { cursor: default; } .row.static:hover { background: none; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; padding: 2px 6px; border-radius: 4px; background: linear-gradient(135deg, #003cff, #0096ff); color: #fff; flex: none; box-shadow: 0 0 8px rgba(0, 120, 255, .5); }
.code.lgv { background: linear-gradient(135deg, #ff1477, #ff5fa8); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 5px; color: #fff; cursor: pointer; border: 0; max-width: 100%; text-align: left; }
.chip b { margin-right: 4px; }
.chip:hover { filter: brightness(1.12); }
.kind { font-size: 11px; color: var(--mut); margin: 10px 0 4px; }
.stops { position: relative; margin-left: 6px; }
.stops .row { padding-left: 18px; position: relative; }
.stops .row::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 3px; background: var(--rc, var(--acc)); }
.stops .row::after { content: ""; position: absolute; left: 3px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-radius: 50%; background: var(--bg); border: 2px solid var(--rc, var(--acc)); }
.stops .row:first-child::before { top: 50%; } .stops .row:last-child::before { bottom: 50%; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.kv td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.kv td.pk { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; color: var(--mut); }
.gopk { display: flex; gap: 6px; margin-top: 6px; }
.gopk input { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); color: var(--fg); font-family: ui-monospace, Consolas, monospace; }
.btn { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg2); color: var(--fg); cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--acc2); box-shadow: var(--glow); }
.btn { background: linear-gradient(135deg, #003cff, #0096ff); border-color: transparent; color: #fff; font-weight: 600; }
.muted { color: var(--mut); font-size: 13px; }

#side footer { border-top: 1px solid var(--line); padding: 8px 14px 10px; font-size: 13px; }
#opts summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.opt-group { margin: 8px 0; }
.opt-title { font-size: 11px; text-transform: uppercase; color: var(--mut); margin-bottom: 3px; letter-spacing: .5px; }
.opt-group label { display: flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; }
.opt-group select { padding: 4px 6px; background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 5px; }
.sw { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.sw.exploitee { border-color: var(--exploitee); } .sw.neutralisee { border-top-style: dashed; border-color: var(--neutralisee); }
.sw.fermee { border-top-style: dashed; border-color: var(--fermee); } .sw.declassee { border-top-style: dotted; border-color: var(--declassee); }
.credits { font-size: 10.5px; color: var(--mut); margin-top: 6px; line-height: 1.35; }

#tip {
  position: absolute; z-index: 4; pointer-events: none; background: rgba(10, 18, 48, .94); box-shadow: var(--glow); color: #fff;
  padding: 6px 9px; border-radius: 6px; font-size: 12.5px; line-height: 1.35; white-space: nowrap; transform: translate(14px, 14px);
}
#tip .pk { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: #5fe0ff; }
.maplibregl-popup-content { background: var(--bg); color: var(--fg); padding: 9px 26px 9px 12px; border-radius: 8px; font-size: 13px; box-shadow: var(--glow); }
.maplibregl-popup-close-button { color: var(--mut); }
.popk { color: #5fe0ff; }
.maplibregl-popup-tip { border-top-color: var(--bg) !important; border-bottom-color: var(--bg) !important; }
.popk { font-family: ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 700; }
.poplink { color: #6fb3ff; cursor: pointer; text-decoration: underline; }

/* Téléphone : panneau en bas */
@media (max-width: 760px) {
  #map { inset: 0; }
  #side { top: auto; width: 100%; height: 46vh; border-right: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -6px 20px rgba(0,0,0,.15); }
  #side.min { height: auto; }
  #side.min #panel, #side.min footer { display: none; }
  #side header { padding-top: 8px; }
  .brand { font-size: 15px; margin-bottom: 6px; cursor: pointer; }
  .brand::after { content: "▾"; margin-left: auto; color: var(--mut); }
  #side.min .brand::after { content: "▴"; }
  #results { top: auto; bottom: calc(100% + 4px); max-height: 40vh; }
  #tip { display: none; }
}
.sw.lgv { border-top-width: 4px; border-color: var(--lgv); }
.only-touch { display: none; }
@media (pointer: coarse) { .only-touch { display: inline; } .only-desk { display: none; } }
@media (max-width: 760px) {
  #side { height: 50vh; }
  #side footer { padding: 6px 14px 8px; }
  .credits { display: none; }
  #opts[open] ~ .credits { display: block; }
  .maplibregl-ctrl-top-right { top: env(safe-area-inset-top); }
}
