/* #region Reset & Typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  font-size: 62.5%;
  font-family: "Rye", sans-serif;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: 0.1rem;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  background-image: url("assets/img/5_background/Background.png");
}

h1 {
  text-align: center;
  font-size: 5.5rem;
  color: black;
}

h2 {
  font-size: 2.3rem;
}
/* #endregion Reset & Typography */

/* #region Canvas & Wrapper */
canvas {
  display: block;
  background-color: black;
}

#wrapper {
  position: relative;
  margin: 0 auto;
  width: min(95vw, 720px);
  aspect-ratio: 3 / 2;
  height: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* #endregion Canvas & Wrapper */

/* #region UI Base */
.desktop-buttons {
  display: flex;
  flex-direction: row;
  gap: 5rem;
}

.mobile-buttons {
  pointer-events: none;
}
.mobile-buttons .icon {
  pointer-events: auto;
}

.button {
  font-family: "Rye", sans-serif;
  border: rgb(60, 60, 60) solid 0.1rem;
  border-radius: 0.5rem;
  background-color: rgb(234, 200, 89);
  padding: 1rem 2rem;
  font-size: 1.8rem;
  cursor: pointer;
}
.button:hover {
  background-color: rgb(158, 134, 1);
}

table {
  background-color: rgba(76, 40, 13, 0.4);
  border-radius: 0.5rem;
  border: 0.1rem solid black;
  border-collapse: collapse;
  margin-bottom: 2rem;

  th,
  td {
    padding: 8px 12px;
    font-size: 1.8rem;
    font-weight: 500;
  }
}

.icon {
  width: 4rem;
  height: 4rem;
  border: 0.1rem solid rgb(255, 255, 255);
  border-radius: 3rem;
  color: #d3c726;
}

.icon:hover {
  color: #ffffff;
}

.strg-icon-mobile {
  width: 2.5rem;
  height: 2.5rem;
  border: 0.1rem solid rgb(255, 255, 255);
  border-radius: 3rem;
  color: #d3c726;
}

.loading-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.4rem;
  font-size: 1.6rem;
  background: rgba(0, 0, 0, 0.7);
  color: #ffdd33;
  border: 0.1rem solid #ffdd33;
  border-radius: 0.5rem;
  display: none;
  pointer-events: none;
  z-index: 150;
}
/* #endregion UI Base */

/* #region Music Toggle */
.music-toggle {
  position: absolute;
  top: 2rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.music-toggle:focus-visible {
  outline: 0.2rem solid rgba(255, 255, 255, 0.7);
  outline-offset: 0.2rem;
}

.music-icon {
  width: 2.6rem;
  height: 2.6rem;
  pointer-events: none;
}

#music-toggle-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  padding: 0;
  background: transparent;
  border: 0.1rem solid rgb(255, 255, 255);
  border-radius: 3rem;
  color: #d3c726;
  pointer-events: auto;
  flex-shrink: 0;
}

#music-toggle-mobile:hover {
  color: #ffffff;
}

#music-toggle-mobile .music-icon {
  width: 2.4rem;
  height: 2.4rem;
}
/* #endregion Music Toggle */

/* #region Overlays & Alerts */
.rotate-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  z-index: 2000;
}

.rotate-device-content {
  max-width: 32rem;
  font-size: 2rem;
  line-height: 1.4;
}
/* #endregion Overlays & Alerts */

/* #region Gamestate Screens */
.screen {
  padding: 2rem 0;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

#start-screen {
  background-image: url("assets/img/9_intro_outro_screens/start/startscreen_1.png");
}

#gameover-screen {
  background-size: 80% 80%;
  background-image: url("assets/img/won,lost/Game Over.png");
  background-color: black;
  z-index: 100;
}

#winning-screen {
  background-size: 80% 80%;
  background-image: url("assets/img/won,lost/You Win A.png");
  background-color: black;
  z-index: 100;
}

#impressum-screen {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: url("assets/img/5_background/second_half_background.png");

  .impressum-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background-color: rgba(76, 40, 13, 0.4);
    border-radius: 0.5rem;
    border: 0.1rem solid black;
    font-size: 1.8rem;

    div {
      width: 100%;
    }

    .info-text {
      text-align: start;
    }
  }
}

#control-setting-screen {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: url("assets/img/5_background/second_half_background.png");
}
/* #endregion Gamestate Screens */

/* #region Smartphone Base */
.mobile-buttons {
  display: none;
}

.table-mobile {
  display: none;
}
/* #endregion Smartphone Base */

/* #region Media: max-width 1200px */
@media only screen and (max-width: 1200px) {
  /* Hide mobile quick actions during Impressum and start screens */
  #impressum-screen.is-visible ~ .mobile-buttons .general-box,
  #impressum-screen.is-visible ~ .mobile-buttons #music-toggle-mobile {
    display: none !important;
  }

  #start-screen.is-visible ~ .mobile-buttons .move-box-left,
  #start-screen.is-visible ~ .mobile-buttons .move-box-right {
    display: none !important;
  }

  /* Hide desktop toggle in menu; allow when game runs */
  .music-toggle {
    display: none;
  }

  body.is-playing .music-toggle {
    display: flex;
  }

  /* Hide general-box during gameplay */
  .is-playing .mobile-buttons .general-box {
    display: none !important;
  }

  .desktop-buttons {
    display: none;
  }

  .overlay {
    align-items: flex-end;
  }

  .mobile-buttons {
    display: block;
    position: absolute;
    inset: 0;

    .general-box {
      position: absolute;
      top: 1rem;
      right: 1.6rem;
      display: flex;
      gap: 1.5rem;
    }

    .move-box-left {
      position: absolute;
      bottom: 1rem;
      left: 1.6rem;
      display: flex;
      gap: 2rem;
    }

    .move-box-right {
      position: absolute;
      bottom: 1rem;
      right: 1.6rem;
      display: flex;
      gap: 2rem;
    }
  }

  #music-toggle-mobile {
    display: flex;
  }

  .title {
    display: none;
  }

  canvas {
    width: 100%;
    height: 100%;
  }

  .table-desktop {
    display: none;
  }

  .table-mobile {
    display: flex;
  }
}
/* #endregion Media: max-width 1200px */

/* #region Media: landscape max-height 500px */
@media only screen and (orientation: landscape) and (max-height: 500px) {
  #impressum-screen.is-visible ~ .mobile-buttons .general-box,
  #impressum-screen.is-visible ~ .mobile-buttons #music-toggle-mobile {
    display: none !important;
  }

  #start-screen.is-visible ~ .mobile-buttons .move-box-left,
  #start-screen.is-visible ~ .mobile-buttons .move-box-right {
    display: none !important;
  }

  .music-toggle {
    display: none;
  }

  body.is-playing .music-toggle {
    display: flex;
  }

  .is-playing .mobile-buttons .general-box {
    display: none !important;
  }

  .desktop-buttons {
    display: none;
  }

  .overlay {
    align-items: flex-end;
  }

  .mobile-buttons {
    display: block;
    position: absolute;
    inset: 0;

    .general-box {
      position: absolute;
      top: 1rem;
      right: 1.6rem;
      display: flex;
      gap: 1.5rem;
    }

    .move-box-left {
      position: absolute;
      bottom: 1rem;
      left: 1.6rem;
      display: flex;
      gap: 2rem;
    }

    .move-box-right {
      position: absolute;
      bottom: 1rem;
      right: 1.6rem;
      display: flex;
      gap: 2rem;
    }
  }

  #music-toggle-mobile {
    display: flex;
  }

  .title {
    display: none;
  }

  .table-desktop {
    display: none;
  }

  .table-mobile {
    display: flex;
  }
}
/* #endregion Media: landscape max-height 500px */

/* #region Media: shared tweaks (<=1200px or landscape<=500px) */
@media only screen and (max-width: 1200px),
  only screen and (orientation: landscape) and (max-height: 500px) {
  .music-toggle {
    position: fixed;
    top: 1rem;
    left: auto;
    right: 18rem;
    width: 4rem;
    height: 4rem;
  }

  .music-icon {
    width: 2.2rem;
    height: 2.2rem;
  }

  #music-toggle-mobile .music-icon {
    width: 2.2rem;
    height: 2.2rem;
  }
}
/* #endregion Media: shared tweaks */

/* #region Media: max-height 480px */
@media only screen and (max-height: 480px) {
  .title {
    display: none;
  }

  #wrapper {
    width: 100vw;
    height: 100dvh;
  }
}
/* #endregion Media: max-height 480px */

/* #region Media: max-width 1200px landscape */
@media only screen and (max-width: 1200px) and (orientation: landscape) {
  body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }

  #wrapper {
    width: 100vw;
    height: 100vh;
  }
}
/* #endregion Media: max-width 1200px landscape */

/* #region Media: portrait fallback */
@media only screen and (max-width: 1024px) and (orientation: portrait) {
  #wrapper {
    display: none;
  }

  .rotate-overlay {
    display: flex;
  }
}
/* #endregion Media: portrait fallback */
