:root {
  --bg: #111416;
  --panel: rgba(17, 20, 22, 0.88);
  --panel-solid: #171b1e;
  --panel-hover: #22282c;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f4f6f7;
  --muted: #aab3b8;
  --accent: #d7e65a;
  --danger-low: #d7e65a;
  --danger-medium: #ffb646;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.skip-link { position: fixed; z-index: 1000; top: .75rem; left: .75rem; transform: translateY(-180%); padding: .7rem 1rem; background: var(--accent); color: #111416; font-weight: 800; text-decoration: none; }
.skip-link:focus { transform: translateY(0); }

.app-shell, .map { position: absolute; inset: 0; }
.map { background: #15191b; }

.map::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(10,12,13,.30), transparent 20%), linear-gradient(0deg, rgba(10,12,13,.22), transparent 18%); }

.topbar { position: fixed; z-index: 20; top: 0; right: 0; left: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; min-height: 92px; padding: 1.25rem 1.4rem; pointer-events: none; background: linear-gradient(180deg, rgba(10,12,13,.92), rgba(10,12,13,0)); }
.topbar > * { pointer-events: auto; }
.brand-name { display: flex; align-items: baseline; font-size: clamp(1.5rem, 3vw, 2.15rem); font-weight: 900; letter-spacing: -.045em; line-height: 1; }
.brand-be { color: var(--accent); }
.brand-tagline { margin: .35rem 0 0; max-width: 32rem; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .015em; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; padding-top: .1rem; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.demo-badge { padding: .35rem .55rem; border: 1px solid rgba(215,230,90,.5); color: var(--accent); }
.language-switch { display: flex; align-items: center; gap: .35rem; }
.language-button { border: 0; padding: .2rem; background: transparent; color: var(--muted); cursor: pointer; }
.language-button.is-active { color: var(--text); }
.update-time { display: flex; gap: .45rem; white-space: nowrap; }

.layer-panel { position: fixed; z-index: 25; top: 50%; right: 1.25rem; width: 10.5rem; transform: translateY(-50%); }
.layer-list { overflow: hidden; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.layer-button { position: relative; display: grid; grid-template-columns: 1.4rem 1fr .55rem; align-items: center; gap: .7rem; width: 100%; min-height: 3.15rem; border: 0; border-bottom: 1px solid var(--line); padding: .45rem .75rem; background: transparent; color: var(--muted); cursor: pointer; text-align: left; transition: background-color 160ms ease, color 160ms ease; }
.layer-button:last-child { border-bottom: 0; }
.layer-button:hover { background: var(--panel-hover); color: var(--text); }
.layer-button.is-active { background: var(--text); color: #111416; }
.layer-button.is-active::before { content: ""; position: absolute; inset: 0 auto 0 0; width: .25rem; background: var(--accent); }
.layer-icon { display: grid; place-items: center; width: 1.35rem; font-size: 1.15rem; font-weight: 900; }
.layer-label { overflow: hidden; font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.layer-indicator { width: .48rem; height: .48rem; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: #5d666b; }
.layer-indicator--low { border-color: var(--danger-low); background: var(--danger-low); }
.layer-indicator--medium { border-color: var(--danger-medium); background: var(--danger-medium); }
.layer-button.is-active .layer-indicator { border-color: #111416; }
.clear-button { width: 100%; margin-top: .55rem; border: 1px solid var(--line); padding: .65rem .75rem; background: var(--panel); color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; cursor: pointer; backdrop-filter: blur(16px); }
.clear-button:hover { border-color: var(--line-strong); color: var(--text); }

.status-card { position: fixed; z-index: 20; left: 1.25rem; bottom: 3.35rem; width: min(22rem, calc(100vw - 15rem)); border-left: .22rem solid var(--accent); padding: 1rem 1.1rem; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.status-eyebrow { margin: 0 0 .3rem; color: var(--accent); font-size: .66rem; font-weight: 900; text-transform: uppercase; letter-spacing: .13em; }
.status-card h1 { margin: 0; font-size: 1.2rem; letter-spacing: -.025em; }
.status-card p { margin: .45rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.status-source { font-size: .68rem !important; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.map-actions { position: fixed; z-index: 25; right: 1.25rem; bottom: 3.35rem; display: flex; gap: .5rem; }
.map-action-button { display: flex; align-items: center; justify-content: center; gap: .55rem; min-height: 2.8rem; border: 1px solid var(--line); padding: .65rem .9rem; background: var(--panel); color: var(--text); font-size: .76rem; font-weight: 800; cursor: pointer; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.map-action-button:hover { border-color: var(--accent); }
.map-action-button--icon { width: 2.8rem; padding-inline: 0; font-size: 1.1rem; }
.location-message { position: fixed; z-index: 30; right: 1.25rem; bottom: 6.6rem; max-width: 18rem; padding: .7rem .85rem; background: #111416; color: var(--text); box-shadow: var(--shadow); font-size: .74rem; line-height: 1.4; opacity: 0; transform: translateY(.6rem); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.location-message.is-visible { opacity: 1; transform: translateY(0); }
.map-footer { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; padding: .65rem 1.25rem; background: linear-gradient(0deg, rgba(10,12,13,.9), rgba(10,12,13,0)); color: rgba(255,255,255,.5); font-size: .64rem; text-align: center; pointer-events: none; }

.maplibregl-ctrl-bottom-right { bottom: 2.4rem; }
.maplibregl-ctrl-attrib { border-radius: 0 !important; background: rgba(17,20,22,.72) !important; color: #d6dcdf !important; }
.maplibregl-ctrl-attrib a { color: #f4f6f7 !important; }
.beradar-popup .maplibregl-popup-content { min-width: 13rem; border: 1px solid var(--line); border-radius: 0; padding: .9rem 1rem; background: #171b1e; color: var(--text); box-shadow: var(--shadow); }
.beradar-popup .maplibregl-popup-tip { border-top-color: #171b1e !important; border-bottom-color: #171b1e !important; }
.popup-title { margin: 0; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.popup-text { margin: .45rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.42; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; min-height: 82px; padding: 1rem .9rem; }
  .brand-tagline { max-width: 14rem; font-size: .68rem; line-height: 1.3; }
  .topbar-actions { gap: .65rem; }
  .demo-badge, .update-time span { display: none; }
  .layer-panel { top: auto; right: 0; bottom: 0; left: 0; width: auto; transform: none; padding: 0 0 env(safe-area-inset-bottom); background: var(--panel-solid); }
  .layer-list { display: flex; overflow-x: auto; border-right: 0; border-bottom: 0; border-left: 0; box-shadow: 0 -12px 30px rgba(0,0,0,.32); scrollbar-width: none; }
  .layer-list::-webkit-scrollbar { display: none; }
  .layer-button { flex: 0 0 5.4rem; grid-template-columns: 1fr; grid-template-rows: 1.2rem auto; gap: .25rem; min-height: 4.1rem; border-right: 1px solid var(--line); border-bottom: 0; padding: .45rem .35rem; text-align: center; }
  .layer-button.is-active::before { inset: 0 0 auto; width: auto; height: .2rem; }
  .layer-icon { width: 100%; font-size: 1rem; }
  .layer-label { font-size: .66rem; }
  .layer-indicator { position: absolute; top: .45rem; right: .45rem; }
  .clear-button { position: absolute; right: .6rem; bottom: calc(4.65rem + env(safe-area-inset-bottom)); width: auto; margin: 0; padding: .55rem .65rem; background: rgba(17,20,22,.9); }
  .status-card { left: .75rem; bottom: calc(5.45rem + env(safe-area-inset-bottom)); width: calc(100vw - 1.5rem); padding: .8rem .9rem; }
  .status-card h1 { font-size: 1rem; }
  .status-card p { font-size: .73rem; }
  .map-actions { right: auto; bottom: calc(10.7rem + env(safe-area-inset-bottom)); left: .75rem; }
  .map-action-button { min-height: 2.55rem; padding: .55rem .7rem; }
  .location-message { right: .75rem; bottom: calc(10.7rem + env(safe-area-inset-bottom)); left: .75rem; max-width: none; }
  .map-footer { display: none; }
  .maplibregl-ctrl-bottom-right { bottom: calc(4.6rem + env(safe-area-inset-bottom)); }
}

@media (max-height: 650px) and (min-width: 761px) { .layer-button { min-height: 2.65rem; } .status-card { bottom: 2.9rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }


/* V0.6 — pictogrammes BERadar homogènes */
.layer-button .layer-icon {
  color: #d8dee1;
}

.layer-button:hover .layer-icon {
  color: #ffffff;
}

.layer-button.is-active .layer-icon {
  color: #111416;
}


/* V0.7 — localisation alignée au-dessus des phénomènes */
.layer-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.9rem;
  gap: 0.45rem;
  width: 100%;
  margin-bottom: 0.55rem;
}

.locate-button,
.reset-button {
  min-height: 2.9rem;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  cursor: pointer;
}

.locate-button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.55rem 0.68rem;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  white-space: nowrap;
}

.locate-button:hover,
.reset-button:hover {
  border-color: var(--accent);
  background: var(--panel-hover);
}

.locate-button.is-located {
  border-color: rgba(215, 230, 90, 0.68);
  background: rgba(215, 230, 90, 0.11);
}

.locate-icon {
  display: grid;
  place-items: center;
  flex: 0 0 1.2rem;
  width: 1.2rem;
  height: 1.2rem;
}

.locate-icon svg {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reset-button {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.reset-button:hover {
  color: var(--text);
}

.beradar-user-pin {
  width: 2.15rem;
  height: 2.65rem;
  color: var(--accent);
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.58));
}

.beradar-user-pin svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: #111416;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 760px) {
  .layer-tools {
    position: absolute;
    right: 0.7rem;
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
    left: 0.7rem;
    width: auto;
    margin: 0;
  }

  .locate-button,
  .reset-button {
    background: rgba(17, 20, 22, 0.95);
  }

  .clear-button {
    bottom: calc(8.2rem + env(safe-area-inset-bottom));
  }

  .status-card {
    bottom: calc(11.1rem + env(safe-area-inset-bottom));
  }

  .location-message {
    bottom: calc(11.1rem + env(safe-area-inset-bottom));
  }
}
