*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  background: #1a1a2e;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ── Map ── */
#map {
  position: absolute;
  inset: 0;
}

/* ── Shared panel base ── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1d3557;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  border-radius: 8px 8px 0 0;
  user-select: none;
}

/* ── Layer panel (top-left) ── */
#layer-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 230px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  z-index: 10;
  overflow: hidden;
}

#layer-panel .panel-header {
  border-radius: 8px 8px 0 0;
}

#layer-toggles {
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  color: #333;
  transition: background 0.15s;
  line-height: 1.3;
}

.layer-row:hover { background: #f0f4ff; }

.layer-row input[type="checkbox"] {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #1d3557;
}

/* ── Side panel (right) ── */
#side-panel {
  position: absolute;
  top: 0;
  right: -360px;
  width: 360px;
  height: 100vh;
  background: #fff;
  box-shadow: -3px 0 15px rgba(0,0,0,0.25);
  z-index: 20;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}

#side-panel.open { right: 0; }

#side-panel .panel-header {
  flex-shrink: 0;
  border-radius: 0;
  font-size: 14px;
}

#panel-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#close-panel {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}

#close-panel:hover { opacity: 1; }

#panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.hint {
  padding: 20px 16px;
  color: #888;
  text-align: center;
  font-size: 13px;
}

/* ── Section (details/summary) ── */
#panel-content details {
  border-bottom: 1px solid #eee;
}

#panel-content details:last-child { border-bottom: none; }

#panel-content summary {
  padding: 10px 14px;
  font-weight: 600;
  color: #1d3557;
  cursor: pointer;
  background: #f4f7fb;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#panel-content summary::before {
  content: '▶';
  font-size: 9px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

#panel-content details[open] > summary::before { transform: rotate(90deg); }

#panel-content summary::-webkit-details-marker { display: none; }

.section-body { padding: 6px 0; }

.row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px;
  padding: 5px 14px;
  align-items: start;
  border-bottom: 1px solid #f5f5f5;
}

.row:last-child { border-bottom: none; }

.row-label {
  color: #666;
  font-size: 11px;
  padding-top: 1px;
  line-height: 1.4;
}

.row-value {
  color: #222;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 46, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  color: #fff;
  font-size: 15px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #a8dadc;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── MapLibre attribution tweak ── */
.maplibregl-ctrl-attrib {
  font-size: 10px !important;
}
