body {
  margin: 0px;
  background-color: #5f5f5f;
}

#body {
  margin: 0px;
  width: 100vw;
  height: 100vh;
  display: grid;
  align-items: center;
  justify-items: center;
  grid-template-rows: auto 2.5em;
  grid-template-columns: 100%;
  grid-template-areas:
    "main"
    "footer";
}

#body>main {
  font-size: 15px;
  grid-area: main;
  aspect-ratio: 1/1;
  height: -webkit-fill-available;
  max-width: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

section#game {
  min-width: 300px;
  min-height: 300px;
  aspect-ratio: 1/1;
  display: grid;
  align-items: center;
  justify-content: center;
  grid-template-columns: 50% 50%;
  grid-template-rows: 50% 50%;
  grid-template-areas:
    "red green"
    "yellow blue";
  border-radius: 100%;
  outline: rgba(0, 0, 0, 0.5) solid 0.8em;
  border: 1em solid #000;
}

#red,
#green,
#yellow,
#blue {
  height: 100%;
  height: -webkit-fill-available;
  border-style: solid;
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

.user_input #red:hover,
.user_input #green:hover,
.user_input #yellow:hover,
.user_input #blue:hover {
  cursor: pointer;
}

#red {
  grid-area: red;
  background-color: rgb(210, 0, 0);
  border-width: 1em 0.5em 0.5em 1em;
  border-radius: 100% 0 0 0;
  border-top: 1em solid rgba(255, 255, 255, 0.2);
  border-right: 0.5em solid #000;
  border-bottom: 0.5em solid #000;
  border-left: 1em solid rgba(255, 255, 255, 0.2);
}
#red.on {
  background-color: rgb(255, 32, 32);
}
.user_input #red:active {
  background-color: rgb(157, 25, 25);
}

#green {
  grid-area: green;
  background-color: rgb(0, 120, 0);
  border-width: 1em 1em 0.5em 0.5em;
  border-radius: 0 100% 0 0;
  border-top: 1em solid rgba(255, 255, 255, 0.2);
  border-right: 1em solid rgba(255, 255, 255, 0.2);
  border-bottom: 0.5em solid #000;
  border-left: 0.5em solid #000;
}
#green.on {
  background-color: rgb(0, 164, 0);
}
.user_input #green:active {
  background-color: rgb(13, 77, 13);
}

#yellow {
  grid-area: yellow;
  background-color: rgb(200, 200, 0);
  border-width: 0.5em 0.5em 1em 1em;
  border-radius: 0 0 0 100%;
  border-top: 0.5em solid #000;
  border-right: 0.5em solid #000;
  border-bottom: 1em solid rgba(255, 255, 255, 0.2);
  border-left: 1em solid rgba(255, 255, 255, 0.2);
}
#yellow.on {
  background-color: rgb(255, 255, 0);
}
.user_input #yellow:active {
  background-color: rgb(134, 134, 11);
}

#blue {
  grid-area: blue;
  background-color: rgb(0, 0, 220);
  border-width: 0.5em 1em 1em 0.5em;
  border-radius: 0 0 100% 0;
  border-top: 0.5em solid #000;
  border-right: 1em solid rgba(255, 255, 255, 0.2);
  border-bottom: 1em solid rgba(255, 255, 255, 0.2);
  border-left: 0.5em solid #000;
}
#blue.on {
  background-color: rgb(39 42 254);
}
.user_input #blue:active {
  background-color: rgb(0, 5, 149);
}


#body>footer {
  grid-area: footer;
  width: 100%;
  height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #333;
  color: #bbb;
  font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
#body>footer a {
  color: #bbb;
  text-decoration: none;
}


#level-selector {
  margin: 18px 5px 6px 5px;
}

section#controllers {
  min-width: 185px;
  min-height: 185px;
  position: absolute;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#display {
  width: 50px;
  cursor: pointer;
  text-align: center;
  margin: 10px 6px 6px 6px;
  padding: 3px 8px;
  border-radius: 7px;
  border: 2px solid rgba(0, 0, 0, 0.4);
  background-color: rgba(0, 0, 0, 0.2);
  font-size: 1.4em;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #222;
  text-shadow: 0px 0px 2px #CE0000;
}


/**** start metal ****/
.metal {
  position: relative;
  outline: none;

  color: hsla(0, 0%, 20%, 1);
  text-shadow: hsla(0, 0%, 40%, .5) 0 -1px 0, hsla(0, 0%, 100%, .6) 0 2px 1px;

  background-color: hsl(0, 0%, 90%);
  box-shadow: inset hsla(0, 0%, 15%, 1) 0 0px 0px 4px,
    /* border */
    inset hsla(0, 0%, 15%, .8) 0 -1px 5px 4px,
    /* soft SD */
    inset hsla(0, 0%, 0%, .25) 0 -1px 0px 7px,
    /* bottom SD */
    inset hsla(0, 0%, 100%, .7) 0 2px 1px 7px,
    /* top HL */

    hsla(0, 0%, 0%, .45) 0 0px 6px 4px;
  /* outer SD */

  transition: color .2s;
}

.metal {
  border-radius: 100%;
  background-image: -webkit-radial-gradient(50% 0%, 8% 50%, hsla(0, 0%, 100%, .5) 0%, hsla(0, 0%, 100%, 0) 100%),
    -webkit-radial-gradient(50% 100%, 12% 50%, hsla(0, 0%, 100%, .6) 0%, hsla(0, 0%, 100%, 0) 100%),
    -webkit-radial-gradient(0% 50%, 50% 7%, hsla(0, 0%, 100%, .5) 0%, hsla(0, 0%, 100%, 0) 100%),
    -webkit-radial-gradient(100% 50%, 50% 5%, hsla(0, 0%, 100%, .5) 0%, hsla(0, 0%, 100%, 0) 100%),

    -webkit-repeating-radial-gradient(50% 50%, 100% 100%, hsla(0, 0%, 0%, 0) 0%, hsla(0, 0%, 0%, 0) 3%, hsla(0, 0%, 0%, .1) 3.5%),
    -webkit-repeating-radial-gradient(50% 50%, 100% 100%, hsla(0, 0%, 100%, 0) 0%, hsla(0, 0%, 100%, 0) 6%, hsla(0, 0%, 100%, .1) 7.5%),
    -webkit-repeating-radial-gradient(50% 50%, 100% 100%, hsla(0, 0%, 100%, 0) 0%, hsla(0, 0%, 100%, 0) 1.2%, hsla(0, 0%, 100%, .2) 2.2%),

    -webkit-radial-gradient(50% 50%, 200% 50%, hsla(0, 0%, 90%, 1) 5%, hsla(0, 0%, 85%, 1) 30%, hsla(0, 0%, 60%, 1) 100%);
}

.radial:before,
.radial:after {
  content: "";
  top: 0;
  left: 0;
  position: absolute;
  width: inherit;
  height: inherit;
  border-radius: inherit;

  /* fake conical gradients */
  background-image: -webkit-radial-gradient(50% 0%, 10% 50%, hsla(0, 0%, 0%, .1) 0%, hsla(0, 0%, 0%, 0) 100%),
    -webkit-radial-gradient(50% 100%, 10% 50%, hsla(0, 0%, 0%, .1) 0%, hsla(0, 0%, 0%, 0) 100%),
    -webkit-radial-gradient(0% 50%, 50% 10%, hsla(0, 0%, 0%, .1) 0%, hsla(0, 0%, 0%, 0) 100%),
    -webkit-radial-gradient(100% 50%, 50% 06%, hsla(0, 0%, 0%, .1) 0%, hsla(0, 0%, 0%, 0) 100%);
}

.radial:before {
  transform: rotate(65deg);
}

.radial:after {
  transform: rotate(-65deg);
}
/**** end metal ****/

/**** start tristate ****/
.tristate {
  position: relative;
}

.tristate input[type=radio] {
  position: absolute;
  cursor: pointer;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  opacity: 0;
}

.tristate label {
  display: inline-block;
  margin: 1px 3px 7px 3px;
  font-family: Arial, Helvetica, sans-serif;
}

.tristate>input[type=radio]+i {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: top;
}

.tristate>input[type=radio]+i,
.tristate>input[type=radio]+i:before,
.tristate>input[type=radio]+i:after {
  transition: all 0.3s;
}

.tristate>input[type=radio]:first-child {
  z-index: 1;
}

.tristate>input[type=radio]:first-child:checked {
  z-index: 0;
}

.tristate>input[type=radio]:checked+input[type=radio] {
  z-index: 1;
}

.tristate>input[type=radio]:checked+i+label,
.tristate>input[type=radio]:checked+i+label+label {
  display: none;
}

.tristate>input[type=radio]:checked+input[type=radio]+i+label,
.tristate>input[type=radio]:checked+input[type=radio]+i+label+label+label {
  display: none;
}

.tristate>input[type=radio]:checked+input[type=radio]+input[type=radio]+i+label+label,
.tristate>input[type=radio]:checked+input[type=radio]+input[type=radio]+i+label+label+label {
  display: none;
}

.tristate-switcher>input[type=radio] {
  width: 46px;
  height: 24px;
  left: -3px;
  top: -1px;
}

.tristate-switcher>input[type=radio]+i {
  width: 40px;
  height: 16px;
  margin-top: 2px;
  background-color: #ffe887;
  border-radius: 8px;
}

.tristate-switcher>input[type=radio]+i:before {
  content: " ";
  position: absolute;
  top: -3px;
  left: -3px;
  display: block;
  width: 24px;
  height: 24px;
  background-color: #ffcf00;
  border-radius: 50%;
  box-shadow: 0 1px 8px 1px rgba(0, 0, 0, 0.3);
}

.tristate-switcher>input[type=radio]:checked+i {
  background-color: #f9a19a;
}

.tristate-switcher>input[type=radio]:checked+i:before {
  left: 19px;
  background-color: #f44336;
}

.tristate-switcher>input[type=radio]:checked+input[type=radio]+i:before {
  left: 8px;
}

.tristate-switcher>input[type=radio]:checked+input[type=radio]+input[type=radio]+i {
  background-color: #a5d7a7;
}

.tristate-switcher>input[type=radio]:checked+input[type=radio]+input[type=radio]+i:before {
  background-color: #4caf50;
}
/**** end tristate ****/


/**** start start-button ****/
.start-button-pushable {
  position: relative;
  aspect-ratio: 1/1;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  outline-offset: 4px;
  transition: filter 250ms;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.start-button-shadow {
  position: absolute;
  aspect-ratio: 1/1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 100%;
  background: hsl(0deg 0% 0% / 0.25);
  will-change: transform;
  transform: translateY(2px);
  transition:
    transform 600ms cubic-bezier(.3, .7, .4, 1);
}

.start-button-edge {
  position: absolute;
  aspect-ratio: 1/1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 100%;
  background: linear-gradient(to left,
      hsl(340deg 100% 16%) 0%,
      hsl(340deg 100% 32%) 8%,
      hsl(340deg 100% 32%) 92%,
      hsl(340deg 100% 16%) 100%);
}

#start-button.on .start-button-edge {
  background: linear-gradient(to left,
      hsl(124deg 100% 16%) 0%,
      hsl(124deg 100% 32%) 8%,
      hsl(124deg 100% 32%) 92%,
      hsl(124deg 100% 16%) 100%);
}

.start-button-front {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  aspect-ratio: 1/1;
  min-width: 2em;
  min-height: 2em;
  line-height: 2.2em;
  padding: 0;
  border-radius: 100%;
  font-size: 2em;
  font-weight: bold;
  color: white;
  background: hsl(345deg 100% 47%);
  will-change: transform;
  transform: translateY(-4px);
  transition:
    transform 600ms cubic-bezier(.3, .7, .4, 1);
}

#start-button.on .start-button-front {
  background: hsl(124, 93%, 45%);
}

.start-button-pushable:hover {
  filter: brightness(110%);
  -webkit-filter: brightness(110%);
}

.start-button-pushable:hover .start-button-front {
  transform: translateY(-6px);
  transition:
    transform 250ms cubic-bezier(.3, .7, .4, 1.5);
}

.start-button-pushable:active .start-button-front {
  transform: translateY(-2px);
  transition: transform 34ms;
}

.start-button-pushable:hover .start-button-shadow {
  transform: translateY(4px);
  transition:
    transform 250ms cubic-bezier(.3, .7, .4, 1.5);
}

.start-button-pushable:active .start-button-shadow {
  transform: translateY(1px);
  transition: transform 34ms;
}

.start-button-pushable:focus:not(:focus-visible) {
  outline: none;
}

/**** end start-button ****/


/* Modal (background) */
.modal {
  position: absolute;
  width: 100vw;
  height: 100vh;
  display: none;
  z-index: 10;
  background-color: black;
  background-color: #00000099;
  opacity: 0;
  transition: opacity 0.5s;
  -webkit-transition: opacity 0.5s;
}

.modal a {
  text-decoration: underline;
}

.modal.active {
  opacity: 1;
}

/* Modal Content */
.modal-content {
  position: relative;
  z-index: 10;
  background-color: #000000bd;
  margin: auto;
  border: 1px solid #222;
  border-radius: 5px;
  max-width: 80vw;
  min-width: 200px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  opacity: 1;
  transition: opacity 0.5s, top 0.5s ease-in-out, left 0.5s ease-in-out;
  -webkit-transition: opacity 0.5s, top 0.5s ease-in-out, left 0.5s ease-in-out;
  font-size: 1.1em;
  font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

.modal-content input {
  width: -webkit-fill-available;
  margin: 10px 0;
  padding: 4px;
  font-size: 1.2em;
}

/* Add Animation */
@-webkit-keyframes animate_opacity {
  from {
      opacity: 0;
  }

  to {
      opacity: 1;
  }
}

@keyframes animate_opacity {
  from {
      opacity: 0;
  }

  to {
      opacity: 1;
  }
}

/* The Close Button */
.modal-close {
  text-decoration: none;
  color: #999;
  float: right;
  font-size: 25px;
}

.modal-close:hover,
.modal-close:focus {
  color: #eee;
  text-decoration: none;
  cursor: pointer;
}

.modal-header {
  padding: 2px 16px;
  background-color: #00000080;
  color: white;
}

.modal-header h2 {
  margin: 5px;
  font-size: 1.2em;
  color: #999;
  text-align: center;
  font-weight: 500;
}

.modal-body {
  padding: 2px 16px;
  overflow: auto;
  font-size: 0.9em;
  color: #aaa;
  padding: 20px;
}

.modal-body table {
  border-spacing: 10px;
}

table td.score {
  text-align: center;
}