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

body          { font-family: Arial, Helvetica, sans-serif; }
#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: #72D7EE; }
#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(255,0,0,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); }

/* ==================== MOBILE RESPONSIVE ==================== */

#touch-overlay {
  display: none;
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  text-align: center;
}

#touch-overlay .tc-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0;
}

.tc-racer-btn {
  pointer-events: all;
  width: 72px;
  height: 72px;
  font-size: 30px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tc-racer-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
  body { overflow-x: hidden; }

  #controls     { display: none; }
  #instructions { display: none; }

  #racer {
    width: 100vw;
    height: calc(100vw * 0.75);
    margin-left: 0;
    border: none;
    border-bottom: 2px solid black;
  }

  #canvas {
    width: 100%;
    height: 100%;
  }

  #hud {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.6em;
  }

  #mute {
    margin-left: 5px;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 100;
  }

  #touch-overlay {
    display: block;
  }
}

