:root{
  --scene-max: 900px;

  --win-left: 8%;
  --win-top: 7%;
  --win-width: 84%;
  --win-height: 62%;

  --bubble-bg: rgba(255,255,255,0.85);
}

*{ box-sizing: border-box; }

html, body{
  width: 100%;
  height: 100%;
}

body{
  margin: 0;
  background: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

.page{
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.scene{
  position: relative;
  width: min(100vmin, 100vw, 100vh, var(--scene-max));
  height: min(100vmin, 100vw, 100vh, var(--scene-max));
  aspect-ratio: 1 / 1;
  background: #fff;
  overflow: visible;
}

.layer{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.bg{ z-index: 1; }
.window-frame{ z-index: 5; }

/* Wolke: vor Hintergrund, blendet ein/aus, pendelt links/rechts */
.cloud{
  z-index: 2;
  pointer-events: none;
  animation: cloudDrift 45s linear infinite alternate;
}

/* Schatten: unter Vase, schwingt träger als Pflanze */
.shadow{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 17; /* unter Vase */
  transform-origin: 50% 100%;
  animation: plantSway 16s ease-in-out infinite;
  pointer-events: none;
}

.window-viewport{
  position: absolute;
  left: var(--win-left);
  top: var(--win-top);
  width: var(--win-width);
  height: var(--win-height);
  overflow: hidden;
  z-index: 3; /* VÖGEL vor Hintergrund, aber hinter Fensterrahmen */
  pointer-events: none;
}

/* feste Vogel-Slots im Fenster */
.bird-slot{
  position: absolute;
  top: 18%;
  left: -30%;
  width: 18%;
  height: auto;
  opacity: 0;
  transform: translateX(-200%);
  will-change: transform;
  user-select: none;
  pointer-events: none;
}

.pot{ z-index: 18; }
.soil{ z-index: 19; }

.plant{
  z-index: 20;
  transform-origin: 50% 100%;
  animation: plantSway 12s ease-in-out infinite;
}

.mouth{ z-index: 21; }

.eyes{ z-index: 22; }
.eyes-open{ opacity: 1; }
.eyes-closed{ opacity: 0; }

/* Quote-Bereich */
.quote{
  position: absolute;
  left: 50%;
  top: calc(var(--win-top) + 5%);
  transform: translate(-50%, -50%);
  z-index: 4;
  width: min(72%, 560px);
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Große Gedankenblase (Textblase) */
.quote-bubble{
  background: var(--bubble-bg);
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.10);
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  position: relative;
}

/* Große Blase kommt nach den 3 Vorbläschen + schwebt minimal */
.quote-bubble.show{
  animation: bubbleBigIn 450ms ease forwards, bubbleFloat 6s ease-in-out infinite;
  animation-delay: 0.85s, 1.6s;
}

/* Text soll erst nach der großen Blase erscheinen */
.quote-text{
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.25;
  color: #111;
  opacity: 0;
}

.quote.show .quote-text{
  animation: quoteTextIn 350ms ease forwards;
  animation-delay: 1.15s;
}

/* Gedankenbläschen als echte Elemente (d1 klein -> d2 mittel -> d3 größer)
   Hinweis: Diese Elemente müssen in index.html existieren:
   <span class="thought-dot d1"></span>
   <span class="thought-dot d2"></span>
   <span class="thought-dot d3"></span>
*/
.thought-dot{
  position: absolute;
  left: 50%;
  top: 100%;
  border-radius: 50%;
  opacity: 0;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transform: translateX(-50%) translateY(0) scale(0.6);
  pointer-events: none;
}

/* 1) klein */
.thought-dot.d1{
  width: 8px;
  height: 8px;
  margin-top: 28px;
  margin-left: -10px;
}

/* 2) mittel */
.thought-dot.d2{
  width: 14px;
  height: 14px;
  margin-top: 16px;
  margin-left: 10px;
}

/* 3) größer */
.thought-dot.d3{
  width: 20px;
  height: 20px;
  margin-top: 2px;
  margin-left: 0px;
}

/* Reihenfolge: klein -> mittel -> größer, danach große Blase, dann Text */
.quote.show .thought-dot.d1{
  animation: dotIn 260ms ease forwards, dotFloat 5.5s ease-in-out infinite;
  animation-delay: 0.05s, 1.2s;
}

.quote.show .thought-dot.d2{
  animation: dotIn 260ms ease forwards, dotFloat 6.3s ease-in-out infinite;
  animation-delay: 0.30s, 1.25s;
}

.quote.show .thought-dot.d3{
  animation: dotIn 260ms ease forwards, dotFloat 7.1s ease-in-out infinite;
  animation-delay: 0.55s, 1.3s;
}

@media (max-width: 520px){
  .quote{
    top: calc(var(--win-top) + 4%);
    width: 86%;
    z-index: 25;
  }
}

/* Animationen */
@keyframes cloudDrift{
  0%{
    opacity: 0;
    transform: translateY(-10%) translateX(-15%) scale(0.5);
  }
  15%{ opacity: 0.6; }
  85%{ opacity: 0.6; }
  100%{
    opacity: 0;
    transform: translateY(-10%) translateX(15%) scale(0.5);
  }
}

@keyframes bubbleBigIn{
  from{ opacity: 0; transform: translateY(10px) scale(0.96); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bubbleFloat{
  0%,100%{ transform: translateY(0) scale(1); }
  50%{ transform: translateY(-3px) scale(1.01); }
}

@keyframes dotIn{
  from{ opacity: 0; transform: translateX(-50%) translateY(0) scale(0.6); }
  to{ opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes dotFloat{
  0%,100%{ transform: translateX(-50%) translateY(0) scale(1); }
  50%{ transform: translateX(-50%) translateY(-2px) scale(1.02); }
}

@keyframes quoteTextIn{
  from{ opacity: 0; transform: translateY(4px); }
  to{ opacity: 1; transform: translateY(0); }
}

@keyframes plantSway{
  0%   { transform: rotate(-1deg); }
  50%  { transform: rotate(1deg); }
  100% { transform: rotate(-1deg); }
}

