* {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

body {
  font-family: "Poppins", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: url("Imgs/3. Background/Legacy/Dark/2.png") no-repeat center
    center/cover;
  color: white;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

#startscreen {
  position: absolute;
  z-index: 3000;
  width: 100%;
  height: 100vh;
  background: url("Imgs/3. Background/Legacy/Dark/1.png") no-repeat center
    center/cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#startscreen h1 {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
}

#startscreen button {
  font-family: "Poppins", sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  padding: 15px;
  width: 220px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  margin: 10px;
  transition: 0.3s ease-in-out;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

#startscreen button:hover {
  background: #0077ff;
  color: white;
  transform: scale(1.1);
  box-shadow: 0px 0px 15px rgba(2, 209, 255, 0.7);
}

#startscreen button::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 4px;
  background: rgb(0, 157, 255);
  left: 0;
  bottom: 0;
  transform: scaleX(0);
  transition: transform 0.3s ease-in-out;
}

#startscreen button:hover::after {
  transform: scaleX(1);
}

#canvas {
  background-color: black;
  display: none;
  border: 2px solid white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 3000;
  display: none;
}

#popup-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 400px;
  background: white;
  border-radius: 10px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  padding: 20px;
  text-align: center;
  z-index: 3001;
  display: none;
}

#popup-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #333;
  margin-bottom: 15px;
}

#popup-content p {
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  margin: 10px 0;
}

#close-popup {
  background: none;
  border: none;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  left: 10px;
}

#game-container {
  position: relative;
  display: inline-block;
  width: 720px;
  height: 480px;
  margin: 0 auto;
}

#canvas {
  background-color: black;
  border: 2px solid white;
}

#game-container:fullscreen {
  width: 100vw;
  height: 100vh;
}

#game-container:fullscreen #canvas {
  width: 90%;
  height: 90%;
}

#fullscreen-btn {
  position: absolute;
  bottom: 10px;
  right: 40px;
  width: 20px;
  height: auto;
  cursor: pointer;
  filter: brightness(0) invert(1);
  border-radius: 3px;
  padding: 2px;
  transition: transform 0.2s ease;
  z-index: 10;
}

#fullscreen-btn:hover {
  transform: scale(1.1);
}

#sound-toggle {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 20px;
  height: auto;
  cursor: pointer;
  filter: brightness(0) invert(1);
  border-radius: 3px;
  padding: 2px;
  transition: transform 0.2s ease;
  z-index: 10;
}

#game-over-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
}

#game-over-content {
  position: relative;
  text-align: center;
  color: white;
  z-index: 2001;
}

#game-over-content h1 {
  font-size: 50px;
  margin-bottom: 20px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
}

.game-over-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.game-over-buttons button {
  font-size: 20px;
  padding: 10px 20px;
  cursor: pointer;
  background: linear-gradient(45deg, #0077ff, #00aaff);
  border: none;
  border-radius: 5px;
  color: white;
  text-transform: uppercase;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.game-over-buttons button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

#win-screen {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 720px !important;
  height: 480px !important;
  transform: translate(-50%, -50%);
  z-index: 2000;
  display: none;
  box-sizing: border-box;
  background: transparent;
}

#win-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

#win-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

#win-content img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.win-buttons {
  position: absolute;
  right: 140px;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 2001;
}

.win-buttons button {
  font-size: 20px;
  padding: 10px 20px;
  cursor: pointer;
  background: linear-gradient(45deg, #0077ff, #00aaff);
  border: none;
  border-radius: 5px;
  color: white;
  text-transform: uppercase;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.win-buttons button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

#mobile-message,
#on-screen-controls {
  display: none;
}

@media only screen and (max-width: 500px) {
  html,
  body {
    overflow: hidden;
  }
  #mobile-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 105vh;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 3000;
    padding: 20px;
    text-align: center;
  }
  .mobile-message-top,
  .mobile-message-bottom {
    font-size: 1.5em;
  }
  .mobile-message-middle img {
    max-width: 80%;
    height: auto;
    animation: rotate 3s linear infinite;
  }
  @keyframes rotate {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
  .mobile-message-middle img {
    max-width: 80%;
    height: auto;
    animation: rotate 3s linear infinite;
    filter: brightness(0) invert(1);
  }
  .mobile-message-bottom {
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
    padding: 10px;
  }
}

@media (min-width: 500px) and (max-width: 1366px) {
  #on-screen-controls {
    display: block;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    z-index: 2000;
    pointer-events: auto;
  }
  #joystick-container {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
  }
  #joystick {
    width: 100%;
    height: 100%;
    background: url("Imgs/7. Other/joystick.png") no-repeat center center;
    background-size: contain;
    filter: brightness(0) invert(1);
  }
  #attack-buttons {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    pointer-events: auto;
  }
  #attack-buttons button {
    width: 80px;
    height: 80px;
    background: none;
    border: none;
    padding: 0;
    pointer-events: auto;
  }
  #attack-buttons button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* Für Smartphones im Landscape-Modus */
@media only screen and (max-width: 500px) and (orientation: landscape) {
  #canvas {
    width: 100vw;
    height: auto;
    max-height: 100vh;
    border: none;
    transform: none;
  }
  #game-container {
    width: 100vw;
    height: 10ß0vh;
    margin: 0;
    overflow: hidden;
  }
  #sound-toggle {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 30px;
    height: auto;
    z-index: 1000;
  }
}

@media only screen and (max-width: 1023px) and (orientation: landscape) {
  #game-container {
    position: initial;
    display: initial;
    width: initial;
    height: initial;
    margin: initial;
  }

  #canvas {
    width: 90%;
    height: 90%;
  }

  #on-screen-controls {
    display: flex;
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    z-index: 2000;
    pointer-events: auto;
  }

  #joystick-container {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    touch-action: none;
  }
  #joystick {
    width: 100%;
    height: 100%;
    background: url("Imgs/7. Other/joystick.png") no-repeat center center;
    background-size: contain;
    filter: brightness(0) invert(1);
  }
  #attack-buttons {
    position: absolute;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    pointer-events: auto;
  }
  #attack-buttons button {
    width: 80px;
    height: 80px;
    background: none;
    border: none;
    padding: 0;
    pointer-events: auto;
  }
  #attack-buttons button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}
