:root {
  /* Material — light glass, Apple Maps / Linear grade */
  --glass:        rgba(255, 255, 255, 0.72);
  --glass-2:      rgba(255, 255, 255, 0.55);
  --glass-solid:  rgba(252, 252, 254, 0.92);
  --stroke:       rgba(0, 0, 0, 0.08);
  --stroke-2:     rgba(0, 0, 0, 0.05);
  --hover:        rgba(0, 0, 0, 0.04);

  --ink:          #1d1d1f;
  --ink-2:        #6e6e73;
  --ink-3:        #a1a1a6;

  --accent:       #e8590c;       /* braise */
  --accent-2:     #d6336c;
  --accent-soft:  rgba(232, 89, 12, 0.10);
  --fire:         #ff3b30;

  --radius-lg:    18px;
  --radius-md:    12px;
  --radius-sm:    8px;
  --shadow:       0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 34px rgba(17, 24, 39, 0.14);
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(17, 24, 39, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #e9eaec;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Glass material */
.glass {
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

#map {
  position: absolute;
  inset: 0;
  height: 100vh;
  width: 100vw;
  z-index: 0;
}
.leaflet-container { background: #e9eaec; font-family: inherit; }

/* ---------- Top bar (floating) ---------- */
.topbar {
  position: absolute;
  z-index: 1000;
  top: 14px; left: 14px; right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 16px 10px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  background: var(--accent-soft);
}
.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px; color: var(--ink-2); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.stats { display: flex; align-items: center; gap: 14px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.05; }
.stat-num {
  font-size: 19px; font-weight: 650; letter-spacing: -0.02em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-num.loading, .stat-num.err { color: var(--ink-3); }
.stat-lbl {
  font-size: 10px; color: var(--ink-3); margin-top: 3px;
  font-weight: 500;
}
.divider { width: 1px; height: 28px; background: var(--stroke); }

/* ---------- Side panel (floating) ---------- */
.panel {
  position: absolute;
  z-index: 900;
  top: 84px; left: 14px; bottom: 14px;
  width: 340px;
  padding: 6px 16px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,.14); border-radius: 8px; }

.block { padding: 14px 0; border-bottom: 1px solid var(--stroke-2); }
.block:last-of-type { border-bottom: none; }

.panel h2 {
  margin: 0 0 6px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
}
.panel h3 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.help { margin: 0 0 11px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.help strong { color: var(--ink); font-weight: 600; }

.equiv {
  background: var(--accent-soft);
  border: 1px solid rgba(232, 89, 12, 0.18);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  font-size: 12.5px; line-height: 1.65; color: var(--ink);
}
.equiv b { color: var(--accent); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- Demo banner ---------- */
.banner {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12px; line-height: 1.45; color: #7a3a06;
  background: rgba(255, 200, 120, 0.32);
  border: 1px solid rgba(232, 89, 12, 0.22);
}
.banner strong { color: #5a2a04; }
.hidden { display: none; }

/* ---------- FIRMS toggle row ---------- */
.fires-row { display: flex; align-items: center; gap: 12px; }
.fires-text { display: flex; flex-direction: column; line-height: 1.3; }
.fires-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.fires-meta { font-size: 11.5px; color: var(--ink-2); }
.fires-meta b { color: var(--fire); font-variant-numeric: tabular-nums; }
#fires-block { opacity: .5; transition: opacity .2s; }
#fires-block.on { opacity: 1; }

/* iOS switch */
.switch { position: relative; display: inline-block; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.switch .track {
  width: 38px; height: 22px; border-radius: 22px; background: rgba(120,120,128,.22);
  transition: background .2s ease; display: block; position: relative;
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s ease;
}
.switch input:checked + .track { background: var(--fire); }
.switch input:checked + .track .thumb { transform: translateX(16px); }

/* ---------- Landmark buttons ---------- */
.btns { display: flex; flex-direction: column; gap: 6px; }
.btns button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  background: var(--glass-2);
  border: 1px solid var(--stroke-2);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: inherit; font-size: 13px; color: var(--ink);
  transition: background .15s ease, border-color .15s ease, transform .04s ease;
}
.btns button:hover { background: #fff; border-color: var(--stroke); }
.btns button:active { transform: scale(0.992); }
.btns .lm-name { font-weight: 500; }
.btns .lm-area { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.hint { font-size: 11.5px; color: var(--ink-2); margin: 9px 2px 0; min-height: 14px; line-height: 1.4; }
.hint b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- Actions ---------- */
.actions { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ink); color: #fff;
  border: none; border-radius: var(--radius-md);
  padding: 9px 10px; font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: opacity .15s ease, transform .04s ease;
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(0.985); }
.btn-ghost { background: var(--glass-2); color: var(--ink); border: 1px solid var(--stroke-2); }
.btn-ghost:hover { background: #fff; opacity: 1; }
.btn svg { flex: none; }

.updated { font-size: 11px; color: var(--ink-3); text-align: center; margin: 10px 0 2px; }

/* ---------- Circle label (above circle) ---------- */
.circle-label {
  background: var(--glass-solid) !important;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(232, 89, 12, 0.28) !important;
  color: var(--ink) !important;
  padding: 7px 11px !important;
  border-radius: 11px !important;
  font-size: 12px !important; font-weight: 500 !important;
  box-shadow: var(--shadow-sm) !important;
  white-space: nowrap;
}
.circle-label::before { display: none !important; } /* no pointer arrow */
.circle-label .big { color: var(--accent); font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.circle-label .drag { display: block; color: var(--ink-3); font-weight: 400; font-size: 10px; margin-top: 2px; }

/* Circle cursor */
.burn-circle, .burn-handle { cursor: grab; }
.dragging-circle .leaflet-container,
.dragging-circle .burn-circle,
.dragging-circle .burn-handle { cursor: grabbing !important; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.burn-handle { animation: pulse 1.8s ease-in-out infinite; }

.leaflet-tooltip.circle-label.source-attribution { display: none; }

/* ---------- Leaflet controls tweaks ---------- */
.leaflet-control-attribution {
  background: rgba(255,255,255,.7) !important;
  backdrop-filter: blur(8px);
  border-radius: 8px 0 0 0;
  font-size: 10px !important; color: var(--ink-2) !important;
}
.leaflet-bar a { border-radius: 0 !important; }

/* ---------- Responsive ---------- */
.sheet-grabber { display: none; }

@media (max-width: 720px) {
  /* Top bar compact, une seule ligne */
  .topbar { flex-wrap: nowrap; padding: 7px 11px; gap: 8px; }
  .brand-text p { display: none; }
  .brand-text h1 { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .stats { gap: 11px; }
  .stat-num { font-size: 15px; }
  .stat-lbl { font-size: 9px; }
  .divider { height: 24px; }

  /* Bottom sheet repliable */
  .sheet-grabber {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 24px; padding: 0; margin: 0 0 -2px;
    background: transparent; border: 0; cursor: pointer;
    position: sticky; top: 0; z-index: 2;
  }
  .grabber-pill { width: 40px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.16); }
  .sheet-grabber:active .grabber-pill { background: rgba(0,0,0,.28); }

  .panel {
    top: auto; bottom: 8px; left: 8px; right: 8px; width: auto;
    max-height: 132px;                /* replié : on voit la carte */
    overflow: hidden;
    padding-top: 4px;
    transition: max-height .34s cubic-bezier(.32, .72, 0, 1);
  }
  .panel.expanded { max-height: 78vh; overflow-y: auto; }
}

@media (min-width: 721px) { .panel { transition: none; } }
