
/****************************************/
/* common styles used for v1 through v4 */
/****************************************/

body          { font-family: Arial, Helvetica, sans-serif; margin: 0; }
#stats        { border: 2px solid black; }
#controls     { width: 28em; float: left; padding: 1em; font-size: 0.7em; }
#controls th  { text-align: right; vertical-align: middle; }
/* #instructions { clear: left; float: left; width: 17em; padding: 1em; border: 1px solid black; box-shadow: 0 0 5px black; } */
#racer        { position: relative; z-index: 0; width: 640px; height: 480px; margin-left: 20em; border: 2px solid black; }
#canvas       { position: absolute; z-index: 0; width: 640px; height: 480px; z-index: 0; background-color: #001c24; }
#mute         { background-position:   0px 0px; width: 32px; height: 32px; background: url(images/mute.png); display: inline-block; cursor: pointer; position: absolute; margin-left: 20em; }
#mute.on      { background-position: -32px 0px; }

/**************************************************/
/* rudimentary heads up display (only used in v4) */
/**************************************************/

#hud                   { position: absolute; z-index: 1; width: 640px; padding: 5px 0; font-family: Verdana, Geneva, sans-serif; font-size: 0.8em; background-color: rgba(105,59,146,0.4); color: black; border-bottom: 2px solid black; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; }
#hud .hud              { background-color: rgba(255,255,255,0.6); padding: 5px; border: 1px solid black; margin: 0 5px; transition-property: background-color; transition-duration: 2s; -webkit-transition-property: background-color; -webkit-transition-duration: 2s; }
#hud #speed            { float: right; }
#hud #current_lap_time { float: left;  }
#hud #last_lap_time    { float: left; display: none;  }
#hud #fast_lap_time    { display: block; width: 12em;  margin: 0 auto; text-align: center; transition-property: background-color; transition-duration: 2s; -webkit-transition-property: background-color; -webkit-transition-duration: 2s; }
#hud .value            { color: black; font-weight: bold; }
#hud .fastest          { background-color: rgba(255,215,0,0.5); }

/****************/
/* custom stuff */
/****************/
body {
  touch-action: pan-y;
}

#controls {
  display: none;
}

#racer {
  margin-left: 0;
}

#mute {
  display: block;
  position: static;
  margin-left: auto;
  margin-right: auto;
}

#interface, #prestart {
  background: #2B1C41;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  width: 644px;

  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#interface {
  display: none;
}

#prestart {
  background: url('images/start/startscreen.jpg') no-repeat center center / cover;
  align-items: center;
  display: flex;
  flex-flow: column;
  justify-content: center;
}
#prestart::before {
  content: '';
  display: block;
  height: 0;
  padding-top: 82.8%;
  width: 100%;
}

#prestartinfo {
  color: white;
  text-align: center;
  margin-top: 20px;
  text-transform: uppercase;
}

#countdown {
  background: #001c24 no-repeat center center / cover;
  display: none;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 10;
}

#startgame {
  appearance: none;
  background: url('images/start/startbutton.jpg') no-repeat center center / contain;
  border: none;
  display: block;
  cursor: pointer;
  height: 14.06%;
  position: absolute;
  left: 50%;
  top: 59%;
  transform: translate(-50%, -50%);
  width: 54.68%;
}

#mobile-controls {
  display: none;
  background: url(images/controls/controls.jpg) no-repeat center center / cover;
  position: relative;
  width: 100%;
}
#mobile-controls::before {
  content: '';
  display: block;
  height: 0;
  padding-top: 31.25%;
  width: 100%;
}
#interface.mobile #mobile-controls { display: block; }

#btn-left, #btn-right, #btn-down, #btn-up {
  background: no-repeat center center / cover;
  appearance: none;
  border: none;
  position: absolute;
}
#btn-left {
  background-image: url(images/controls/controls-left.jpg);
  height: 67%;
  left: 4.1%;
  top: 17.5%;
  width: 20.9375%;
}
#btn-right {
  background-image: url(images/controls/controls-right.jpg);
  height: 67%;
  right: 4.375%;
  top: 17.5%;
  width: 20.9375%;
}
#btn-up {
  display: none;
}
#btn-down {
  background-image: url(images/controls/controls-brake.jpg);
  bottom: 17%;
  height: 28%;
  left: 50%;
  transform: translateX(-50%);
  width: 40.15625%;
}

@media screen and (max-width: 640px) {
  #interface, #prestart {
    width: 100%;
  }

  #racer {
    border: none;
    height: auto;
    position: relative;
    width: 100%;
  }

  #racer::before {
    display: block;
    content: '';
    height: 0;
    width: 100%;
    padding-top: 75%;
  }

  #hud {
    top: 0;
    width: 100%;
  }

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