/* Container to center the carousel */
#avatar {
  display: flex;
  position: relative;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 1.2em;
  text-align: center;
  width: 100vw;
  height: 100vh;
  height: var(--app-height, 100dvh);
}

#avatar h2 {
  color: #fff;
  margin: 0 auto;
  max-width: 950px;
}

/* Carousel wrapper */
.carousel {
  position: relative;
  width: 80vw;
  height: 40vw;
  /* Seitenverhältnis beibehalten */
  perspective: 1000px;
  margin-top: 5%;
}

@media (hover: none), (pointer: coarse) {
  .carousel {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
  }

  .carousel.is-spinning .character {
    transition: none;
  }
}

html.touch-device .carousel {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

html.touch-device #avatar {
  touch-action: none;
}

html.touch-device .carousel.is-spinning .character {
  transition: none;
}

.carousel.is-spinning .character-difficulty-label {
  opacity: 0 !important;
  transition-duration: 100ms;
}

/* Common styles for carousel items */
.character {
  position: absolute;
  /* ...bestehende Eigenschaften... */
  left: 50%;
  top: 35%;
  width: 30%;
  height: 60%;
  overflow: visible;
  transform-origin: center;
  transform: translate(-50%, -50%);
  transition:
    transform 0.5s,
    opacity 0.5s;
}

.character-2 {
  position: relative;
  z-index: 10;
  /* ...bestehende Eigenschaften... */
  transform: translate(-50%, -50%) translateX(0%) scale(1);
  /* Zentrum */
  opacity: 1;
  z-index: 3;
  pointer-events: none;
}

/* Position and style for each carousel item */

.character-2,
.character-4,
.character-6 {
  pointer-events: none;
}

.character-1 {
  transform: translate(-50%, -50%) translateX(-60%) scale(0.8);
  /* Vorne links weiter nach links verschoben */
  opacity: 0.6;
  z-index: 2;
}

.character-2 {
  transform: translate(-50%, -50%) translateX(0%) scale(1);
  /* Zentrum */
  opacity: 1;
  z-index: 3;
  pointer-events: none;
}

.character-3 {
  transform: translate(-50%, -50%) translateX(60%) scale(0.8);
  /* Vorne rechts weiter nach rechts verschoben */
  opacity: 0.6;
  z-index: 2;
}

.character-4 {
  transform: translate(-50%, -50%) translateX(90%) scale(0.5);
  /* Rechts hinten */
  opacity: 0.2;
  z-index: 1;
}

.character-5 {
  transform: translate(-50%, -50%) translateX(0%) translateZ(-200px) scale(0.5);
  /* Hinten zentriert unverändert */
  opacity: 0;
  /* Element unsichtbar */
  z-index: 0;
}

.character-6 {
  transform: translate(-50%, -50%) translateX(-90%) scale(0.5);
  /* Links hinten */
  opacity: 0.2;
  z-index: 1;
}

/* Eigenschaften-Anzeige */
.character-info {
  display: none;
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, 0%);
  text-align: center;
  /* width: 100%; */
  z-index: 10;
  background: #65805d;
  padding: 5px 20px;
  border-radius: 10px;
}

.character-info h2 {
  font-size: 2em;
  margin-bottom: 10px;
}

.character-info p {
  font-size: 1.2em;
  margin: 5px 0;
}

/* Bilder in den Charakter-DIVs */
.character img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s;
}

.character-1 img:hover,
.character-3 img:hover {
  transform: scale(1.03);
}

.character-difficulty-label {
  position: absolute;
  left: 50%;
  top: calc(100% + clamp(130px, 16vw, 280px));
  transform: translateX(-50%);
  font-family: "Wilson", Arial, sans-serif;
  font-size: 1em;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
  background: var(--base-color-dark);
  padding: 5px 10px;
  border-radius: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.character-2 .character-difficulty-label.is-visible {
  opacity: 0.8;
}

/* Beschriftung unter den Bildern */
.character-caption {
  text-align: center;
  margin-top: 5px;
  font-size: 1em;
  color: #333;
}

/* Styling für die Sterne */
.star {
  width: 24px;
  /* Passen Sie die Größe an Ihre Bedürfnisse an */
  height: 24px;
  display: inline-block;
  margin-right: 5px;
  /* Abstand zwischen den Sternen */
  vertical-align: middle;
  filter: grayscale(1) brightness(2);
}

.star:last-child {
  margin-right: 0;
  /* Entfernt den rechten Rand beim letzten Stern */
}

.skill {
  display: flex;
  align-items: center;
  margin: 10px 0px;
}

.skill-icon {
  width: 50px;
  height: 50px;
  margin-right: 5px;
  background-size: contain;
  background-position: center;
  filter: brightness(1.2) grayscale(0.5);
}

/* speed, scare and luck */
.speed .skill-icon {
  background-image: url("../img/scpeed.png");
}

.scare .skill-icon {
  background-image: url("../img/scare.png");
}

.luck .skill-icon {
  background-image: url("../img/luck.png");
}

/* Sprechblase */
.speech-bubble {
  z-index: 1000;
}

#carousel-controls {
  position: absolute;
  bottom: 4%;
  right: 4%;
  display: flex;
  align-items: center;
}

@media (max-width: 900px), (max-height: 650px) {
  #avatar h1 {
    font-size: clamp(52px, 9vw, 86px);
  }

  .carousel {
    width: 92vw;
    height: min(64vw, 72vh);
    margin-top: 8%;
  }

  .character {
    top: 38%;
    width: clamp(190px, 30%, 300px);
    height: 62%;
  }

  .character-difficulty-label {
    top: calc(100% + clamp(80px, 12vw, 150px));
    font-size: clamp(13px, 2vw, 18px);
  }

  #carousel-controls {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}

@media (hover: none), (pointer: coarse) {
  #carousel-controls {
    right: calc(
      env(safe-area-inset-right, 0px) + clamp(22px, 3vw, 36px)
    );
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  #language-switcher {
    margin-top: 0;
    margin-bottom: 0;
  }
}

html.touch-device #carousel-controls {
  right: calc(
    env(safe-area-inset-right, 0px) + clamp(36px, 4vw, 52px)
  );
}
