/* Kidsbank: sonnige Welt, grosse Flächen, wenig Text. Emma = Pferd (Kastanie), Eleni = Koala (Eukalyptus). */
:root {
  --himmel: #8fd6f4;
  --wiese: #a6dc84;
  --creme: #fff8ea;
  --tinte: #3b2412;
  --leise: #7a6450;
  --gold: #f5b81e;
  --akzent: #e8708c;
  --hell: #ffe9ef;
  --rund: 22px;
  --schrift: ui-rounded, "SF Pro Rounded", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: light;
}
.thema-pferd { --akzent: #b8612f; --hell: #ffe7d4; --dunkel: #7a3c17; }
.thema-koala { --akzent: #3c8c69; --hell: #e0f2e6; --dunkel: #24563f; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--schrift); color: var(--tinte);
  background: linear-gradient(var(--himmel) 0%, #c7ecfa 55%, var(--wiese) 55%, #8cc96a 100%) fixed;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body.kind { background: linear-gradient(var(--hell), #fff 70%) fixed; }
body.eltern { background: #f4efe6; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: 16px; padding: 12px 16px; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.12); touch-action: manipulation; }
button:disabled { opacity: .4; }
button.gross { background: var(--akzent); color: #fff; font-weight: 800; font-size: 1.2rem; padding: 16px 22px; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
button small { display: block; font-size: .7rem; font-weight: 600; opacity: .85; }
main { max-width: 560px; margin: 0 auto; padding: 12px 16px 120px; }

.kopf { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.kopf h1 { margin: 0; font-size: 1.8rem; font-weight: 800; flex: 1; }
.start .kopf h1 { text-align: center; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.18); font-size: 2.1rem; margin-top: 10px; }
.zurueck { font-size: 2.6rem; line-height: 1; text-decoration: none; color: var(--tinte); padding: 0 10px 6px 0; }
.tier { display: block; }
.tier.klein { width: 46px; height: 46px; }
.vorlesen { font-size: 1.6rem; padding: 8px 14px; border-radius: 50%; }

/* Startseite */
.kinder { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.kachel { background: var(--creme); border-radius: 28px; padding: 18px 10px 14px; text-align: center; text-decoration: none; color: var(--tinte);
  box-shadow: 0 6px 0 var(--akzent); border: 4px solid var(--akzent); display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 8px; }
.kachel .tier { width: 100%; max-width: 150px; height: auto; }
.kachel span { font-size: 1.7rem; font-weight: 800; }
.kachel:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--akzent); }
.fuss { position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); text-align: center; }
.eltern-knopf { background: rgba(255,255,255,.75); font-size: .95rem; }
.eltern-knopf small { display: inline; margin-left: 4px; }

/* Halteknopf: Fortschritt als wachsender Balken */
button.haelt { position: relative; overflow: hidden; }
button.haelt::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255,255,255,.45); animation: fuellen var(--dauer, 800ms) linear forwards; }
@keyframes fuellen { to { width: 100%; } }

/* Kinderseite */
.mitte { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.schwein-platz { width: 100%; max-width: 340px; }
.schwein { width: 100%; height: auto; display: block; }
.schwein .fuellung { transition: transform 1.4s cubic-bezier(.3,1.4,.5,1); }
.betrag { font-size: 2.6rem; font-weight: 800; letter-spacing: .5px; }
.muenzen { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; max-width: 100%; }
.muenzen .note { width: 74px; height: 40px; }
.muenzen.klein .note { width: 54px; height: 30px; }
.muenzen.klein .muenze { transform: scale(.8); margin: -3px; }
.muenzen .mal { font-weight: 800; color: var(--leise); }
.muenzen .leer, .leise { color: var(--leise); }
.dinge { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fff; border-radius: var(--rund); padding: 10px 16px; width: 100%; box-shadow: 0 3px 0 rgba(0,0,0,.07); }
.dinge small, .zahltag small { color: var(--leise); }
.ding { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ding .emojis { font-size: 1.7rem; letter-spacing: 2px; }
.ding .dingtext { font-weight: 700; }
.ding .null { color: var(--leise); }
.zahltag { text-align: center; font-size: 1.4rem; }
.zahltag small { display: block; font-size: .95rem; }
.aktionen { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; justify-content: center; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(255,255,255,0), #fff 35%); }
.aktionen .gross { flex: 1; max-width: 260px; }

/* Blätter */
.blatt { position: fixed; inset: 0; z-index: 10; background: rgba(40,25,10,.45); display: flex; align-items: flex-end; justify-content: center; }
.blatt-innen { background: var(--creme); width: 100%; max-width: 560px; max-height: 100%; overflow: auto; border-radius: 28px 28px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
.blatt.voll .blatt-innen { min-height: 100%; border-radius: 0; padding-top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; }
.blatt.feier { align-items: center; }
.blatt.feier .blatt-innen { border-radius: 28px; margin: 16px; text-align: center; }
.blattkopf { display: flex; align-items: center; gap: 10px; }
.blattkopf h2 { flex: 1; margin: 0; font-size: 1.5rem; }
.gross-emoji { font-size: 2.2rem; vertical-align: middle; }
.zu { border-radius: 50%; padding: 8px 14px; }
.anzeige { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 12px 0; font-size: 2.4rem; font-weight: 800; }
.schnellwahl, .bilder { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.schnellwahl, .bilder { scrollbar-width: none; }
.schnellwahl::-webkit-scrollbar, .bilder::-webkit-scrollbar { display: none; }
.schnell { white-space: nowrap; flex: none; }
.bild { font-size: 1.6rem; padding: 8px 12px; flex: none; }
.bild small { font-size: .7rem; }
.bild.an { outline: 3px solid var(--akzent); }
.was { width: 100%; padding: 12px; border-radius: 14px; border: 2px solid #e6dccb; margin: 4px 0 8px; }
.tasten { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tasten button { font-size: 1.6rem; font-weight: 700; padding: 14px 0; }
.blatt-innen > .gross { width: 100%; }

/* Vorschau: Rechnung zum Anschauen */
.rechnung { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; flex: 1; }
.zeile { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--rund); padding: 10px 12px; box-shadow: 0 3px 0 rgba(0,0,0,.07); }
.zeile .mini { width: 96px; flex: none; }
.zeile .op { width: 96px; flex: none; text-align: center; font-size: 2.6rem; font-weight: 800; color: var(--akzent); }
.zeile .inhalt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.zeile .inhalt small { color: var(--leise); }
.zeile .inhalt b { font-size: 1.6rem; }
.zeile .muenzen { justify-content: flex-start; }
.zeile.kostet { background: #fff1ec; }
.zeile.fehlt { background: #fff4d6; }
.zeile.bleibt { outline: 3px solid var(--akzent); }
.knoepfe { display: flex; gap: 12px; }
.knoepfe button { flex: 1; }
.fliegen .stueck { animation: wackeln 1.6s ease-in-out infinite; }
@keyframes wackeln { 50% { transform: translateY(-4px) rotate(-6deg); } }
.gekauft .fliegen .stueck { animation: wegfliegen .8s ease-in forwards; }
@keyframes wegfliegen { to { transform: translate(140px, -260px) rotate(200deg) scale(.4); opacity: 0; } }

.zahltag-feier h2 { font-size: 2rem; margin: 8px 0 12px; }
.zahltag-feier .regen .muenze { transform: scale(1.6); margin: 14px; }
.zahltag-feier .regen { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.zahltag-feier .regen .stueck { animation: fallen .9s cubic-bezier(.3,1.5,.6,1) both; }
.zahltag-feier .regen .stueck:nth-child(2) { animation-delay: .15s; }
.zahltag-feier .regen .stueck:nth-child(3) { animation-delay: .3s; }
.zahltag-feier .regen .stueck:nth-child(4) { animation-delay: .45s; }
@keyframes fallen { from { transform: translateY(-160px) rotate(-90deg); opacity: 0; } }
.zahltag-feier .betrag { color: var(--akzent); }
.zahltag-feier .gross { width: 100%; }

/* Hinweis */
.hinweis { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 20; background: var(--tinte); color: #fff; padding: 12px 18px; border-radius: 16px; max-width: 90%; text-align: center; }

/* Anmeldung und Eltern */
.karte { background: #fff; border-radius: var(--rund); padding: 16px; margin: 14px 0; box-shadow: 0 3px 0 rgba(0,0,0,.07); }
.anmelden { text-align: center; margin-top: 40px; }
.anmelden .schwein { max-width: 220px; margin: 0 auto; }
.anmelden form { display: flex; flex-direction: column; gap: 12px; }
input, select { padding: 10px 12px; border-radius: 12px; border: 2px solid #e6dccb; background: #fff; min-width: 0; }
.fehler { color: #b3261e; font-weight: 700; }
.warnung { background: #fff4d6; padding: 10px 14px; border-radius: 14px; }
.laden { text-align: center; margin-top: 30vh; font-size: 1.3rem; }
.kind-einstellung h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.kind-einstellung .stand { margin-left: auto; color: var(--akzent); }
.regel { margin: 0 0 10px; color: var(--leise); }
.einstellung, .korrektur { display: grid; gap: 10px; margin-bottom: 12px; }
.einstellung label, .korrektur label { display: grid; gap: 4px; font-size: .9rem; color: var(--leise); }
.einstellung .haken { display: flex; gap: 8px; align-items: center; }
.einstellung .speichern, .korrektur button, .dinge-form button { background: var(--akzent); color: #fff; font-weight: 700; }
.thema-pferd .speichern, .thema-pferd .korrektur button { background: #b8612f; }
.verlauf { list-style: none; padding: 0; margin: 8px 0 0; }
.verlauf li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0e8db; }
.verlauf .vtext { flex: 1; display: flex; flex-direction: column; }
.verlauf .vtext small { color: var(--leise); font-size: .75rem; }
.verlauf .vbetrag { font-weight: 700; color: #2e7d32; }
.verlauf .vbetrag.minus { color: #b3261e; }
.verlauf li.storno { opacity: .45; text-decoration: line-through; }
.storno-knopf { padding: 4px 10px; }
.dinge-form { display: grid; gap: 8px; }
.ding-zeile { display: grid; grid-template-columns: 56px 1fr 84px; gap: 6px; }
.ding-zeile input:first-child { text-align: center; font-size: 1.3rem; padding: 6px; }

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

/* Vorschau 0.2: geteiltes Schwein und Münzreihe */
.geteilt-box { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: var(--rund); padding: 8px 12px; margin-top: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.07); }
.geteilt-schwein { flex: 1.4; min-width: 0; }
.legende { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.leg { display: flex; align-items: center; gap: 8px; }
.leg span:last-child { display: flex; flex-direction: column; }
.leg small { color: var(--leise); }
.leg b { font-size: 1.25rem; }
.leg .farbe { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.leg.weg .farbe { background: repeating-linear-gradient(45deg, #f08a8a 0 5px, #ffe1e1 5px 10px); border: 2px solid #e06666; }
.leg.bleibt .farbe { background: #f5b81e; border: 2px solid #b8860b; }
.leg.bleibt b { color: #8a6400; }
.reihe-box { background: #fff; border-radius: var(--rund); padding: 10px 12px; margin-top: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.07); text-align: center; }
.reihe { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
.rm { width: 30px; height: 30px; }
.reihe-text { margin: 8px 0 0; font-size: 1.05rem; }
.reihe-text small { display: block; color: var(--leise); font-size: .8rem; }
.rechnung .zeile { padding: 6px 12px; }
.rechnung .zeile .op { width: 44px; font-size: 1.8rem; }
.rechnung .zeile .inhalt { flex-direction: row; align-items: baseline; justify-content: space-between; }
.rechnung .zeile .inhalt b { font-size: 1.3rem; }
.rechnung { flex: 0; }
.blatt.voll .knoepfe { margin-top: auto; padding-top: 10px; }
.weg { transition: opacity .6s; }
.gekauft .rm.weg { animation: wegfliegen .9s ease-in forwards; }
.gekauft .rm.weg:nth-child(odd) { animation-delay: .1s; }
.gekauft .teil-weg { opacity: 0; transition: opacity .9s; }
.gekauft .leg.weg { opacity: .3; }
button, .kachel { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* 0.3: Startseite untereinander, Liste Bekommen/Ausgegeben */
body.start main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: 90px; }
body.start .kinder { flex: 1; display: flex; flex-direction: column; gap: 18px; margin-top: 12px; }
body.start .kachel { flex: 1; flex-direction: row; justify-content: flex-start; gap: 16px; padding: 12px 20px; min-height: 0; max-height: 300px; }
body.start .kachel .tier { width: auto; height: 100%; max-height: 210px; min-height: 120px; max-width: 55%; flex: none; }
body.start .kachel span { font-size: 2.6rem; flex: 1; text-align: center; }
.kindkopf .liste-knopf { font-size: 1.5rem; padding: 8px 12px; border-radius: 50%; }
.reiter { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.reiter button { font-weight: 700; font-size: 1.05rem; }
.reiter button small { font-size: .85rem; }
.reiter button.an { background: var(--akzent); color: #fff; }
.kinderliste { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.kinderliste li { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 16px; padding: 10px 12px; box-shadow: 0 2px 0 rgba(0,0,0,.06); }
.kinderliste .ke { font-size: 2rem; width: 44px; text-align: center; }
.kinderliste .kt { flex: 1; display: flex; flex-direction: column; font-weight: 700; }
.kinderliste .kt small { font-weight: 500; color: var(--leise); }
.kinderliste .kb { font-weight: 800; font-size: 1.15rem; white-space: nowrap; }
.kinderliste.rein .kb { color: #2e7d32; }
.kinderliste.raus .kb { color: #b3261e; }
.leer-liste { text-align: center; color: var(--leise); padding: 30px 0; }
.blatt.liste .blatt-innen { max-height: 85%; }
.ms-anmelden { width: 100%; margin-top: 8px; }
