/* Grundgerüst */
body {
  margin: 0;
  padding: 0;
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  font-family: sans-serif;
  overflow-x: hidden;
}

#wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  max-width: 400px;
  height: auto;
  min-height: 100vh;
  padding: 35px 0 40px 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* TEIL 1: Slogan */
.header-slogan {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 35px;
  flex-shrink: 0;
}

#navManifest {
  width: 90%;
  max-width: 310px;
  height: auto;
}

/* TEIL 2: Farbwähler & Navigation */
.color-nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 350px;
  height: 55px;
  margin-bottom: 25px;
  flex-shrink: 0;
}

.nav-arrow {
  background: none;
  border: none;
  width: 40px;
  cursor: pointer;
}

.nav-arrow img {
  width: 100%;
}

.swipe-picker {
  flex-grow: 1;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin: 0 8px;
}

.color-tile-stack {
  width: 28px;
  height: 28px;
  margin: 0 5px;
}

.color-tile {
  width: 100% !important;
  height: 100% !important;
  border-radius: 4px;
}

.color-tile-stack.active .color-tile {
  border: 2px solid #fff;
  transform: translateY(-2px);
}

/* TEIL 3: Zettelblock (HIER LIEGT DER FIX) */
#stackContainer {
  /* position: relative ist essenziell für die Intro-Elemente! */
  position: relative;
  width: 330px;
  height: 330px;
  min-width: 330px;
  min-height: 330px;
  flex-shrink: 0;
  background-color: #ffff88;
  box-shadow:
    5px 5px 0 #ffccff,
    10px 10px 0 #ccffff;
  margin-bottom: 35px;
  /* overflow: hidden ist wichtig, damit nichts rausguckt */
  overflow: hidden;
}

canvas {
  width: 330px !important;
  height: 330px !important;
  touch-action: none;
  display: block;
}

/* DIE KORREKTUR: Zwingt das Intro in die Mitte */
.intro-element {
  position: absolute;
  /* Top 50% und Left 50% beziehen sich auf die obere linke Ecke des Bildes */
  top: 50%;
  left: 50%;
  /* translate(-50%, -50%) verschiebt das Bild um seine eigene halbe Breite/Höhe zurück -> ECHTE ZENTRIERUNG */
  transform: translate(-50%, -50%);
  width: 280px; /* Feste Breite, passend zum 330px Container */
  height: auto;
  z-index: 10;
  pointer-events: none; /* Klicks gehen durch das Bild hindurch zum Canvas */
  transition: opacity 0.8s ease;
}

/* TEIL 4: Buttons unten */
.controls {
  display: flex;
  justify-content: space-between;
  width: 95%;
  max-width: 360px;
  flex-shrink: 0;
  padding-bottom: 20px;
}

.control-btn {
  background: none;
  border: none;
  width: 75px;
  cursor: pointer;
  padding: 0;
}

.control-btn img {
  width: 100%;
  height: auto;
  display: block;
}

.hidden {
  display: none !important;
}

/* Responsive-Korrektur */
@media (max-height: 720px) {
  #wrapper {
    padding-top: 20px;
  }
  .header-slogan {
    margin-bottom: 20px;
  }
  #stackContainer {
    width: 300px;
    height: 300px;
    min-width: 300px;
    min-height: 300px;
    margin-bottom: 20px;
  }
  canvas {
    width: 300px !important;
    height: 300px !important;
  }
  /* Intro-Größe für kleine Bildschirme anpassen */
  .intro-element {
    width: 250px;
  }
}
