body {
  background: #f0f0f0;
}

#tool_wrapper{
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-around;
  align-items: stretch;
  width: 100%;
}

#control_panel {
  width: 20%;
}

#draw_panel_wrapper {
  border: 1px solid lightgray;
  width: 80%;
  height: 90vh;
  position: relative;
  background: white;
}

#draw_panel_wrapper canvas{
  pointer-events: none;
}
canvas#draw_panel {
  pointer-events: auto;
  touch-action: none;
}

#tool_wrapper canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

button, input[type=file] {
  all: unset;
}

.btn {
  display: inline-block;
  padding: 0.3em 1.2em;
  margin: 0 0.3em 0.3em 0;
  border-radius: 2em;
  box-sizing: border-box;
  text-decoration: none;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  color: #FFFFFF;
  background-color: #4EB5F1;
  text-align: center;
  transition: all 0.2s;
}
.btn:hover {
  background-color: #4095C6;
  cursor: pointer;
}
@media all and (max-width: 30em) {
  .btn {
    display: block;
    margin: 0.2em auto;
  }
}
.btn-danger {
  background-color: #FF4444;
}
.btn-danger:hover {
  background-color: #FF9999;
}

#control_panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
}
.control_panel_section {
  margin: 0.5em 0;
  border-bottom: 1px dashed lightgrey;
  font-family: sans-serif;
}

.control_panel_section:last-of-type {
  border-bottom: none;
}

.control_panel_section h3 {
  margin: 0.25em;
  text-align: center;
}

.control_option {
  margin: 1em;
  display: flex;
  flex-direction: column;
}
#tools .control_option {
  flex-direction: row;
}

#tools > .control_option {
  margin-bottom: 0;
}

.control_option select, .control_option input, .control_option button {
  width: 100%;
  line-height: 1.5;
  font-size: 110%;
  margin: 0.2em auto;
}
.btn.tool-btn {
  appearance: none;
  background-color: #FAFBFC;
  border: 1px solid rgba(27, 31, 35, 0.15);
  border-radius: 6px;
  box-shadow: rgb(27 31 35 / 4%) 0 1px 0, rgb(255 255 255 / 25%) 0 1px 0 inset;
  box-sizing: border-box;
  color: #24292E;
  cursor: pointer;
  display: inline-block;
  font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 2rem;
  font-weight: 500;
  list-style: none;
  position: relative;
  transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  vertical-align: middle;
  white-space: nowrap;
  word-wrap: break-word;
  max-width: 1.5em;
  padding: 0;
}
.btn.tool-btn:hover {
  background-color: #F3F4F6;
  text-decoration: none;
  transition-duration: 0.1s;
}
.btn.tool-btn[data-active="true"] {
  border: 2px solid black;
}

.btn.tool-btn.with-context-menu[data-active="true"] {
  background-color: lightgrey;
  border-bottom: 2px solid lightgrey;
  border-radius: 6px 6px 0 0;
  margin-bottom: 0;
}
.btn.tool-btn .hand_pointer {
  transform: rotate(-0.125turn);
}
.btn.tool-btn .erase_rect {
  transform: rotate(-0.125turn);
}
#text-controls, #pencil-controls, #shape-controls {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  border: 2px solid black;
  background-color: lightgrey;
  padding: 1em;
}

#context-menu {
  margin-top: -2px;
  min-height: 90px;
}

#context-menu .control_option {
  margin-top: 0;
}

.text-wrapper .destroy {
  position: absolute;
  top: -0.4rem;
  left: -0.3rem;
  font-size: small;
  border-radius: 50%;
  background: white;
  border: 1px solid lightgrey;
  font-family: 'Roboto', sans-serif;
  z-index: 1;
}

.text-wrapper .destroy:hover {
  cursor: pointer;
}

.text-wrapper [contenteditable] {
  display: inline-block;
  width: auto;
  white-space: nowrap;
  font-size: 26px;
  padding: 0.25rem;
  font-family: sans-serif;
  margin: 0;
  transition: padding .3s ease-in-out;
  background: white;
  border: 1px solid lightgrey;
}

[contenteditable]:hover,
[contenteditable]:focus {
  padding: .25rem;
}

[contenteditable]:hover {
  background: #fafafa;
  outline: 2px solid #eee;
}

[contenteditable]:focus {
  background: #efefef;
  outline: 2px solid #eee;
}

/* Styles to support slide out menu on mobile */
.menu-checkbox, .menu-toggle {
  display: none;
}

@media only screen and (max-width: 600px) {
  body {
    margin: 0;
    padding: 0;
  }

  #draw_panel_wrapper {
    width: 100%;
    height: 100vh;
  }

  #control_panel {
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    width: 300px;
    height: 100%;
    transform: translate3d(-300px, 0, 0);
    transition: transform 0.35s;
    z-index: 9999;
    background: #f0f0f0;
  }

  #control_panel .menu-toggle {
    position: absolute;
    right: -60px;
    width: 60px;
    height: 60px;
    font-size: 50px;
    display: block;
    text-align: center;
    background: #f0f0f0;
  }

  .menu-checkbox {
    display: none;
  }

  .menu-checkbox:checked + #control_panel {
    transform: translate3d(0, 0, 0);
  }
}
