html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #fff;
  overflow: hidden;
}

canvas {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#main {
	position: relative;
	display: flex;
	align-items: stretch;
	height: 100%;
}

#area {
	position: relative;
	height: 100%;
	flex: 1;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

/* Tool palette: a scrolling side column in landscape (changed for this site:
   originally a fixed-width panel that could push the map off-screen) */
#tools {
	display: flex;
	flex-direction: row;
	align-content: flex-start;
	justify-content: center;
	flex-wrap: wrap;
	overflow-x: hidden;
	overflow-y: auto;
	width: 190px;
	flex: none;
	height: 100%;
	background: #f4f4f4;
}

@media only screen and (min-width: 1300px) {
	#tools {
		width: 290px;
	}
}

#tools > div {
	display: block;
	background-image: url('../textures/01_130x66_130x230.png');
	background-repeat: no-repeat;
	background-size: auto;
	width: 130px;
	height: 230px;
	border: 2px dashed transparent;
	box-sizing: border-box;
	zoom: 0.6;
	cursor: pointer;
}

#tools > div.selected {
	border-color: #b05355;
}

/* Portrait screens: palette becomes a horizontal strip above the map */
@media only screen and (max-aspect-ratio: 1/1) {
	#main {
		flex-direction: column;
	}

	#tools {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		overflow-y: hidden;
		width: 100%;
		height: 150px;
	}

	#tools > div {
		flex: none;
	}

	#area {
		width: 100%;
		height: auto;
	}
}
