/* style.css */

/* Seite: keine Grid-Center-Fallen, sondern stabil */
html, body{
  height:100%;
}

body{
  margin:0;
  background:#fff;
  color:#000;
  font-family:"Comic Sans MS","Comic Neue","Chalkboard SE","Marker Felt",cursive;
}

/* Outer wrapper, damit wir sauber skalieren können */
.page{
  min-height:100vh;
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:10px;
  box-sizing:border-box;
}

/* Der ganze Inhalt */
.wrap{
  width:min(980px, 96vw);
  background:#fff;
  text-align:center;
  user-select:none;

  /* Skalierung wird per JS gesetzt */
  transform: scale(var(--fitScale, 1));
  transform-origin: top center;
}

/* ===== STAGE ===== */
.stage{
  width:100%;
  max-width: 900px;

  /* WICHTIG: Stage darf nicht alles sprengen */
  aspect-ratio: 1 / 1;
  margin: 0 auto 10px;

  position:relative;
  border-radius:12px;
  overflow:hidden;
  background:#fff;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;

  --armDur: 2.8s;
}

/* PNG Layer exakt übereinander */
.layer{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  pointer-events:none;
}

.is-hidden{
  opacity:0;
  visibility:hidden;
}

/* Arm: Schulter Anker */
.stage.talking .l-arm{
  animation: armWiggle var(--armDur) ease-in-out infinite;
  transform-origin: 42% 46%;
}
.stage.sleeping .l-arm{
  animation:none !important;
}

@keyframes armWiggle{
  0%{ transform: translate(0px,0px) rotate(0deg); }
  40%{ transform: translate(1.5px,0.4px) rotate(-1.4deg); }
  70%{ transform: translate(0.6px,0.2px) rotate(0.8deg); }
  100%{ transform: translate(0px,0px) rotate(0deg); }
}

/* Augenbrauen: minimal im Wachmodus */
.stage.talking .l-brow-left,
.stage.talking .l-brow-right{
  animation: browBob 1.9s ease-in-out infinite;
}
@keyframes browBob{
  0%{ transform: translateY(0px); }
  50%{ transform: translateY(-3px); }
  100%{ transform: translateY(0px); }
}

/* Schlaf: Augenbrauen etwas höher und still */
.stage.sleeping .l-brow-left,
.stage.sleeping .l-brow-right{
  animation:none !important;
  transform: translateY(-4px);
}

/* FX */
.fx-layer{
  position:absolute;
  inset:0;
  pointer-events:none;
  overflow:visible;
}
.fx{
  position:absolute;
  left:50%;
  top:38%;
  transform: translate(-50%,-50%) scale(1);
  font-weight:900;
  letter-spacing:0.5px;
  color:#000;
  opacity:0;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.9));
  white-space:nowrap;
  will-change: transform, opacity;
}
@keyframes fxPop{
  0%{ opacity:0; transform: translate(var(--dx), var(--dy)) scale(var(--s)); }
  15%{ opacity:1; }
  100%{ opacity:0; transform: translate(calc(var(--dx) + var(--vx)), calc(var(--dy) + var(--vy))) scale(var(--s)); }
}

/* Hint */
.hint{
  margin: 2px 0 10px;
  font-size:14px;
  font-weight:700;
}
.hint span{
  display:inline-block;
  padding:6px 10px;
  border:2px solid #000;
  border-radius:999px;
}

/* ===== Counter ===== */
.top{
  font-size:22px;
  font-weight:700;
  margin: 10px 0 10px;
}
.bottom{
  margin-top:12px;
  font-size:20px;
  font-weight:700;
}

.grid{
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  align-items:end;
  justify-items:center;
  margin: 0 auto;
  max-width: 900px;
}

.num{
  font-size:24px;
  font-weight:700;
  line-height:1;
  letter-spacing:0.5px;
  width:100%;
}

.lab{
  margin-top:6px;
  font-size:16px;
  line-height:1;
  letter-spacing:0.4px;
  width:100%;
}

/* Bounce */
@keyframes comicBounce {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(1px) scale(1.025); }
  70%  { transform: translateY(-1px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}
.bounce .num{
  animation: comicBounce 180ms cubic-bezier(.2,.9,.2,1) 1;
  transform-origin:center;
}

/* Progress */
.progress{
  max-width: 900px;
  margin: 14px auto 0;
  text-align:center;
}
.progress-label{
  font-size:16px;
  font-weight:700;
  margin-bottom:8px;
}
.bar{
  height:16px;
  border:2px solid #000;
  border-radius:999px;
  overflow:hidden;
  background:#fff;
}
.fill{
  height:100%;
  width:0%;
  background:#000;
}
.progress-small{
  margin-top:8px;
  font-size:14px;
  font-weight:700;
}

/* Buttons */
.btn-row{
  margin-top:14px;
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}
.btn{
  font-family: inherit;
  font-size:18px;
  font-weight:700;
  padding:10px 18px;
  border:2px solid #000;
  background:#fff;
  color:#000;
  border-radius:999px;
  cursor:pointer;
}
.btn:active{ transform: translateY(1px); }

/* Tablet */
@media (max-width: 720px){
  .grid{ grid-template-columns: repeat(3, 1fr); max-width: 560px; }
  .progress{ max-width:560px; }
}

/* Phones */
@media (max-width: 420px){
  .wrap{ width:96vw; }
  .top{ font-size:20px; }
  .bottom{ font-size:18px; }
  .lab{ font-size:14px; }
  .grid{ gap: 8px; }
  .btn{ font-size:16px; padding:10px 16px; }
  .progress-label{ font-size:14px; }
  .progress-small{ font-size:13px; }
}
.hint{
  margin: 2px 0 10px;
  font-size:14px;
  font-weight:700;
}

.hint a{
  display:inline-block;
  padding:6px 10px;
  border:2px solid #000;
  border-radius:999px;
  text-decoration:none;
  color:#000;
}
