#panorama {
  cursor: var(--cursor-none);
}

/* Nur den scrollbaren Hintergrund (nicht die navicon-Schaltfläche) hart auf none setzen */
#pano,
#pano * {
  cursor: var(--cursor-none);
}

/* navicon.check erbt den Cursor von #panorama */
#panorama .navicon {
  cursor: var(--cursor-none);
}

#custom-cursor {
  width: 25%;
  /* Größe des benutzerdefinierten Cursors */
  height: 50%;
  position: absolute;
  pointer-events: none;
  /* Verhindert, dass der Cursor Klicks blockiert */
  background-image: url("../img/magic-wand.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  /* Bildgröße auf die Div-Größe skalieren */
  transform-origin: center;
  /* Transformationszentrum auf die Mitte setzen */
  z-index: 1000;
  /* Sicherstellen, dass der Cursor über allen anderen Elementen liegt */
  /* Schatten für den Cursor hinzufügen */
}

#custom-cursor.mousedown {
  /*background-image: url("img/avatar/cursor/fox-click.png");*/
  width: 25%;
  /* Gleiche Größe wie normaler Cursor */
  height: 50%;
  background-image: url("../img/magic-wand-active.png");
  /* Gleicher Schatten wie normaler Cursor */
}

#panorama {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  touch-action: none;
  overscroll-behavior: none;
}

#pano {
  filter: saturate(0.9) hue-rotate(351deg);
  position: absolute;
  top: 0;
  display: flex;
  width: 400vh;
  width: 400dvh;
  /* Das Hintergrundbild wird jetzt dynamisch per JS gesetzt */
  /* background-image: url(../img/pano/pano-1.png); */
  background-size: contain;
  background-position: top;
  background-repeat: no-repeat;
  background-color: #a3c67b;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  width: 16.5%;
  background-size: auto 100%;
  transition: filter 0.2s;
  flex-direction: column;
}

.tile.brighten {
  filter: brightness(1.5);
}

#pano .tile p {
  opacity: 0;
  margin-bottom: 5%;
  background-color: #fff;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 20px;
  color: #638b58;
  font-weight: bold;
  transition: opacity 1s;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
}

#pano .tile:hover p {
  opacity: 1;
}

#pano .tile:hover .values {
  opacity: 1;
}

.values {
  background-color: #fff;
  border-radius: 5px;
  margin: 7%;
  display: flex;
  padding: 2px;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2);
  gap: 2px;
  align-items: flex-end;
  position: relative;
  overflow: visible;
}
#pano .values {
  border-radius: 10px;
}

.values > div {
  background-color: #d0dcca;
  border-radius: 3px;
  height: 75px;
  width: 33px;
  margin: 2px;
  overflow: hidden;
  position: relative;
}

#pano .values > div {
  border-radius: 6px;
}

.values .co2 div {
  position: absolute;
  width: 100%;
  bottom: 0;
  background: var(--co2-bar-positive);
  transition: height 0.5s ease-in-out;
}

.values .food div {
  position: absolute;
  width: 100%;
  bottom: 0;
  background: #75a168;
  transition: height 0.5s ease-in-out;
}

.values .co2.negative div {
  background: var(--co2-bar-negative);
}

#pano .values {
  margin-bottom: 1%;
  opacity: 1;
  transition: opacity 1s;
  flex-direction: row;
  align-items: stretch;
  padding: 4px 3px 2px 3px;
}

/* Column wrappers for bars + labels */
.values .co2-col,
.values .food-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  position: relative;
}

#pano .values .co2,
#pano .values .food {
  height: 75px;
  width: 33px;
}

/* Permanente Labels für Panorama-Bars */
.values .bar-label {
  font-size: 9px;
  font-weight: bold;
  color: #638b58;
  text-align: center;
  white-space: nowrap;
  line-height: 1;
  margin-top: 1px;
  font-family: "Wilson Medium", Arial, sans-serif;
}

/* Custom Tooltips für Panorama Values aktivieren */
#pano .values .co2,
#pano .values .food {
  cursor: var(--cursor-none);
}

.paused #pano .values .co2,
.paused #pano .values .food {
  cursor: var(--cursor-none);
}

.paused #panorama {
  cursor: var(--cursor-none);
}

.paused #custom-cursor {
  display: none !important;
}

#panorama .navicon {
  position: absolute;
  z-index: 100;
  top: var(--ui-top-offset);
  right: 4%;
}

@media (hover: none), (pointer: coarse) {
  #custom-cursor {
    display: none !important;
    width: clamp(204px, 26.4vw, 264px) !important;
    height: clamp(376px, 48.6vw, 486px) !important;
    transform-origin: 50% 78%;
  }

  #custom-cursor.touch-feedback {
    display: block !important;
    width: clamp(204px, 26.4vw, 264px) !important;
    height: clamp(376px, 48.6vw, 486px) !important;
    background-image: url("../img/magic-wand.png");
    animation: touch-wand-feedback 380ms linear both;
  }

  #custom-cursor.touch-feedback::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("../img/magic-wand-active.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    pointer-events: none;
    animation: touch-wand-glow 380ms ease-out both;
  }

  #panorama .tile p,
  #panorama .tile .values {
    opacity: 1;
  }

  #pano .tile p {
    max-width: 85%;
    margin-bottom: 0;
    padding: 5px 9px;
    font-size: clamp(14px, 2.2vw, 19px);
    text-align: center;
  }

  #pano .tile {
    padding-bottom: calc(
      env(safe-area-inset-bottom, 0px) + clamp(14px, 2dvh, 24px)
    );
  }

  #pano .values {
    margin-top: clamp(8px, 1.5dvh, 16px);
    margin-bottom: clamp(6px, 1dvh, 12px);
  }

  #panorama .navicon {
    top: max(12px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }

  #panorama.is-touch-panning .tile {
    pointer-events: none;
  }
}

@keyframes touch-wand-feedback {
  0% {
    opacity: 1;
  }

  99% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes touch-wand-glow {
  0%,
  32% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@media (max-width: 900px), (max-height: 650px) {
  #pano {
    width: max(360vw, 400vh);
    width: max(360vw, 400dvh);
  }

  #panorama .navicon {
    width: clamp(54px, 8vw, 68px);
    height: clamp(54px, 8vw, 68px);
    font-size: clamp(2rem, 5vw, 2.8rem);
  }

  #pano .values .co2,
  #pano .values .food {
    width: clamp(22px, 4vw, 30px);
    height: clamp(48px, 10vh, 68px);
  }
}
