/* Grüsslibox – Eltern-App. Farben wie Kiste und Werkstatt-Programm. */
:root {
  --hg: #f7f3ea; --karte: #fff; --rand: #e6dfcf; --dunkel: #23232b; --text: #2b2b33; --grau: #7d7d88;
  --gelb: #f2c14e; --gelb-d: #c9952a; --gelb-h: #fff4d1; --gruen: #1f8a46; --gruen-h: #e4f4e9;
  --rot: #c0392b; --rot-h: #fbe7e4; --blau: #2563b0; --blau-h: #e6eef9; --radius: 18px;
  --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--hg); color: var(--text); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Cantarell, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blau); }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- Laden */
.laden { flex: 1; display: grid; place-items: center; }
.kiste-logo { width: 84px; height: 84px; border-radius: 22px; background: url(icon.svg) center/cover; }
.puls { animation: puls 1.4s ease-in-out infinite; }
@keyframes puls { 50% { transform: scale(1.06); opacity: .75; } }

/* ---------- Kopf */
.kopf { background: var(--dunkel); color: #fff; padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 16px;
        display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 5; }
.kopf .kiste-logo { width: 46px; height: 46px; border-radius: 13px; flex: none; }
.kopf h1 { font-size: 20px; margin: 0; line-height: 1.2; }
.kopf .unter { font-size: 13px; color: #c9c6bd; display: flex; align-items: center; gap: 6px; }
.kopf select { background: #34343f; border: 0; border-radius: 10px; color: #fff; padding: 4px 8px; font-size: 15px; max-width: 100%; }
.punkt { width: 9px; height: 9px; border-radius: 50%; background: #888; display: inline-block; flex: none; }
.punkt.an { background: #3ddc84; box-shadow: 0 0 0 0 rgba(61, 220, 132, .6); animation: atmen 2s infinite; }
@keyframes atmen { 70% { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }

/* ---------- Inhalt */
main { flex: 1; padding: 16px 14px calc(96px + var(--unten)); }
.karte { background: var(--karte); border: 1.5px solid var(--rand); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
         animation: rein .25s ease-out; }
@keyframes rein { from { opacity: 0; transform: translateY(8px); } }
.karte h2 { font-size: 18px; margin: 0 0 12px; }
.leise { color: var(--grau); font-size: 14px; }
label { display: block; font-size: 14px; color: var(--grau); margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], textarea, select.feld {
  width: 100%; border: 1.5px solid var(--rand); background: #fbf9f4; border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select.feld:focus { border-color: var(--blau); box-shadow: 0 0 0 3px var(--blau-h); }
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px;
         padding: 12px 22px; background: var(--blau); color: #fff; font-weight: 600; cursor: pointer; min-height: 48px;
         box-shadow: 0 3px 0 rgba(0, 0, 0, .18); transition: transform .08s, filter .15s; }
.knopf:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.knopf:disabled { filter: grayscale(1) opacity(.55); cursor: default; }
.knopf.breit { width: 100%; margin-top: 18px; }
.knopf.gelb { background: var(--gelb-d); }
.knopf.gruen { background: var(--gruen); }
.knopf.hell { background: var(--blau-h); color: var(--blau); box-shadow: none; }
.knopf.rot { background: var(--rot-h); color: var(--rot); box-shadow: none; }
.knopf.klein { padding: 7px 14px; min-height: 36px; font-size: 14px; }
.reiter { display: flex; background: #ece6d8; border-radius: 999px; padding: 4px; margin-bottom: 14px; }
.reiter button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 999px; font-weight: 600; color: var(--grau); cursor: pointer; }
.reiter button.an { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.fehler { background: var(--rot-h); color: var(--rot); border-radius: 12px; padding: 10px 14px; margin-top: 12px; font-size: 15px; }
.willkommen { text-align: center; padding: 34px 10px 10px; }
.willkommen .kiste-logo { width: 96px; height: 96px; margin: 0 auto 16px; border-radius: 26px; animation: wippen 3s ease-in-out infinite; }
@keyframes wippen { 50% { transform: translateY(-6px) rotate(-3deg); } }
.willkommen h1 { font-size: 26px; margin: 0 0 6px; }

/* ---------- Nachrichten */
.verlauf { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
.tag { align-self: center; font-size: 12px; color: var(--grau); background: #ece6d8; border-radius: 999px; padding: 3px 10px; margin: 8px 0 2px; }
.blase { max-width: 82%; padding: 9px 13px 7px; border-radius: 18px; background: #fff; border: 1.5px solid var(--rand);
         align-self: flex-start; animation: blase .3s cubic-bezier(.2, .9, .3, 1.3); word-wrap: break-word; white-space: pre-wrap; }
@keyframes blase { from { opacity: 0; transform: scale(.85) translateY(10px); } }
.blase.mein { align-self: flex-end; background: var(--gelb-h); border-color: #f0d98e; border-bottom-right-radius: 6px; }
.blase:not(.mein) { border-bottom-left-radius: 6px; }
.blase .von { font-size: 13px; font-weight: 700; color: var(--gelb-d); margin-bottom: 2px; }
.blase .fuss { font-size: 12px; color: var(--grau); text-align: right; margin-top: 3px; display: flex; justify-content: flex-end; gap: 6px; align-items: center; white-space: nowrap; }
.status-gehoert { color: var(--blau); font-weight: 600; }
.status-wartend { color: var(--gelb-d); }
.leer { text-align: center; color: var(--grau); padding: 40px 20px; }
.leer .kiste-logo { margin: 0 auto 14px; opacity: .85; }

.schreiben { position: fixed; left: 0; right: 0; bottom: calc(64px + var(--unten)); z-index: 6; }
.schreiben .innen { max-width: 560px; margin: 0 auto; padding: 8px 10px; display: flex; gap: 8px; align-items: flex-end;
                    background: linear-gradient(transparent, var(--hg) 30%); }
.schreiben textarea { resize: none; max-height: 140px; min-height: 48px; border-radius: 24px; padding: 12px 16px; background: #fff; }
.schreiben .senden { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gelb-d); color: #fff; flex: none; cursor: pointer;
                     display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0, 0, 0, .18); transition: transform .15s; }
.schreiben .senden:disabled { background: #c9c3b4; box-shadow: none; }
.schreiben .senden:not(:disabled):active { transform: scale(.9); }
.schreiben .senden svg { width: 22px; height: 22px; }
.schreiben .foto-knopf { width: 44px; height: 48px; border: 0; background: none; color: var(--gelb-d); flex: none; cursor: pointer; padding: 0; }
.schreiben .foto-knopf svg { width: 28px; height: 28px; }
.schreiben .foto-knopf:disabled { opacity: .4; }
.blase img.foto { display: block; width: 180px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; margin: 4px auto 6px; background: #222; }
.zaehler { font-size: 12px; color: var(--grau); text-align: right; padding: 0 22px; max-width: 560px; margin: 0 auto; min-height: 16px; }
main.mit-schreiben { padding-bottom: calc(170px + var(--unten)); }

/* ---------- Kiste / Familie */
.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0ebe0; }
.zeile:last-child { border-bottom: 0; }
.zeile .wert { color: var(--grau); text-align: right; }
.balken { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; vertical-align: middle; margin-right: 6px; }
.balken i { width: 4px; background: #d6d0c2; border-radius: 1px; }
.balken i.an { background: var(--gruen); }
input[type=range] { width: 100%; accent-color: var(--gelb-d); height: 32px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0ebe0; }
.person:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.person .name { flex: 1; }
.abzeichen { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--blau-h); color: var(--blau); margin-left: 6px; }
.link-feld { display: flex; gap: 8px; margin-top: 10px; }
.link-feld input.klein { font-size: 13px; }
.einladung-neu { background: var(--gruen-h); border: 1.5px dashed var(--gruen); border-radius: 14px; padding: 14px; margin-top: 14px; animation: rein .3s; }
.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Navigation unten */
nav.unten { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--rand); z-index: 7;
            padding-bottom: var(--unten); }
nav.unten .innen { max-width: 560px; margin: 0 auto; display: flex; }
nav.unten button { flex: 1; border: 0; background: none; padding: 8px 0 9px; font-size: 12px; color: var(--grau); cursor: pointer;
                   display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.unten button svg { width: 25px; height: 25px; transition: transform .2s; }
nav.unten button.an { color: var(--gelb-d); font-weight: 700; }
nav.unten button.an svg { transform: translateY(-2px) scale(1.08); }

/* ---------- Meldung */
#toast { position: fixed; left: 50%; bottom: calc(150px + var(--unten)); transform: translate(-50%, 20px); background: var(--dunkel); color: #fff;
         padding: 10px 18px; border-radius: 999px; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; z-index: 20;
         max-width: 90vw; text-align: center; }
#toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
#toast.fehler { background: var(--rot); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* M2: Sprachnachricht, Einstellungen */
.schreiben .foto-knopf.an { color: #d33; }
.schreiben .aufnahme { max-width: 560px; margin: 0 auto; padding: 0 14px 6px; color: #d33; font-size: 14px; font-weight: 600; }
.blase audio.ton { display: block; width: 230px; max-width: 100%; height: 40px; margin: 4px 0; }
label.schalter { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; font-weight: 600; cursor: pointer; }
label.schalter input { width: 22px; height: 22px; accent-color: var(--gelb-d); }
