html, body, #cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: Roboto, Arial, sans-serif;
  background: #000;
}

/* ---------- sidebar ---------- */

#sidebar {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 300px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  background: rgba(20, 24, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #e8eaed;
  padding: 10px;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  z-index: 10;
}

#searchWrap { position: relative; }

#searchInput {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #e8eaed;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
}

#searchInput:focus { border-color: #8ab4f8; }

#searchResults {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: #1b2130;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 30;
}

#searchResults li {
  padding: 8px 12px;
  cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#searchResults li:first-child { border-top: none; }
#searchResults li:hover { background: rgba(138, 180, 248, 0.15); }
#searchResults li div:first-child { font-size: 13px; }
#searchResults li div:last-child { font-size: 11px; color: #9aa0a6; margin-top: 2px; }

/* ---------- toolbar ---------- */

#toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

#toolbar button,
#btnExport,
.fileBtn,
#popupStreetView,
#popupDelete,
#streetViewClose {
  background: rgba(255, 255, 255, 0.1);
  color: #e8eaed;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

#toolbar button:hover,
#btnExport:hover,
.fileBtn:hover,
#popupStreetView:hover,
#popupDelete:hover { background: rgba(255, 255, 255, 0.2); }

#toolbar button.active {
  background: #fbbc04;
  color: #202124;
  border-color: #fbbc04;
}

/* ---------- panels ---------- */

details { margin-bottom: 10px; }

summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9aa0a6;
}

details label {
  display: block;
  font-size: 13px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
}

details label:hover { background: rgba(255, 255, 255, 0.06); }

details input[type="checkbox"] { margin-right: 8px; accent-color: #8ab4f8; }

/* ---------- placemark list ---------- */

#pinList { list-style: none; margin: 0; padding: 0; }

#pinList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
}

#pinList li:hover { background: rgba(255, 255, 255, 0.06); }

#pinList li span { cursor: pointer; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#pinList li button {
  background: none;
  border: none;
  color: #9aa0a6;
  cursor: pointer;
  font-size: 13px;
}

#pinList li button:hover { color: #f28b82; }

#placesEmpty { font-size: 12px; color: #9aa0a6; padding: 6px; }

#fileRow { display: flex; gap: 6px; margin-top: 4px; }

/* ---------- pin popup ---------- */

#pinPopup {
  position: absolute;
  left: 0;
  top: 0;
  margin-left: -90px;
  width: 180px;
  margin-top: -66px;
  background: rgba(27, 33, 48, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px;
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

#popupName {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: #e8eaed;
  padding: 5px 24px 5px 8px;
  font-size: 13px;
}

#popupClose {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #9aa0a6;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

#popupClose:hover { color: #f28b82; }

#popupCoords { font-size: 11px; color: #9aa0a6; margin: 6px 0; }

#popupStreetView, #popupDelete { margin-right: 4px; }

#popupDelete:hover { background: rgba(242, 139, 130, 0.3); }

/* ---------- street view ---------- */

#pegman {
  position: absolute;
  bottom: 16px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff9800;
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 30;
}

#pegman:hover { background: #f57c00; }

#pegman.picking {
  background: #fff;
  color: #ff9800;
  box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.45);
}

#streetViewPanel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 420px;
  max-width: calc(100% - 24px);
  background: rgba(20, 24, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  z-index: 40;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

#streetViewHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

#streetViewFrame {
  width: 100%;
  height: 320px;
  border: none;
  display: block;
}

#streetViewLink {
  display: block;
  padding: 8px 12px;
  font-size: 12px;
  color: #8ab4f8;
  text-decoration: none;
}

#streetViewLink:hover { text-decoration: underline; }

/* ---------- measure bar ---------- */

#measureBar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  align-items: center;
  background: rgba(20, 24, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 8px 18px;
  z-index: 10;
  font-size: 13px;
  color: #e8eaed;
}

#measureTotal { color: #fbbc04; font-weight: 700; white-space: nowrap; }

#tokenWarning {
  margin-top: 10px;
  padding: 10px;
  background: rgba(242, 139, 130, 0.15);
  border: 1px solid #f28b82;
  border-radius: 8px;
  font-size: 12px;
  color: #f28b82;
}

#credits {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  z-index: 5;
  pointer-events: none;
}

/* ---------- mobile ---------- */

@media (max-width: 768px) {
  #sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 45%;
    border-radius: 12px 12px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  #toolbar button { padding: 9px 12px; }

  #pinPopup { width: 150px; margin-left: -75px; }

  #streetViewPanel {
    top: auto;
    bottom: 46%;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
  }

  #streetViewFrame { height: 45vh; }

  #pegman { bottom: calc(45% + 16px); }
}
