html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;          /* definite height */
}

/* Viewport container */
#appContainer {
  position: fixed;
  inset: 0;              /* top/right/bottom/left = 0 */
  width: 100%;
  height: 100%;
}

/* --- Base (portrait / narrow): toolbar on top --- */
#toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 64px;          /* choose your toolbar height */
  background: rgba(255, 255, 255, 0.95);
  padding: 0.625rem;
  gap: 0.625rem;
  z-index: 1000;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  white-space: nowrap;
  box-sizing: border-box;
  border-bottom: 1px solid #ccc;
}

.btn-group .btn-clear {
  flex: 0 0 2.25rem;   /* no grow, no shrink, fixed basis */
  width: 2.25rem;      /* optional but fine */
  padding-left: 0;
  padding-right: 0;
}


#map {
  position: absolute;
  top: 56px; left: 0; right: 0; bottom: 0;
  background-color: #ffffff;
}

/* Force external lib children to fill map */
#map, #map > * {
  width: 100% !important;
  height: 100% !important;
}

/* --- Wide screens: toolbar on left (vertical) --- */
@media (min-width: 768px) {
  #toolbar {
    top: 0; bottom: 0; left: 0; right: auto;
    width: 170px;        /* choose your toolbar width */
    height: auto;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: normal;
    border-bottom: 0;
    border-right: 1px solid #ccc;
  }

  #map {
    top: 0; left: 170px; right: 0; bottom: 0;
  }
}

/* ---- Keep your existing control styling ---- */
#toolbar .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  min-width: max-content;
}

#toolbar .btn-group-sm {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
}

#threshold {
  width: 5ch;
  min-width: 5ch;
}

/* Remove spinner arrows in number input (Chrome, Edge, Safari) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove spinner arrows in Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

.tooltip-measure {
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 0.25rem;
  color: white;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
  font-size: 0.75rem;
  pointer-events: none;
}
