:root {
  --bg: #FFF6EA;
  --karte: #FFFFFF;
  --text: #2A2724;
  --text-leise: #6E6660;
  --linie: #EFE3D3;
  --gruen: #2F7D6D;
  --gruen-dunkel: #24695B;
  --gruen-hell: #E3F2EE;
  --gelb: #F6C35B;
  --gelb-dunkel: #E5A93A;
  --pfirsich: #FFE3C2;
  --rosa: #F7A7A0;
  --rot-leise: #B5523F;
  --radius: 22px;
  --schatten: 0 6px 24px rgba(77, 52, 20, 0.08);
  --unten: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gruen); }

#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Pip ---------- */
.pip { display: block; margin: 0 auto; }
.pip-schatten { fill: rgba(77, 52, 20, 0.10); }
.pip-bauch-aussen { fill: var(--gelb); }
.pip-bauch { fill: #FFE7A8; }
.pip-fluegel { fill: var(--gelb-dunkel); transform-box: fill-box; }
.pip-fluegel-l { transform-origin: 100% 0%; }
.pip-fluegel-r { transform-origin: 0% 0%; }
.pip-feder { fill: var(--gelb-dunkel); }
.pip-fuss { stroke: #E08A3C; stroke-width: 5; stroke-linecap: round; fill: none; }
.pip-auge { fill: #3A2C22; }
.pip-glanz { fill: #fff; }
.pip-lachauge { stroke: #3A2C22; stroke-width: 6; stroke-linecap: round; fill: none; }
.pip-wange { fill: var(--rosa); opacity: .55; }
.pip-schnabel { fill: #F08C3A; }
.pip .pip-augen-froh { display: none; }
.pip.froh .pip-augen-froh { display: inline; }
.pip.froh .pip-augen-offen { display: none; }
.pip .pip-koerper { transform-origin: 50% 90%; }
.pip.atmen .pip-koerper { animation: atmen 3.2s ease-in-out infinite; }
.pip.huepfen .pip-koerper { animation: huepfen .7s ease-out 3; }
.pip.huepfen .pip-fluegel-l { animation: winken-l .35s ease-in-out 6; }
.pip.huepfen .pip-fluegel-r { animation: winken-r .35s ease-in-out 6; }
.pip.winken .pip-fluegel-r { animation: winken-r .5s ease-in-out 4; }
@keyframes atmen { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.02, .98); } }
@keyframes huepfen { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-22px) scale(1.03, .97); } }
@keyframes winken-l { 50% { transform: rotate(18deg); } }
@keyframes winken-r { 50% { transform: rotate(-18deg); } }
@media (prefers-reduced-motion: reduce) { .pip * { animation: none !important; } }

/* ---------- Grundbausteine ---------- */
.seite { flex: 1; padding: 20px 18px calc(100px + var(--unten)); }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.kopf h1 { font-size: 1.35rem; margin: 0; line-height: 1.25; }
.kopf .klein { color: var(--text-leise); font-size: .95rem; }
.symbolknopf { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--text-leise); }
.symbolknopf:active { background: var(--linie); }

.karte { background: var(--karte); border-radius: var(--radius); box-shadow: var(--schatten); padding: 22px; }
.karte + .karte { margin-top: 14px; }
.leise { color: var(--text-leise); }
.mitte { text-align: center; }

.knopf {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 60px; border: 0; border-radius: 18px; padding: 14px 18px;
  font-weight: 650; font-size: 1.1rem; transition: transform .08s ease, background .2s;
}
.knopf:active { transform: scale(.98); }
.knopf:disabled { opacity: .55; }
.knopf.haupt { background: var(--gruen); color: #fff; box-shadow: 0 6px 16px rgba(47, 125, 109, .28); }
.knopf.haupt:active { background: var(--gruen-dunkel); }
.knopf.zweit { background: var(--gruen-hell); color: var(--gruen-dunkel); }
.knopf.leicht { background: transparent; color: var(--text-leise); min-height: 48px; font-weight: 550; }
.knopfreihe { display: flex; gap: 10px; margin-top: 10px; }
.knopfreihe .knopf { flex: 1; }

.feld { display: block; margin: 16px 0 6px; font-weight: 600; }
.eingabe {
  width: 100%; border: 2px solid var(--linie); background: #fff; border-radius: 16px;
  padding: 14px 16px; font-size: 1.15rem; outline: none;
}
.eingabe:focus { border-color: var(--gruen); }
.eingabe.code { letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 700; }
.eingabe.pin { letter-spacing: .6em; text-align: center; font-weight: 700; }
.hinweis { font-size: .92rem; color: var(--text-leise); margin: 6px 0 0; }
.fehler { color: var(--rot-leise); font-weight: 600; margin: 12px 0 0; }
.haken { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: .95rem; }
.haken input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--gruen); flex: none; }

/* ---------- Anmelden ---------- */
.anmelden { flex: 1; padding: 28px 22px calc(40px + var(--unten)); display: flex; flex-direction: column; }
.anmelden h1 { font-size: 1.7rem; margin: 10px 0 4px; text-align: center; }
.anmelden .unterzeile { text-align: center; color: var(--text-leise); margin: 0 0 18px; }
.anmelden form { margin-top: 8px; }

/* ---------- Heute ---------- */
.heute-pip { margin: 6px auto 0; }
.schritt-karte { text-align: center; padding: 26px 22px 20px; }
.schritt-etikett { display: inline-block; background: var(--pfirsich); color: #8A5A1E; font-weight: 700; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; padding: 6px 12px; border-radius: 999px; }
.schritt-text { font-size: 1.45rem; line-height: 1.35; font-weight: 700; margin: 16px 0 10px; }
.schritt-meta { color: var(--text-leise); font-size: .98rem; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.schritt-knoepfe { margin-top: 22px; }

.feier { position: fixed; inset: 0; background: rgba(255, 246, 234, .97); z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; animation: einblenden .25s ease; }
.feier h2 { font-size: 1.7rem; margin: 12px 0 6px; }
.feier p { color: var(--text-leise); margin: 0 0 24px; max-width: 360px; }
.feier .knopf { max-width: 360px; }
.konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 31; overflow: hidden; }
.konfetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fallen 1.8s ease-in forwards; }
@keyframes fallen { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }
@keyframes einblenden { from { opacity: 0; } }

/* ---------- Reden ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.blase { max-width: 84%; padding: 12px 16px; border-radius: 20px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.blase.pip-blase { align-self: flex-start; background: var(--karte); box-shadow: var(--schatten); border-bottom-left-radius: 6px; }
.blase.ich { align-self: flex-end; background: var(--gruen); color: #fff; border-bottom-right-radius: 6px; }
.blase-zeile { display: flex; align-items: flex-end; gap: 8px; }
.blase-zeile .mini-pip { flex: none; width: 34px; height: 34px; }
.tippt { display: inline-flex; gap: 5px; padding: 16px 18px; }
.tippt i { width: 8px; height: 8px; border-radius: 50%; background: #C9BBA9; animation: punkt 1.2s infinite; }
.tippt i:nth-child(2) { animation-delay: .15s; } .tippt i:nth-child(3) { animation-delay: .3s; }
@keyframes punkt { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.eingabeleiste {
  position: fixed; left: 0; right: 0; bottom: calc(72px + var(--unten)); z-index: 10;
  background: linear-gradient(to top, var(--bg) 70%, rgba(255, 246, 234, 0));
  padding: 14px 14px 10px;
}
.eingabeleiste-innen { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.eingabeleiste textarea { flex: 1; resize: none; overflow-y: auto; scrollbar-width: none; max-height: 140px; min-height: 54px; border: 2px solid var(--linie); border-radius: 22px; padding: 13px 16px; outline: none; background: #fff; }
.eingabeleiste textarea:focus { border-color: var(--gruen); }
.senden { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--gruen); color: #fff; display: grid; place-items: center; flex: none; }
.senden:disabled { opacity: .5; }
.seite.reden { padding-bottom: calc(170px + var(--unten)); }
.vorschlaege { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.vorschlag { border: 2px solid var(--linie); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: .95rem; }

/* ---------- Geschafft ---------- */
.zaehler { display: flex; gap: 12px; }
.zaehler .karte { flex: 1; text-align: center; padding: 18px 10px; margin: 0; }
.zaehler .zahl { font-size: 2.2rem; font-weight: 800; color: var(--gruen); line-height: 1.1; }
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--linie); }
.liste li:last-child { border-bottom: 0; }
.liste .punkt { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; }
.liste .punkt.ok { background: var(--gruen-hell); color: var(--gruen); }
.liste .punkt.offen { background: var(--pfirsich); color: #8A5A1E; }
.liste .unter { color: var(--text-leise); font-size: .88rem; }
h2.abschnitt { font-size: 1.1rem; margin: 26px 4px 10px; }

/* ---------- Leiste unten ---------- */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--linie); padding-bottom: var(--unten);
}
.leiste-innen { max-width: 560px; margin: 0 auto; display: flex; }
.leiste button { flex: 1; border: 0; background: transparent; height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--text-leise); }
.leiste button svg { width: 26px; height: 26px; }
.leiste button[aria-current="page"] { color: var(--gruen); }
.leiste .marke { position: absolute; margin: -22px 0 0 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--rot-leise); }

/* ---------- Kleinkram ---------- */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--unten)); transform: translateX(-50%); background: #2A2724; color: #fff; padding: 12px 18px; border-radius: 14px; z-index: 50; max-width: 90vw; font-size: .95rem; animation: einblenden .2s; }
.laden { flex: 1; display: grid; place-items: center; }
.blatt { position: fixed; inset: 0; background: rgba(42, 39, 36, .35); z-index: 40; display: flex; align-items: flex-end; animation: einblenden .2s; }
.blatt-innen { background: var(--bg); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 26px 26px 0 0; padding: 22px 20px calc(24px + var(--unten)); max-height: 88vh; overflow: auto; }
.blatt-innen h2 { margin: 4px 0 12px; }
.blatt-innen p { margin: 0 0 12px; }
