html {
  touch-action: manipulation;
}

body {
  margin: 0;
  background-color: #CCC;
  user-select: none;
  -webkit-text-size-adjust: none;
}

body::after {
  position:absolute; width:0; height:0; overflow:hidden; z-index:-1;
  content:url(play.svg);
}

body.noscroll {
  height: 100%;
  overflow: hidden;
}

/* Override p5.js sizing to fit viewport. */
#animation, #animation-dummy  {
 width: calc(100% - 8px) !important;
 height: auto !important;
 cursor: crosshair;
 background: url(checkers.svg);
 background-size: 16px;
 border: 4px inset;
}

#timeline {
  margin-left: 4px;
  max-width: 512px;
  width: calc(100% - 8px) !important;
  height: auto !important;
}

input, button {
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

input[type="button"], button {
  -webkit-appearance: none;
}

#color-selector {
  width: 100%;
  height: 100%;
  background-color: black;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
}

#colors {
  font-size: 0;
  height: 100%;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

#colors button {
  width: 12.5%;
  padding: 12.5% 0 0 0;
  border: 0;
  /*outline: 0;*/
  cursor: pointer;
  margin: 0;
}

#colors button:active {
  filter: invert(1);
}

#color-selector.active {
  display: block;
}

#background-color-selector.active {
  display: block;
}

#ui {
  padding: 21px 10px 10px 10px;
  box-sizing: border-box;
  margin: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
}

#column {
  max-width: 400px;
  /*background-color: pink;*/
}

#macro-ui {
  margin: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

#etc {
  font-family: monospace;
  font-size: 12px;
  color: #666666;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 520px;
  margin: auto;
}

footer {
  padding: 10px;
}

#etc a, #etc a:visited {
  color: #666666;
}

.current-resolution {
  color: #111 !important;
}

#fine-print, #fine-print a, #fine-print a:visited {
  /*color: #AAA;*/
}

hr {
  margin-top: 10px;
  margin-bottom: 0px;
  width: 100%;
  border-left: none;
  border-right: none;
}

#sketch-container {
  position: relative;
  max-width: 520px;
  max-height: 680px; /*662*/
  display: flex;
  flex-direction: column;
}

#buttons {
  height: 50px;
  width: 100%;
  padding-top: 4px;
  margin: 2px auto 0 auto;
  display: flex;
  vertical-align: middle;
}

#playback-buttons {
  margin-left: 4px;
  height: 50px;
}

#playback-buttons input {
  cursor: pointer;
}

.colorButton {
  width: 24px;
  height: 24px;
  color: white;
  padding: 2px 2px 2px 2px;
  display: inline-block;
  border-radius: 50%;
  border: 1px solid #FFFFFF;
  cursor: pointer;
}

.play {
  background: url("pause.svg") no-repeat top left;
  background-size: contain;
  width: 50px;
  height: 50px;
  display: inline-block;
  border-radius: 50%;
  border: 1px inset;
  vertical-align: middle;
  line-height: 50px;
}

.back-next {
  background: url("next.svg") no-repeat top left;
  background-size: contain;
  background-color: #333333;
  width: 32px;
  height: 32px;
  color: #FFFFFF;
  padding: 3px 2px 2px 2px;
  display: inline-block;
  border: 1px inset;
  font-size: 1.25em;
  vertical-align: middle;
}

#buttons input {
  outline: 0;
}

#buttons input:active {
  background-color: #555;
}

#keyboard-shortcuts {
  padding: 0;
  list-style-type: none;
}

#keyboard-shortcuts li {
  line-height: 1.75em;
  display: inline-block;
  padding-bottom: 0.5em;
}

.keyboard-shortcut {
  min-width: 1em;
  height: 1.5em;
  display: inline-block;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  background-color: #eee;
  border: 0.25em outset #c3c3c3;
  padding: 0 0.2em;
  vertical-align: middle;
  text-align: center;
  color: grey;
}

.mirror {
  display: inline-block;
  transform: scaleX(-1);
}

#select-buttons {
  margin-left: auto;
  height: 50px;
  display: flex;
  margin-right: 4px;
}

#select-buttons input {
  margin: auto;
  height: 32px;
  margin-left: 4px;
  cursor: pointer;
}

.selector {
  display: inline-block;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  letter-spacing: 0.5px;
  font-size: 0.7em;
  background-color: #333333;
  color: #FFFFFF;
  height: 32px;
  border: 1px inset;
  box-sizing: border-box;
  padding: 0 8px 0 4px;
  margin: auto;
}

.clear-frames {
  display: inline-block;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  letter-spacing: 0.5px;
  font-size: 0.7em;
  background-color: #333333;
  color: #FFFFFF;
  vertical-align: middle;
  border: 1px inset;
  padding: 2px 10px 2px 10px;
}

.selector input, .selector .selector-label, .selector label  {
  vertical-align: middle;
}

select option {
  font-family: monospace;
}

.sm-title {
  font-weight: normal;
  font-size: 1.3em;
  margin: 0;
  padding-left: 0;
  display: inline-block;
}

.sketch-title {
  font-family: "Times New Roman", Times, serif;
}

.machine-title {
  font-family: monospace;
  font-size: 1.25em;
}

#controls {
  margin-top: 1.5em;
  font-family: "Times New Roman", Times, serif;
  color: #333;
}

#controls h2 {
  font-size: 1em;
  font-weight: normal;
  color: #777;
  margin: 0 0 6px 0;
}

.brush, .setting {
  background-color: #BBB;
  display: inline-block;
  /*border-radius: 4px;*/
  margin-bottom: 5px;
  border: 1px inset;
  vertical-align: middle;
  height: 30px; /*40*/
  line-height: 32px; /*40*/
  padding-left: 6px;
  padding-right: 11px;
  padding-bottom: 2px;
}

.brush input, .brush select, .setting input, .setting .setting-label, .setting label  {
  vertical-align: middle;
}

#engorge-label, #onion-label, #background-label, #select-label {
  cursor: pointer;
}

#select-label {
  padding-left: 4px;
}

#background-label {
  padding-right: 4px;
}

#tools {
  /*margin-top: 0.75em;*/
  margin-bottom: 0.75em;
}

#tool-modifiers {
  margin-bottom: 0.75em;
}

#options {
  margin-bottom: 0.75em;
}

#playback-options label {
  padding: 3px;
  color: #666;
  display: inline-block;
  cursor: pointer;
  font-size: 1.25em;
  line-height: 18px;
  height: 20px;
  width: 20px;
  background: #999;
}


#playback-options .setting-label {
  padding-right: 4px;
}

#playback-options {
  padding-right: 6px;
}

#playback-options input[type="radio"] {
  display: none;
}

#playback-options input[type="radio"]:checked+label {
  color: #222;
  background: #eee;
}

#export-options {
  background-color: #BBB;
  padding: 8px;
  display: inline-block;
  border: 1px inset;
}

#export-overlay {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  visibility: hidden;
  display: flex;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

#export-overlay.active,
#exported-gif-img.active,
#export-controls.active {
  visibility: visible;
}

#exported-gif {
  margin: auto;
}

#exported-gif-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 64px;
  height: 64px;
  margin-top: -32px;
  margin-left: -32px;
  background: white;
  border-radius: 50%;
  animation: spinner 1s infinite;
  pointer-events: none;
  transition: 0.5s border-radius;
  display: flex;
}

#export-progress {
  font-family: monospace;
  font-size: 1.5em;
  margin: auto;
}

#exported-gif-spinner.hidden {
  display: none;
}

@keyframes spinner {
  0% {
      transform: scale(1);
  }
  50% {
    transform: scale(1.5);
  }
  100% {
    transform: scale(1);
  }
}

#exported-gif-img {
  margin: 8px;
  max-width: calc(100% - 24px);
  width: 512px;
  border: 4px outset;
  visibility: hidden;
  cursor: context-menu;
  image-rendering: pixelated;
  background: url(checkers.svg);
  background-size: 16px;
}

#export-controls {
  display: flex;
  visibility: hidden;
  margin: 0px 8px 8px 8px;
}

#export-upload-to-giphy {
  margin-left: auto;
}

#export-upload-to-giphy.hidden {
  visibility: hidden;
}

#export-upload-to-giphy, #export-close {
  display: block;
  font-size: 1.25em;
  color: black;
  font-weight: bold;
  background-color: #ddd;
  padding: 6px 8px 4px 8px;
  text-transform: uppercase;
  border: 4px outset;
  cursor: pointer;
  outline: none;
}

#export-upload-to-giphy:active, #export-close:active {
  border: 4px inset;
  padding: 7px 7px 3px 9px;
  background-color: #bbb;
}

#giphy-upload-overlay {
  visibility: hidden;
  z-index: 2;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
}

#giphy-upload-overlay.active {
  visibility: visible;
}

#giphy-logo {
  width: 100px;
  vertical-align: top;
  padding-left: 4px;
  padding-top: 1px;
}

#export-button {
  display: block;
  width: 77px;
  height: 77px;
  font-size: 1.5em;
  font-weight: bold;
  background-color: #dcdcdc;
  outline: none;
  color: #555;
  cursor: pointer;
  border: 0;
  border-radius: 0;
  font-family: "Times New Roman", Times, serif;
  padding: 0;
}

#export-button:active, #export-button.active {
  background-color: #aaa;
  color: #888;
}

#speed-slider {
}

#next {
  visibility: hidden;
}

#back {
  visibility: hidden;
}

#giphy-arts-logo {
  width: 100px;
  filter: grayscale(1);
  transition: 0.25s filter;
}

#giphy-arts-logo:hover, #giphy-arts-logo:active {
  filter: none;
}

@media all and (min-width: 940px) {
  body {
  }

  #ui {
    flex-direction: row;
  }

  #etc {
    flex-direction: column;
    padding: 10px;
    margin-left: 0;
  }

  #controls {
    padding-top: 0px;
    padding-left: 40px; /*16*/
    margin-top: 0;
  }

  h1 {
    padding-left: 10px;
  }

  #colors button {
    width: 6.25%;
    padding: 6.25% 0 0 0;
    border: 0;
    /*outline: 0;*/
    cursor: pointer;
    margin: 0;
  }
}

.dev * {
  background-color: rgba(0, 0, 255, 0.1);
}