/* Kinder-Oberfläche: Bauklötze auf dem Spielteppich */
@font-face { font-family: "Schola"; src: url("fonts/texgyreschola-regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Schola"; src: url("fonts/texgyreschola-bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
  --himmel: #BFE3F0;
  --himmel-tief: #9DD1E6;
  --tinte: #1E2B4A;
  --papier: #FFFFFF;
  --sonne: #FFB020;
  --nacht: #22305A;
  --rand: 3px;
  --schatten: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Schola", "Century Schoolbook", Georgia, serif;
  color: var(--tinte);
  background: var(--himmel);
  background-image: radial-gradient(var(--himmel-tief) 1.5px, transparent 1.5px);
  background-size: 28px 28px;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--sonne); outline-offset: 4px; }

.buehne { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; }

/* Kopfzeile */
.kopf { display: flex; align-items: center; gap: 18px; margin-bottom: 36px; flex-wrap: wrap; }
.gruss { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 260px; }
.gruss .avatar { width: 76px; height: 76px; font-size: 44px; }
.gruss h1 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.chip {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px 10px 12px;
  background: var(--papier); border: var(--rand) solid var(--tinte); border-radius: 999px;
  font-size: 20px; font-weight: 700; box-shadow: 3px 3px 0 var(--tinte);
}
.chip .gross { font-size: 28px; line-height: 1; }
a.chip:active, button.chip:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--tinte); }

/* Avatar-Klotz */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  background: var(--farbe, var(--sonne)); border: var(--rand) solid var(--tinte); border-radius: 22px;
  box-shadow: 4px 4px 0 var(--tinte);
}

/* Bereiche */
.bereich { margin-top: 30px; }
.bereich h2 { font-size: 30px; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.bereich h2 span { font-size: 32px; }

/* Die Kacheln: Bauklötze */
.kloetze { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 26px; }
.klotz {
  display: flex; flex-direction: column; border: var(--rand) solid var(--tinte); border-radius: 20px;
  background: var(--papier); box-shadow: var(--schatten) var(--schatten) 0 var(--tinte); overflow: hidden;
  transition: transform .08s ease, box-shadow .08s ease;
}
.klotz .bild {
  background: var(--farbe); aspect-ratio: 4 / 3; display: grid; place-items: center;
  font-size: clamp(56px, 7vw, 80px); border-bottom: var(--rand) solid var(--tinte);
}
.klotz .name { padding: 12px 12px 14px; font-size: 22px; font-weight: 700; text-align: center; line-height: 1.15; }
.klotz:active { transform: translate(var(--schatten), var(--schatten)); box-shadow: 0 0 0 var(--tinte); }

/* Profilwahl */
.wahl { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 32px; }
.wahl h1 { font-size: clamp(40px, 6vw, 64px); margin: 0 0 40px; font-weight: 700; }
.profile { display: flex; gap: 36px; flex-wrap: wrap; justify-content: center; }
.profil { display: flex; flex-direction: column; align-items: center; gap: 14px; font-size: 28px; font-weight: 700; }
.profil .avatar { width: 150px; height: 150px; font-size: 88px; border-radius: 36px; box-shadow: 8px 8px 0 var(--tinte); }
.profil:active .avatar { transform: translate(8px, 8px); box-shadow: 0 0 0 var(--tinte); }
.leer-hinweis { font-size: 24px; max-width: 28ch; margin: 0 auto; line-height: 1.4; }

/* PIN */
.pin { display: grid; justify-items: center; gap: 22px; }
.punkte { display: flex; gap: 16px; height: 30px; }
.punkte i { width: 26px; height: 26px; border-radius: 50%; border: var(--rand) solid var(--tinte); background: var(--papier); }
.punkte i.voll { background: var(--tinte); }
.tasten { display: grid; grid-template-columns: repeat(3, 96px); gap: 16px; }
.tasten button {
  height: 96px; font-size: 40px; font-weight: 700; background: var(--papier); cursor: pointer;
  border: var(--rand) solid var(--tinte); border-radius: 24px; box-shadow: 5px 5px 0 var(--tinte);
}
.tasten button:active { transform: translate(5px, 5px); box-shadow: 0 0 0 var(--tinte); }
.tasten .still { background: transparent; border-color: transparent; box-shadow: none; font-size: 30px; }
.fehler-text { font-size: 22px; color: #B3261E; min-height: 1.4em; margin: 0; }
.zurueck { font-size: 22px; text-decoration: underline; text-underline-offset: 4px; }

/* Pause: Nacht */
body.nacht { background: var(--nacht); background-image: radial-gradient(#3A4A7A 1.5px, transparent 1.5px); color: #FFF6E0; }
.pause { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 18px; padding: 32px; }
.mond { font-size: 140px; line-height: 1; }
.pause h1 { font-size: clamp(40px, 6vw, 64px); margin: 0; font-weight: 700; }
.pause p { font-size: 28px; margin: 0; }
.pause .chip { color: var(--tinte); justify-self: center; margin-top: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .mond { animation: schaukeln 4s ease-in-out infinite; }
  @keyframes schaukeln { 50% { transform: rotate(-8deg); } }
}

/* Sparkässeli */
.kasse { display: grid; gap: 26px; }
.topf {
  background: var(--papier); border: var(--rand) solid var(--tinte); border-radius: 28px;
  box-shadow: var(--schatten) var(--schatten) 0 var(--tinte); padding: 26px 30px; display: flex; align-items: center; gap: 24px;
}
.topf .muenze { font-size: 84px; line-height: 1; }
.topf .betrag { font-size: clamp(48px, 7vw, 76px); font-weight: 700; line-height: 1; }
.topf .betrag small { font-size: .45em; margin-right: .2em; }
.ziel { background: var(--papier); border: var(--rand) solid var(--tinte); border-radius: 22px; padding: 18px 22px; box-shadow: 4px 4px 0 var(--tinte); }
.ziel .zeile { display: flex; align-items: center; gap: 14px; font-size: 26px; font-weight: 700; }
.ziel .zeile .rest { margin-left: auto; font-size: 20px; font-weight: 400; }
.balken { margin-top: 14px; height: 34px; border: var(--rand) solid var(--tinte); border-radius: 999px; background: #EAF5FA; overflow: hidden; }
.balken div { height: 100%; background: var(--sonne); border-right: var(--rand) solid var(--tinte); }
.balken div[style="width: 0%"] { border-right: 0; }
.ziel.geschafft .balken div { background: #3DB36B; }
.verlauf { list-style: none; margin: 0; padding: 0; font-size: 20px; }
.verlauf li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 4px; border-bottom: 2px dashed var(--himmel-tief); }
.plus { color: #1C7C43; font-weight: 700; }
.minus { color: #B3261E; font-weight: 700; }

@media (max-width: 600px) {
  .buehne { padding: 18px 16px 48px; }
  .kloetze { grid-template-columns: repeat(2, 1fr); gap: 18px; }
  .klotz .name { font-size: 19px; }
  .profil .avatar { width: 116px; height: 116px; font-size: 66px; }
  .tasten { grid-template-columns: repeat(3, 80px); }
  .tasten button { height: 80px; }
}
