* {
  box-sizing: border-box;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

html, body {
  font-family: sans-serif;
}

@media screen and (min-aspect-ratio: 1/1) {
  #container {
    top: 0;
    left: calc(50% - 66.67vh);
    width: 133.33vh;
    height: 100vh;
  }
  .splashText {
    font-size: 4vh;
  }
  .popover {
    line-height: 50vh;
  }
}

@media screen and (max-aspect-ratio: 1/1) {
  #container {
    top: calc(50% - 37.5vw);
    left: 0;
    width: 100vw;
    height: 75vw;
  }
  .splashText {
    font-size: 3vw;
  }
  .popover {
    line-height: 37.5vw;
  }
}

#splash, #helppage {
  color: white;
  text-align: center;
}

#container {
  background: black;
  position: absolute;
}

#container > div, #container > table {
  border: 1px solid black;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#container > div:not(#camera), #container > table {
  z-index: 10;
}

#stationBox {
  background: rgba(255, 255, 255, 0.5);
}

h1 {
  font-weight: bold;
  font-size: 14vmin;
  margin: 5vmin 0 2vmin;
  font-style: italic;
  text-align: center;
}

.splashText {
  display: inline-block;
  width: 95%;
  border: 1px solid black;
  background: rgba(128, 192, 96, .8);
  padding: 2vmin;
  text-align: justify;
  color: black;
}

#helppage h1 {
  font-style: normal;
  font-size:  12vmin;
}

#helppage p {
  margin: .5vh 0 0 0;
}

#helppage img {
  height: 4vh;
  vertical-align: bottom;
}

@keyframes blink {
  0% { color: black; }
  50% { color: transparent; }
}

#loading .animate {
  position: absolute;
  top: calc(50% - 12vmin);
  width: 100%;
  left: 0;
  text-align: center;
  font-size: 20vmin;
  font-weight: bold;
  animation: blink .5s infinite;
}

#progress {
  position: absolute;
  top: calc(50% + 8vmin);
  width: 100%;
  left: 0;
  text-align: center;
  font-size: 5vmin;
}

canvas {
  image-rendering: pixelated -moz-crisp-edges;
  -webkit-optimize-contrast: pixelated;
}

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

#camera canvas:first-of-type {
  background-color: black;
}

#pauseContainer {
  position: fixed;
  left: 40%;
  width: 20%;
  overflow: visible;
  bottom: 2vmin;
  text-align: center;
}

#dpad {
  position: fixed;
  background-color: #808080;
  left: 2vmin;
  bottom: 2vmin;
  width: 31vmin;
  height: 31vmin;
  border: 1px solid black;
  border-radius: 7vmin;
}

.dpad div {
  width: 33.5%;
  height: 33.5%;
  line-height: initial;
  text-align: center;
  border: 1px solid black;
  background-color: white;
  color: black;
  margin: -1px;
  box-sizing: content-box;
  border-radius: 5px;
}

.dpad span {
  position: absolute;
  top: calc(50% - 0.5em);
  left: calc(50% - 0.5em);
  height: 1em;
  width: 1em;
  text-align: center;
  display: inline-block;
}

.dpad div.active {
  background-color: black;
  color: white;
}

.dpad .up {
  position: absolute;
  top: 0;
  left: 33.25%;
}

.dpad .left {
  position: absolute;
  left: 0;
  top: 33.25%;
}

.dpad .right {
  position: absolute;
  right: 0;
  top: 33.25%;
}

.dpad .down {
  position: absolute;
  bottom: 0;
  left: 33.25%;
}

#buttons {
  position: fixed;
  right: 2vmin;
  bottom: 2vmin;
}

.button img {
  vertical-align: middle;
}

.buttons .button, .pause .button {
  text-align: center;
  border: 1px solid black;
  border-radius: 2vmin;
  margin: -1px;
  background-color: white;
  color: black;
}

.buttons .button {
  width: 20vmin;
  height: 20vmin;
  line-height: 20vmin;
}

.pause .button {
  display: inline-block;
  height: 7vmin;
  line-height: 7vmin;
  padding: 0 2vmin;
}
.buttons .button.active, .pause .button.active {
  background-color: black;
  color: white;
}
.bigbutton {
  display: inline-block;
  width: 40%;
  margin: 2vmin 2vw;
  padding: 2vmin 2vw;
  font-size: 6vmin;
  height: 12vmin;
  line-height: 8vmin;
  border: 2px solid black;
  border-radius: 5px;
  color: black;
  text-decoration: none;
  cursor: pointer;
}
.popover .bigbutton {
  width: 80%;
}
.bigbutton.start {
  background: linear-gradient(rgb(128, 255, 128), rgb(0, 128, 0));
}
.bigbutton.easy {
  background: linear-gradient(rgb(128, 255, 255), rgb(0, 128, 0));
}
.bigbutton.help {
  background: linear-gradient(rgb(255, 255, 128), rgb(128, 128, 0));
}
.bigbutton.start:active {
  background: linear-gradient(rgb(32, 128, 32), rgb(100, 192, 100));
}
.bigbutton.easy:active {
  background: linear-gradient(rgb(32, 128, 128), rgb(100, 192, 100));
}
.bigbutton.help:active {
  background: linear-gradient(rgb(128, 128, 32), rgb(220, 220, 0));
}
#helppage td, #helppage th {
  text-align: center;
  padding: .1vmin;
}
#container > .popover {
  background: rgba(255, 255, 128, .9);
  text-align: center;
  position: absolute;
  width: 50%;
  height: 50%;
  border: 1px solid black;
  top: 25%;
  left: 25%;
}

.popover > div {
  display: inline-block;
  vertical-align: middle;
  line-height: initial;
  width: 100%;
}

.popoverContent h2 {
  animation: blink 2s infinite;
}

#gameOver.popover {
  height: 60%;
  width: 90%;
  top: 20%;
  left: 5%;
  padding: 24px;
}

h2 {
  font-size: 6vmin;
  padding: 0;
  margin: 0 0 4vh;
  font-weight: bold;
}

.tui-InventoryUI, .tui-Station {
  border: 1px solid black;
  background: #80c0ff;
}

.tui-InventoryUI {
  width: 300px;
}

.tui-Station {
  width: 500px;
}

.tui-InventoryUI > h3, .tui-Station > h3, .tui-Computer th {
  margin: 0;
  padding: 4px;
  text-align: left;
}

.tui-Station .closeBar {
  text-align: center;
  border-top: 1px solid black;
  padding: 4px;
}

.contents {
  border-top: 1px solid black;
  overflow-y: scroll;
  background: #202060;
}

.tui-InventoryUI .contents {
  height: 800px;
  border-bottom: 1px solid black;
}

.tui-Station .contents {
  height: 400px;
}

.meter {
  position: relative;
  background: #000040;
  border: 1px solid black;
}

.meter > div {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  text-align: center;
  color: white;
  font-weight: bold;
}

.meter > div:not(.display) {
  background: #00c000;
}

.inv-item {
  white-space: nowrap;
}

div.inv-item .symbol {
  display: inline-block;
  vertical-align: middle;
}

.tui-InventoryUI .contents .inv-item {
  width: 100%;
  padding: 4px;
  border-right: 1px solid black;
  cursor: pointer;
}

.inv-item .symbol {
  width: 40px;
  height: 40px;
  text-align: center;
  font-weight: bold;
  border: 1px solid black;
}

.inv-item div.symbol {
  line-height: 40px;
}

.inv-item .inv-name {
  padding-left: 4px;
}

.inv-item .inv-ct {
  width: 80px;
  text-align: right;
  font-size: 80%;
}

.inv-item.gas {
  background: #f0f0ff;
}

.inv-item.gas > .symbol, .inv-item.gas td.symbol {
  background: #e0e0f0;
  color: #000000;
}

.inv-item.water {
  background: #d0d0ff;
}

.inv-item.water > .symbol, .inv-item.water td.symbol {
  background: #0000ff;
  color: #ffffff;
}

.inv-item.mineral {
  background: #f0d080;
}

.inv-item.mineral > .symbol, .inv-item.mineral td.symbol {
  background: #706020;
}

.inv-item.metal {
  background: #c0c0c8;
}

.inv-item.metal.Fe > .symbol, .inv-item.metal.Fe td.symbol {
  background: #d8d0d0;
  color: #000000;
}

.inv-item.metal.Cu > .symbol, .inv-item.metal.Cu td.symbol {
  background: #b87333;
  color: #000000;
}

.inv-item.metal.Pt > .symbol, .inv-item.metal.Pt td.symbol {
  background: #e0e4e8;
  color: #000000;
}

.inv-item.metal.Si > .symbol, .inv-item.metal.Si td.symbol {
  background: #808090;
  color: #e0e0e0;
}

.inv-item.tech {
  background: #80ff60;
}

.inv-item.tech.Hull > .symbol, .inv-item.tech.Hull td.symbol {
  background: #a0a0a0;
  color: #000000;
}

.inv-item.tech.Thruster > .symbol, .inv-item.tech.ThrusterPart > .symbol,
.inv-item.tech.Thruster td.symbol, .inv-item.tech.ThrusterPart td.symbol {
  background: #606060;
  color: #e06000;
}

.inv-item.tech.Circuit > .symbol, .inv-item.tech.NavComp > .symbol,
.inv-item.tech.Circuit td.symbol, .inv-item.tech.NavComp td.symbol {
  background: #008c4a;
  color: #ffe000;
}

.inv-item.tech.Shield > .symbol, .inv-item.tech.ShieldUp > .symbol,
.inv-item.tech.Shield td.symbol, .inv-item.tech.ShieldUp td.symbol {
  background: #000080;
  color: #00ffff;
}

.recipe {
  border-right: 1px solid black;
  padding: 4px;
  width: 100%;
  cursor: pointer;
}

.recipe td > div {
  border: 1px solid black;
}

.recipe td .symbol {
  margin: 4px;
}

.recipe table {
  margin: 4px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.8);
  cursor: initial;
}

.recipe td {
  border: 1px solid black;
  padding: 4px;
}

.recipe .collapser {
  margin-left: 30px;
}

.recipe table {
  width: calc(100% - 30px);
}

.tui-Computer td:first-of-type:not([colspan]) {
  text-align: right;
  background: #80a0e0;
}

.tui-Computer td {
  border: 1px solid black;
}

.tui-Computer td, .tui-Computer th, .tui-Computer .display {
  padding: 4px;
}

.statusWarn {
  background: #f0e0e0;
  font-style: italic;
  color: #ff0000;
  font-weight: bold;
}

.statusGood {
  background: #e0ffe0;
  font-style: italic;
  color: #008000;
  font-weight: bold;
}

.statusCaution {
  background: #ffffe0;
  font-style: italic;
  color: #202000;
  font-weight: bold;
}

.statusUpgrade {
  background: #00ffff;
  font-style: italic;
  color: #004040;
  font-weight: bold;
}

#oxygenBox {
  position: absolute;
  top: auto !important;
  left: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto !important;
  font-size: 32px;
  font-weight: bold;
  color: white;
  pointer-events: none;
}
