* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #1b0f08; overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
/* iPhone als Web-App: die Seite reicht bis unter Statusleiste und Home-Balken
   (black-translucent). Ohne diesen Abstand läge die Kopfleiste unter der Uhr. */
body {
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#spiel {
  position: relative;
  /* Seitenverhältnis der Spielwelt: 180 x 340 Einheiten */
  --frei-h: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  --frei-b: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
  height: min(var(--frei-h), calc(var(--frei-b) * 340 / 180));
  aspect-ratio: 180 / 340;
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#kopf {
  position: absolute; left: 0; right: 0; top: 0;
  height: calc(100% * 22 / 340);
  padding: 0 2%;
  display: flex; align-items: center; gap: 2%;
  color: #fff3d6; font-weight: 700;
  font-size: min(4.2vw, 2.2dvh);
  text-shadow: 0 1px 2px #000;
}
#stufe { white-space: nowrap; }
#balken {
  flex: 1; height: 55%; position: relative;
  background: #3a2112; border: 2px solid #f0c060; border-radius: 99px; overflow: hidden;
}
#fuellung {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(#bfc4c8, #7d858c); transition: width .2s;
}
#prozent { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 85%; }
#kopf button {
  height: 70%; aspect-ratio: 1; border: 2px solid #f0c060; border-radius: 30%;
  background: #8a3d12; color: #fff; font-size: 100%; padding: 0; cursor: pointer;
}
#schicht {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 8, 2, .55); backdrop-filter: blur(2px);
}
#schicht.weg { display: none; }
.karte {
  width: 84%; padding: 7% 6%; text-align: center; color: #4a2a10;
  background: linear-gradient(#fff6e0, #f2d9a6); border: 4px solid #c8862a; border-radius: 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  font-size: min(4.2vw, 2.2dvh);
}
#s-symbol { font-size: 300%; line-height: 1.2; }
.karte h1 { margin: .3em 0; font-size: 170%; color: #a3261a; }
.karte p { margin: .6em 0 1.2em; line-height: 1.4; }
#s-knopf {
  font: inherit; font-weight: 800; font-size: 130%; color: #fff;
  padding: .6em 1.8em; border: 0; border-radius: 99px; cursor: pointer;
  background: linear-gradient(#5ccf3a, #2f8f1a); box-shadow: 0 4px 0 #1f6010;
}
#s-knopf:active { transform: translateY(3px); box-shadow: 0 1px 0 #1f6010; }
#hammer { position: relative; }
#hammer-zahl {
  position: absolute; right: -25%; bottom: -25%; min-width: 55%; height: 55%;
  border-radius: 99px; background: #c0392b; font-size: 65%; line-height: 1;
  display: flex; align-items: center; justify-content: center; border: 1px solid #fff3d6;
}
#hammer.aktiv { background: #f0c060; box-shadow: 0 0 0 3px #fff3d6, 0 0 14px #ffd36b; }
#hammer:disabled { opacity: .4; }
#hammer.winkt { animation: winken .6s ease-in-out infinite alternate; }
@keyframes winken { from { transform: scale(1); } to { transform: scale(1.18) rotate(-12deg); } }
#heim {
  height: 70%; aspect-ratio: 1; border: 2px solid #f0c060; border-radius: 30%;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  background: #8a3d12; font-size: 100%;
}
