* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  margin-top: 16px;
  /*background: #006054;*/
  font-family: 'Varela Round';
}

body {
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: center;
          justify-content: center;
  -webkit-box-align: center;
          align-items: center;
}

.container {
  width: 90%;
  max-width: 400px;
  border: 5px solid #FFA000;
  border-radius: 3px;
  /*box-shadow: 10px 10px 50px 15px rgba(0, 0, 0, 0.3);*/
  background-color: #455A64;
  position: relative;
}

.canvas-wrapper {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  position: relative;
}

canvas {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  width: 100%;
  background-color: #37474F;
}

.controls {
  width: 100%;
  padding-top: 20px;
  padding-bottom: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-pack: justify;
          justify-content: space-between;
  flex-wrap: wrap;
}

button[class^="btn"] {
  background-color: #FFA000;
  padding: 5px 20px;
  text-transform: uppercase;
  font-family: 'Varela Round';
  font-size: 14px;
  color: white;
  font-weight: bold;
  border: none;
  border-radius: 3px;
  letter-spacing: 0.3em;
  height: 30px;
  line-height: 30px;
  padding: 0 10px;
  box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.2);
  outline: none;
  cursor: pointer;
  -webkit-transition: box-shadow 0.3s, background 0.3s;
  transition: box-shadow 0.3s, background 0.3s;
  text-align: center;
  margin: 0 20px 0;
  margin-bottom: 20px;
}
button[class^="btn"]:hover {
  background: #ffb333;
  box-shadow: 0 0 20px 5px rgba(0, 0, 0, 0.3);
}
@media (min-width: 450px) {
  button[class^="btn"] {
    width: 150px;
  }
}

button[disabled] {
  background: #cc8000;
}

.range {
  width: 100%;
  margin-bottom: 20px;
  margin: 0 20px 20px;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
          align-items: center;
}
.range label {
  color: white;
  text-transform: uppercase;
  margin-right: 20px;
  width: 30%;
}
.range_inputWrapper {
  width: 100%;
  position: relative;
  height: 20px;
  background-color: #fff;
  box-shadow: 0 0 10px 5px rgba(0, 0, 0, 0.2);
}
.range_inputValue {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  color: white;
  font-size: 14px;
  height: 100%;
  padding-left: 3px;
  line-height: 20px;
}
.range_inputSlider {
  -webkit-transform-origin: left top;
          transform-origin: left top;
  position: absolute;
  top: 0;
  left: 0;
  background: #FFA000;
  display: inline-block;
  width: 100%;
  height: 100%;
  -webkit-transform: scaleX(0);
          transform: scaleX(0);
  -webkit-transition: -webkit-transform 0.2s ease-out;
  transition: -webkit-transform 0.2s ease-out;
  transition: transform 0.2s ease-out;
  transition: transform 0.2s ease-out, -webkit-transform 0.2s ease-out;
}
.range input {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 1;
}

.score {
  position: absolute;
  top: 10px;
  left: 0;
  z-index: 1;
  width: 100%;
  text-align: center;
  font-weight: bold;
  font-size: 30px;
  opacity: 0.3;
  text-transform: uppercase;
  color: white;
}

.dpad {
  width: 100px;
  margin: 0 auto;
  margin-bottom: 20px;
  display: none;
}

button[class^="control"] {
  background: #FFA000;
  border: none;
  border-radius: 3px;
}

.control-up {
  display: block;
}

.control-down svg {
  -webkit-transform: rotate(180deg);
          transform: rotate(180deg);
}

.control-left svg {
  -webkit-transform: rotate(90deg);
          transform: rotate(90deg);
}

.control-right svg {
  -webkit-transform: rotate(-90deg);
          transform: rotate(-90deg);
}
/* Snake mobile control refinements */
html,
body {
  height: auto;
  margin: 0;
  min-height: 100%;
}

body {
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  touch-action: manipulation;
}

.container {
  max-width: 420px;
  width: min(100%, 420px);
}

canvas {
  touch-action: none;
}

.controls {
  gap: 16px;
  justify-content: center;
  padding: 14px;
}

button[class^="btn"] {
  flex: 1 1 132px;
  height: auto;
  letter-spacing: 0.12em;
  line-height: 1;
  margin: 0;
  min-height: 50px;
  padding: 0 12px;
}

.range {
  flex: 1 1 100%;
  gap: 12px;
  margin: 0;
}

.range label {
  flex: 0 0 72px;
  margin-right: 0;
  width: auto;
}

.dpad {
  display: none;
  gap: 12px;
  grid-template-columns: repeat(3, 64px);
  justify-content: center;
  margin: 18px auto 6px;
  width: max-content;
}

button[class^="control"] {
  align-items: center;
  background: #FFA000;
  border: none;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 1.35rem;
  font-weight: 700;
  height: 60px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  touch-action: manipulation;
  width: 64px;
}

button[class^="control"]:active {
  background: #ffb333;
  transform: scale(0.96);
}

.control-up {
  grid-column: 2;
}

.control-left {
  grid-column: 1;
  grid-row: 2;
}

.control-down {
  grid-column: 2;
  grid-row: 2;
}

.control-right {
  grid-column: 3;
  grid-row: 2;
}

@media (max-width: 700px), (pointer: coarse) {
  .dpad {
    display: grid;
  }
}

@media (max-width: 360px) {
  .dpad {
    gap: 10px;
    grid-template-columns: repeat(3, 56px);
  }

  button[class^="control"] {
    height: 54px;
    width: 56px;
  }

  .controls {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: center;
    overflow: hidden;
    padding: 6px;
  }

  .container {
    display: grid;
    grid-template-columns: calc(100vh - 22px) 160px;
    grid-template-rows: 1fr 1fr;
    height: min(calc(100svh - 12px), calc(100vw - 172px));
    max-width: none;
    width: auto;
  }

  .canvas-wrapper {
    grid-column: 1;
    grid-row: 1 / 3;
    height: 100%;
    padding-bottom: 0;
    width: 100%;
  }

  .score {
    align-self: start;
    grid-column: 1;
    grid-row: 1;
    left: auto;
    position: relative;
    top: 10px;
    width: 100%;
  }

  .dpad {
    align-self: center;
    display: grid;
    gap: 8px;
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(3, 48px);
    margin: 0 auto;
  }

  button[class^="control"] {
    height: 48px;
    width: 48px;
  }

  .controls {
    align-content: start;
    gap: 10px;
    grid-column: 2;
    grid-row: 2;
    overflow-y: auto;
    padding: 4px 8px;
  }

  button[class^="btn"] {
    min-height: 44px;
  }

  .range {
    gap: 4px;
  }

  .range label {
    flex-basis: 62px;
    font-size: 0.75rem;
  }
}
