:root{
  --bg: #070b14;
  --panel: rgba(16, 22, 40, .92);
  --panelSolid: #0f1730;
  --text: #eaf2ff;
  --muted: rgba(234,242,255,.70);
  --border: rgba(255,255,255,.10);
  --shadow: rgba(0,0,0,.45);
  --btn: #1b2a55;
  --btn2: rgba(255,255,255,.06);
  --focus: rgba(120,170,255,.35);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden; /* prevents accidental page scroll under map */
}

/* Top bar */
.topbar{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent);
}

.brand .title{ font-size: 15px; font-weight: 650; letter-spacing: .2px; }
.brand .subtitle{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.toolbar{ display:flex; gap: 10px; align-items:center; }

.btn{
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.btn:hover{ filter: brightness(1.10); }
.btn.ghost{ background: var(--btn2); }

.layout{
  height: calc(100% - 64px);
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 0;
}

/* Map area */
.mapWrap{
  position: relative;
  min-width: 0;
  min-height: 0;
}
.map{
  width: 100%;
  height: 100%;
}

/* Panel (desktop sidebar) */
.panel{
  min-width: 0;
  border-left: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(6px);
  overflow: auto;
}
.panelInner{
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px var(--shadow);
  padding: 12px;
}
.cardTitle{ font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; line-height: 1.45; }

.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  width: 100%;
}
.fieldRow{
  display:flex;
  gap: 10px;
  align-items:flex-end;
}
select, input[type="number"], input[type="range"]{
  width: 100%;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10,14,28,.85);
  color: var(--text);
  outline: none;
}
select:focus, input:focus{ box-shadow: 0 0 0 4px var(--focus); }

.rangeMeta{
  display:flex;
  justify-content:space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.check{
  display:flex;
  gap: 8px;
  align-items:center;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
}

.legend{ display:flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.chip{
  display:flex;
  gap: 10px;
  align-items:center;
  font-size: 12px;
  color: var(--muted);
}
.swatch{
  width: 22px; height: 12px; border-radius: 999px;
  background: var(--c);
  border: 1px solid rgba(255,255,255,.12);
}
.dot{
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--c);
  box-shadow: 0 0 0 3px rgba(104,195,255,.12);
}

.list{ display:flex; flex-direction:column; gap: 10px; }
.item{
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.item .title{
  font-size: 13px;
  font-weight: 600;
}
.item .meta{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* Leaflet theming tweaks (dark-mode polish) */
.leaflet-control-attribution{
  background: rgba(0,0,0,.35) !important;
  color: rgba(255,255,255,.65) !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}
.leaflet-control-attribution a{ color: rgba(170,210,255,.85) !important; }

/* Mobile: panel becomes bottom sheet so it does NOT overlay the map */
@media (max-width: 900px){
  body{ overflow: hidden; }
  .layout{
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .panel{
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 44vh;
  }
}

/* Panel collapsed (mobile + desktop toggle) */
.panel.collapsed{
  display: none;
}
