html, body {
  overflow: hidden;
}

canvas {
  touch-action: none;
  z-index: 0;
}

canvas, #popup-window-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

h1 {
  font-family: 'Yusei Magic', sans-serif;
  font-size: xxx-large;
  text-align: center;
}

#popup-window-container {
  pointer-events: none;
  z-index: 1;
  transform-origin: top left;
}

#debug-controls {
  display: none;
  z-index: 2;
  border: 1px solid black;
  position: absolute;
  left: 0;
  top: 0;
  border: 8px dashed magenta;
}

#loading {
  z-index: 2;
  position: absolute;
  left:0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#welcome {
  z-index: 3;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  text-align: center;
}

#game-over {
  z-index: 3;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  display: none;
  background-color: #F6F6F6;
  z-index: 9999999;
}

#audio-fieldset label {
  display: block;
}

body.debug #debug-controls {
  display: inline-block;
}

.hudWindow {
  user-select: none;
  position: absolute;
  font-size: medium;
  pointer-events: initial;
}

@media (max-height: 400px) {
  .hudWindow {
    font-size: small;
  }
}

@media (max-height: 500px) {
  h2 {
    font-size: small;
  }

  #potions-title {
    font-size: large;
  }
}

.hudWindow .hudWindow {
  position: static;
}

.hudItemWindow {
  width: 250px;
  border-radius: 10px;
  border: 3px darkblue solid;
  background-color: lightgray;
  padding: 5px;
  font-family: 'Yusei Magic', sans-serif;
  visibility: hidden;
}

.hudPictureAndName {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-bottom: 1px black dotted;
}

.hudItemPicture {
  flex-grow: 1;
  text-align: center;
  margin: 5px;
}

.hudItemPicture > img {
  width: 40px;
  height: 40px;
}

.hudItemName {
  flex-grow: 2;
  text-align: center;
}

.hudItemDescription {
  text-align: center;
  border-bottom: 1px black dotted;
}

.hudItemTraitsTitle {
  text-align: center;
}

.hudItemHotbar {
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  z-index: 10;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  pointer-events: none;
}

.hudItemHotbarList {
  pointer-events: initial;
  display: inline-grid;
  list-style-type: none;
  padding: 5px;
  gap: 5px;
  grid-auto-flow: column;
  grid-template-rows: 40px;
  grid-auto-columns: 40px;
  background-color: darkblue;
}

.hudHotbarItem {
  display: inline-block;
  list-style-type: none;
  margin-right: 0px;
  background-color: darkgray;
  position: relative;
}

.hudHotbarItem > img {
  max-width: 100%;
  max-height: 100%;
}

.hudHotbarItem.selected > img {
  /*border-color: red;*/
  background-color: white;
}

ul {
  margin-top: 0;
  margin-bottom: 0;
}

.audioControlWrapper {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 15;
  background-color: darkgray;
  user-select: none;
}

.audioRange {
  width: 50px;
}

.rpgTextBox {
  width: 85%;
  margin: auto;
  padding: 5px;
  position: absolute;
  left: 0;
  right: 0;
  top: 0px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100px;
  border: 3px blue solid;
  text-align: center;
  background-color: lightgray;
  border-radius: 13px;
}

.rpgTextBox.bottom {
  top: initial;
  bottom: 72px;
}

.rpgTextBoxPortrait {
  text-align: center;
  margin: 5px;
}

.rpgTextBoxText {
  flex-grow: 4;
  text-align: left;
  margin: 5px;
  font-family: 'Yusei Magic', sans-serif;
  width: 95px;
  width: 95px;
}

.rpgTextBoxDismissButton {
  position: absolute;
  bottom: 10px;
  right: 10px;
  align-self: flex-end;
}

@media (min-width: 1000px) {

  .rpgTextBox {
    height: 200px;
  }

  .rpgTextBoxText {
    font-size: xx-large;
  }

  .rpgTextBoxPortrait {
    height: 190px;
    width: 190px;
  }
}

#welcome {
  background-color: #F6F6F6;
}

.welcome-footer {
  position: absolute;
  bottom: 15px;
  width: 100%;
  display: flex;
  justify-content: center;
  max-height: 30%;
}

#welcome-links {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Yusei Magic', sans-serif;
  font-size: medium;
  color: #212121;
  align-self: center;
  margin-right: 5px;
}

.welcome-button-container {
  width: 100%;
  text-align: center;
  display: flex;
}

#welcome-content  {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  max-height: 90%;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.title-image {
  height: 70vh;
  text-align: center;
  margin: auto;
}

.title-button {
  all: unset;
  user-select: none;
  cursor: pointer;
  font-family: 'Yusei Magic', sans-serif;
  display: block;
  font-size: xx-large;
  margin: auto;
  color: #212121;
}

.title-button:hover {
  color: #6D9886;
}

.title-button:disabled {
  color: #D9CAB3;
}

@media (max-height: 1600px) {
  .title-image {
    order: 2;
  }

  #new-game-button {
    order: 1;
  }

  #continue-button {
    order: 3
  }

  #welcome-content {
    flex-direction: row;
  }
}

#cheat-sheet {
  display: none;
  position: absolute;
  flex-direction: column;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 24px;
  z-index: 11;
  background-color: tan;
  border: 8px solid brown;
  animation: slide-down 1s 1;
}

#cheat-sheet header,
#cheat-sheet footer {
  flex: 0 0 auto;
}

#cheat-sheet h1 {
  margin: 0;
  padding: 0;
}

#cheat-sheet ul {
  flex: 1 1 auto;
  overflow: auto;
}

#cheat-sheet header {
  border-bottom: 2px solid brown;
}

#cheat-sheet footer {
  border-top: 2px solid brown;
  text-align: center;
}

#cheat-sheet footer button {
  margin: 1rem;
  font-size: large;
}

@keyframes slide-down {
  from {
    transform: translateX(400px) translateY(400px) scale(0.75);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}
