:root {
  /*font-size: calc(calc(min(1vw, 1vh)));*/
  font-family: "Sixtyfour";
}

html {
  font-size: 12px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: black;
  width: 100vw;
  height: 100vh;
}

@media (max-width: 991px) and (orientation: landscape) {
  html {
    font-size: 6px; /* Smaller root font size for mobile */
  }
}

body {
  font-size: 0.7rem;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: black;
  width: 100vw;
  height: 100vh;
}
.landscape {
  transform: rotate(90deg) translateY(-100vw);
  width: 100vh;
  height: 100vw;
}
canvas {
  object-fit: cover;
  position: absolute;
  top: round(nearest, 50%, 1px);
  left: round(nearest, 50%, 1px);
  transform: translate(round(nearest, -50%, 1px), round(nearest, -50%, 1px));
  border: 2px solid #ccc;
  border-radius: 2px;
}

#intro {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  color: white;
  cursor: pointer;
}

#intro-title {
  font-size: 7rem;
}

#mobile-warning {
  font-size: 1.5rem;
  margin-top: 1rem;
  text-align: center;
  margin-left: -5rem;
}

.action-name {
  color: #cc0;
}

.button-name {
  /* TODO: Use this in intro*/
  color: #cc0;
}

.game-title {
  background-image: linear-gradient(
    to right,
    #c60,
    #cc0,
    #0cc,
    #06c,
    #0cc,
    #cc0,
    #c60
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-size: 400%;
  animation: gradientShift 10s linear infinite;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: -200% 50%;
  }
}
#intro-info {
  font-size: 1.2rem;
}

#glass {
  position: absolute;
  width: calc(max(100vh, 100vw));
  height: calc(max(100vh, 100vw));
  background-color: transparent;
  overflow: hidden;
  top: 0;
  left: 0;
  z-index: 5;
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}

#main-menu {
  font-family: "Sixtyfour";
  color: #cc3;
  font-size: 2.5rem;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30%;
  text-align: center;
}

#pause-menu {
  font-size: 2rem;
  flex-shrink: 0;
  margin-right: auto; /* Remove this to allow centering or specific placement */
  margin-left: auto; /* This will center it if there's space */
  padding: 1rem;
  cursor: default;
  width: fit-content;
}

.pause-button {
  margin-top: 0.7rem;
}

.metap-modal {
  font-size: 1rem;
  top: 2rem;
  right: 2rem;
  transform: none;
}

#metap-modal {
  height: 60vh;
  overflow: scroll;
  z-index: 10000;
}

#metap-modal-glass {
  z-index: 10000;
}

#msgs-main {
  font-family: "Sixtyfour";
}

.encouragement {
  color: #c60;
  margin-bottom: 1.5rem;
}

.remaining-time {
  color: #c60;
}

.wave-num {
  color: #0cc;
}

#score {
  text-align: right;
  margin-right: 1em;
  width: 10em;
  float: right;
}

#info {
  position: absolute;
  z-index: 1000;
  width: 100%;
  display: none;
  align-items: center;
  box-sizing: border-box;
  top: 0.2em;
  left: 0.2em;
  color: #cc0;
  font-size: 1.5rem;
}

#debug-menu {
  font-size: 2rem;
  flex-shrink: 0;
  margin-right: auto;
  padding: 0.5rem;
  cursor: default;
  width: fit-content;
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 10000;
  color: #777;
}

#right-container {
  display: flex;
  flex-shrink: 0;
}

#next-wave-countdown {
  padding: 10px;
  margin-left: 10px;
}

#score {
  font-size: 1rem;
  padding: 10px;
  margin-left: 10px;
}

#extra-info {
  position: static;
  z-index: 1000;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  color: #cc0;
}

.right-container {
  display: flex;
  flex-shrink: 0;
}

#hull {
  min-width: 8em;
  padding: 0.5rem;
  margin-left: 0.5rem;
}

#primary-weapon-types {
  /*padding: 0.5rem;
  margin-left: 0.5rem;*/
  width: 3rem;
  aspect-ratio: 1 / 1;
  border-radius: 0.1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin-left: 0.5rem;
}

#primary-weapon-types > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#primary-weapon-ammo,
#secondary-weapon-ammo,
#shield-energy,
#secondary-energy {
  font-size: 80%;
}
#secondary-weapon-types {
  /*padding: 0.5rem;
  margin-left: 0.5rem;*/
  width: 3rem;
  aspect-ratio: 1 / 1;
  border-radius: 0.1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin-left: 0.5rem;
}

#secondary-weapon-types > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#shield-types {
  /*padding: 0.5rem;
  margin-left: 0.5rem;*/
  width: 3rem;
  aspect-ratio: 1 / 1;
  border-radius: 0.1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin-left: 0.5rem;
}

#shield-types > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#secondary-types {
  /*padding: 0.5rem;
  margin-left: 0.5rem;*/
  width: 3rem;
  aspect-ratio: 1 / 1;
  border-radius: 0.1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin-left: 0.5rem;
}

#secondary-types > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#current-powerups-hud {
  display: flex;
  width: fit-content;
  cursor: help;
  margin-left: 1rem;
}

#current-powerups-hud {
  flex-wrap: wrap;
  min-height: 1rem;
  max-height: 1rem;
  border-radius: 1rem;
}

#current-powerups-hud > div {
  width: 3rem;
  aspect-ratio: 1/1;
  border-radius: 0.1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin-left: 0.5rem;
  transform: translate(0, round(nearest, -1rem, 1px));
}

.overheated {
  border: 4px solid #c06 !important;
  box-sizing: border-box;
}

.defective {
  border: 4px solid #c06 !important;
  box-sizing: border-box;
}

#current-powerups-hud > div > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#powerup-container {
  cursor: pointer;
  z-index: 5;
  font-size: 1rem;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  padding: 1rem;
  border-radius: 1rem; /* TODO: check all radii */
  border: 1px solid #ccc;
  text-align: center;
  width: 80rem; /* To fit all text */
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
}

.powerup-title {
  font-size: 2rem;
  color: #0cc;
}

.powerup-replaces {
  font-size: 1.2rem;
  color: #c60;
  font-style: italic;
}

#powerup-container > h2 {
  width: 100%;
  flex-basis: 100%;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}

#skip-powerup {
  width: 100%;
  flex-basis: 100%;
}

.powerup-selected {
  background-color: #555;
  border-radius: 1rem;
  border: 1px solid #ccc;
}

#current-powerups {
  display: flex;
  width: 100%;
  flex-basis: 100%;
  cursor: help;
}

.current-powerups {
  flex-wrap: wrap;
  border: 1px solid #ccc;
  min-height: 3rem;
  border-radius: 1rem;
}

.current-powerups > div {
  width: 3rem;
  aspect-ratio: 1/1;
  border-radius: 1rem;
  border: 1px solid #ccc;
  display: flex;
  overflow: hidden;
  margin: 0.5rem;
}

.current-powerups > div > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.powerup-choice {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

.choice-glyph {
  width: 50%;
  aspect-ratio: 1/1;
  border-radius: 1rem;
  border: 1px solid #ccc;
  margin-bottom: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
  overflow: hidden;
}

.choice-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.choice-description {
  text-align: center;
  color: white;
  font-size: 1.5rem;
}

.choice-description table {
  text-align: center;
  color: white;
}

.player-stats {
  font-size: 1.1rem;
  border: 1px solid #ccc;
  border-radius: 1rem;
  border-collapse: separate;
  color: white;
  text-align: center;
  padding: 0.5rem;
  margin-top: 1rem;
}

.player-stats-title {
  text-align: left;
}

/* TODO: to move out */

.control-list-wrapper {
  color: white;
}

.control-list-wrapper > table {
  color: white;
  margin: 1em;
  border-collapse: separate;
  border-spacing: 2rem;
}

.control-list-wrapper th {
  color: white;
  font-size: 120%;
}

.control-list-wrapper .action-name {
  border-right: 1px solid #cc0;
}

.settings-checkbox {
  font-size: 110%;
  text-align: left;
  margin-left: 10em;
}

.settings-checkbox > input {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  background-color: black;
  border: 1px solid #ccc;
  border-radius: 0.2em;
  cursor: pointer;
  display: inline-block;
  position: relative;
  margin-right: 2em;
}

.settings-checkbox > input:checked {
  background-color: #6c0;
}

.setting-control {
  color: #c60;
}

#effectText {
  position: absolute;
  font-size: 1em;
  font-weight: bold;
  text-align: center;
  color: #c06;
  opacity: 0; /* Starts hidden */
  transition:
    opacity 500ms ease-out,
    font-size 500ms ease-out;
  pointer-events: none;
  z-index: 1001;
}

#about {
  font-size: 1.3rem;
  color: #6c0;
  text-align: left;
  line-height: 1.4;
}

#about-title {
  font-size: 3rem;
  text-align: center;
}

#about blockquote {
  color: #cc0;
}

#about blockquote em {
  color: #06c;
}

#about em {
  color: #c60;
}

#about code {
  color: #c60;
}

.changelog-button {
  cursor: pointer;
  color: #c06;
}

/* Styles the scrollbar track (the gutter) */
::-webkit-scrollbar-track {
  background-color: black;
}

/* Styles the scrollbar thumb (the draggable part) */
::-webkit-scrollbar-thumb {
  background-color: #660;
  border-radius: 4px;
}

/* You might also want to define the scrollbar width */
::-webkit-scrollbar {
  width: 10px; /* Adjust width as needed */
}

.changelog-content {
  text-align: left;
  cursor: pointer;
  height: 50vh;
  overflow-y: scroll;
}

.changelog-content > h1 {
  color: #cc0;
}

.changelog-content > li {
  font-size: 1.25rem;
}

.changelog-content em {
  color: #6c0;
  font-style: normal;
}

#summary {
  text-align: left;
}

#summary em {
  color: #cc0;
}

.last-level {
  font-size: 110%;
  margin-bottom: 1rem;
}

.game-over {
  width: 70rem;
  font-size: 120%;
}

/* Mobile media queries */

@media (max-width: 991px) and (orientation: landscape) {
  #powerup-container {
    cursor: pointer;
    z-index: 5;
    font-size: 0.8rem;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    padding: 1rem;
    border-radius: 1rem; /* TODO: check all radii */
    border: 1px solid #ccc;
    text-align: center;
    width: 80rem; /* To fit all text */
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
  }
  .powerup-title {
    font-size: 1.2rem;
    color: #0cc;
  }

  .powerup-description {
    font-size: 1rem;
  }

  .powerup-replaces {
    font-size: 0.9rem;
    color: red;
    font-style: italic;
  }

  #powerup-container > h2 {
    width: 100%;
    flex-basis: 100%;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 1.2rem;
  }
  .choice-glyph {
    width: 30%;
    aspect-ratio: 1/1;
    border-radius: 1rem;
    border: 1px solid #ccc;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  .choice-description {
    text-align: center;
    color: white;
    font-size: 1.1rem;
  }
  .choice-description > h2 {
    font-size: 1.2rem;
  }
  .choice-description > p {
    margin-block-start: 0.5rem;
    margin-block-end: 0.5rem;
    font-size: 90%;
  }

  .control-list-wrapper {
    width: 100rem;
  }

  .control-list-wrapper > table {
    color: white;
    margin: 0.5em;
    border-collapse: separate;
    border-spacing: 1rem;
    font-size: 1.5rem;
  }
  #info {
    top: 0em;
    left: 0em;
  }
  #primary-weapon-types {
    width: 2rem;
  }
  #secondary-weapon-types {
    width: 2rem;
  }
  #shield-types {
    width: 2rem;
  }
  #secondary-types {
    width: 2rem;
  }
  #about {
    font-size: 1.2rem;
    color: #6c0;
    text-align: left;
    line-height: 1.4;
    overflow: scroll;
    height: 50vh;
  }
  .changelog-content {
    height: 50vh;
    overflow: scroll;
  }

  .game-over {
    width: 70rem;
  }
}

/* Mobile pad */

@media (max-width: 991px) {
  /* Adjust the max-width breakpoint as needed for your game */
  body {
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* Internet Explorer/Edge */
    user-select: none; /* Standard syntax */
  }
}

#gamepad-dpad {
  opacity: 0.3;
  position: absolute;
  left: 0.1rem;
  bottom: 0.1rem;
  width: 205px;
  height: 205px;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10002;
  --diagonal-offset: 8%;
  --straight-offset: 15%;
}

.dpad-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #ccc;
  position: absolute;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.up {
  top: var(--straight-offset);
}

.down {
  bottom: var(--straight-offset);
}

.left {
  left: var(--straight-offset);
}

.right {
  right: var(--straight-offset);
}

.up-left {
  top: var(--diagonal-offset);
  left: var(--diagonal-offset);
}

.up-right {
  top: var(--diagonal-offset);
  right: var(--diagonal-offset);
}

.down-left {
  bottom: var(--diagonal-offset);
  left: var(--diagonal-offset);
}

.down-right {
  bottom: var(--diagonal-offset);
  right: var(--diagonal-offset);
}

#action-buttons {
  font-size: 1.3rem;
  opacity: 0.3;
  position: absolute;
  right: 0.1rem;
  bottom: 0.1rem;
  width: 205px;
  height: 205px;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10002;
  --diagonal-offset: 8%;
  --straight-offset: 15%;
}

.action-button {
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 1px solid white;
  position: absolute;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.x {
  top: var(--straight-offset);
  color: #0cc;
  border: 2px solid #0cc;
}

.b {
  bottom: var(--straight-offset);
  color: #cc6;
  border: 2px solid #cc6;
}

.y {
  left: var(--straight-offset);
  color: #0c6;
  border: 2px solid #0c6;
}

.a {
  right: var(--straight-offset);
  color: #c06;
  border: 2px solid #c06;
}

.yx {
  display: none;
  top: var(--diagonal-offset);
  left: var(--diagonal-offset);
}

.xa {
  display: none;
  top: var(--diagonal-offset);
  right: var(--diagonal-offset);
}

.ab {
  display: none;
  bottom: var(--diagonal-offset);
  left: var(--diagonal-offset);
}

.by {
  display: none;
  bottom: var(--diagonal-offset);
  right: var(--diagonal-offset);
}
