/* Andika: freie Schrift von SIL für Leseanfänger (Lizenz: fonts/OFL.txt), liegt lokal – kein Google-Server */
@font-face { font-family: Andika; src: url(fonts/andika-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Andika; src: url(fonts/andika-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root {
  --bg: #fff8ec; --karte: #fff; --text: #24324a; --leise: #5d6a80;
  --gruen: #2e9e5b; --rot: #d64545; --akzent: #2d7dd2; --sand: #f1e7d6;
  --wasser1: #2d9cdb; --wasser2: #27b3a5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* sonst gewinnt z. B. .btn { display: inline-flex } */
html, body { margin: 0; height: 100%; }
body {
  font: 22px/1.4 Andika, system-ui, "Segoe UI", sans-serif;
  /* auf Fach- und Übungsseiten färbt sich der Hintergrund leicht in der Fachfarbe */
  background: color-mix(in srgb, var(--fach, #ffb84d) 10%, #fff); color: var(--text); /* ohne Fach: Creme */
  display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none; /* kein Markieren beim Tippen am Board */
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 24px; background: linear-gradient(90deg, var(--wasser1), var(--wasser2)); box-shadow: 0 3px 10px #0002;
}
.logo { font-size: 32px; font-weight: 700; color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; }
.logo img { width: 46px; height: 46px; filter: drop-shadow(0 2px 2px #0003); }
header .btn { background: #ffffff30; color: #fff; }
nav { display: flex; gap: 12px; }
main { flex: 1; padding: 24px; overflow: auto; }
footer { padding: 6px 24px; font-size: 15px; color: var(--leise); text-align: right; }
footer a { color: inherit; }

/* Impressum / Datenschutz */
main.text { max-width: 900px; width: 100%; margin: 0 auto; font-size: 19px; user-select: text; -webkit-user-select: text; }
main.text h1 { font-size: 36px; }
main.text h2 { font-size: 24px; margin: 28px 0 6px; }
mark { background: #ffe066; padding: 0 4px; border-radius: 4px; }

.btn {
  font: inherit; border: 0; border-radius: 14px; padding: 14px 24px;
  min-height: 60px; background: var(--sand); color: var(--text);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn.primaer { background: var(--akzent); color: #fff; }
.btn:focus-visible, .kachel:focus-visible { outline: 4px solid var(--akzent); outline-offset: 2px; }

h1 { margin: 0 0 20px; font-size: 42px; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.kachel {
  display: block; background: var(--karte); border-radius: 26px; padding: 26px 28px;
  color: var(--text); text-decoration: none; box-shadow: 0 6px 0 color-mix(in srgb, var(--farbe, var(--akzent)) 35%, #fff), 0 8px 20px #0001;
  border-top: 10px solid var(--farbe, var(--akzent));
}
.kachel:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--farbe, var(--akzent)) 35%, #fff); }
.kachel .icon {
  font-size: 52px; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--farbe, var(--akzent)) 16%, #fff);
}
.kopf h1 { color: color-mix(in srgb, var(--fach, var(--text)) 70%, #000); }

/* Startseite: Teich-Bühne mit Olli & Fips */
.buehne {
  position: relative; overflow: hidden; border-radius: 32px; margin-bottom: 28px; padding: 28px 32px 70px;
  background: linear-gradient(#dff3ff, #eef9ff 62%, #8fd3ee 62%, #4fb3dd);
}
.buehne h1 { font-size: 46px; margin: 0 0 18px; color: #1f5f8b; position: relative; }
.buehne .duo { position: relative; margin: 0; align-items: flex-end; }
.buehne .koerper svg { width: 150px; height: 175px; }
.buehne .deko { position: absolute; right: 0; bottom: 0; width: 380px; height: 250px; pointer-events: none; }
@media (max-width: 900px) { .buehne .deko { opacity: .35; } }
.kachel h2 { margin: 8px 0 4px; font-size: 32px; }
/* keine Auto-Trennung (trennt sonst „Kir-chenjahr“); nur an festen ­-Stellen in inhalte.js, notfalls Umbruch statt Überlauf */
.kachel h2, .btn, .frage, .karteikarte, .blase { hyphens: manual; overflow-wrap: break-word; min-width: 0; }
.kachel p { margin: 0; color: var(--leise); }
.typ { display: inline-block; margin-top: 10px; padding: 4px 12px; border-radius: 99px; background: #eef1f8; font-size: 18px; }

.kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.kopf h1 { margin: 0; flex: 1; }
.fortschritt { color: var(--leise); }

/* Quiz */
.frage { font-size: 40px; font-weight: 600; margin: 10px 0 30px; text-align: center; }
.antworten { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.antworten .btn { font-size: 30px; min-height: 110px; justify-content: center; background: var(--karte); box-shadow: 0 4px 14px #0001; }
.richtig { background: var(--gruen) !important; color: #fff !important; }
.falsch { background: var(--rot) !important; color: #fff !important; animation: wackeln .35s; }
@keyframes wackeln { 25% { translate: -8px; } 75% { translate: 8px; } }
.mitte { text-align: center; margin-top: 30px; }
.ergebnis { font-size: 60px; text-align: center; margin: 40px 0; }

/* Zuordnen */
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.spalten > div { display: flex; flex-direction: column; gap: 14px; }
.spalten .btn { font-size: 28px; min-height: 80px; justify-content: center; background: var(--karte); box-shadow: 0 4px 14px #0001; }
.spalten .gewaehlt { outline: 5px solid var(--akzent); }
.spalten .btn:disabled { opacity: .9; cursor: default; }

/* Karteikarten */
.karteikarte {
  margin: 20px auto; max-width: 900px; min-height: 380px; border-radius: 24px;
  background: var(--karte); box-shadow: 0 6px 20px #0002; display: flex;
  align-items: center; justify-content: center; text-align: center;
  font-size: 52px; padding: 30px; cursor: pointer; border: 0; width: 100%; color: var(--text);
}
.karteikarte.rueckseite { background: #fff8dc; }

/* Musik: Klavier */
.klavier { display: flex; gap: 8px; justify-content: center; margin: 10px auto 24px; max-width: 1100px; }
.taste {
  flex: 1; height: min(300px, 34vh); border: 0; border-radius: 0 0 18px 18px; cursor: pointer;
  background: linear-gradient(#fff 60%, color-mix(in srgb, var(--ton) 35%, #fff));
  border-bottom: 18px solid var(--ton); box-shadow: 0 6px 14px #0002;
  font: 700 38px Andika, system-ui, sans-serif; color: var(--text); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px;
}
.taste.gedrueckt { animation: druck .25s; }
@keyframes druck { 40% { transform: translateY(6px); filter: brightness(.9); } }
.lied { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.chip { min-width: 56px; padding: 8px 12px; border-radius: 12px; text-align: center; font-size: 28px; font-weight: 700; background: var(--karte); border-bottom: 6px solid var(--ton); opacity: .55; }
.chip.dran { opacity: 1; outline: 4px solid var(--akzent); transform: scale(1.12); }
.chip.fertig { opacity: 1; background: color-mix(in srgb, var(--ton) 30%, #fff); }

/* Musik: Rhythmus */
.leiste { display: flex; flex-wrap: wrap; gap: 14px 28px; justify-content: center; margin-bottom: 20px; }
.gruppe { display: flex; gap: 8px; }
.rhythmus { display: grid; grid-template-columns: repeat(var(--takt), 1fr); gap: 12px; margin: 0 auto 24px; max-width: 1200px; }
.schlag {
  font: inherit; border: 0; border-radius: 18px; min-height: min(130px, 15vh); cursor: pointer;
  background: var(--karte); box-shadow: 0 4px 14px #0001; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.schlag.eins { border-left: 8px solid var(--akzent); } /* Zählzeit 1 jedes Takts */
.schlag .zeichen { font-size: 44px; }
.schlag .silbe { font-size: 24px; font-weight: 700; color: var(--leise); }
.schlag.aktiv { background: #fff3b0; transform: scale(1.06); box-shadow: 0 0 0 5px #f0c419; }

/* Maskottchen */
.begleiter { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.figur { flex-shrink: 0; text-align: center; }
.figur .koerper svg { width: 110px; height: 128px; display: block; }
.figur .name { font-size: 16px; font-weight: 600; color: var(--leise); }
.blase {
  position: relative; background: var(--karte); border-radius: 22px; padding: 16px 26px;
  box-shadow: 0 4px 14px #0001; font-size: 28px; font-weight: 500;
}
.blase::before {
  content: ''; position: absolute; left: -16px; top: 50%; translate: 0 -50%;
  border-style: solid; border-width: 12px 16px 12px 0; border-color: transparent var(--karte) transparent transparent;
}
.duo { display: flex; gap: 24px 48px; flex-wrap: wrap; margin-bottom: 24px; }
.duo .begleiter { margin: 0; }
.huepf { animation: huepf .7s; }
.wackel { animation: wackeln .4s; }
@keyframes huepf { 30% { translate: 0 -26px; } 60% { translate: 0 0; } 80% { translate: 0 -8px; } }
/* Daueranimationen der Figuren: atmen, blinzeln, Schwanz, Kehle, winken */
.koerper svg { overflow: visible; transform-origin: 50% 100%; animation: atmen 3.2s ease-in-out infinite; }
.koerper svg * { transform-box: fill-box; transform-origin: center; }
.augen { animation: blinzeln 4.6s infinite; }
.koerper .schwanz { transform-origin: 0% 100%; animation: wedeln 1.8s ease-in-out infinite; }
.kehle { animation: quaken 2.4s ease-in-out infinite; }
.begleiter + .begleiter .augen { animation-delay: -2.1s; } /* nicht im Gleichtakt blinzeln */
.winkt .arm { animation: winken 5s ease-in-out infinite; } /* Drehpunkt + Winkel stehen am Arm in figuren.js */
.winkt .begleiter + .begleiter .arm { animation-delay: -2.5s; }
@keyframes atmen { 50% { transform: scale(1.02, .975); } }
@keyframes blinzeln { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes wedeln { 50% { transform: rotate(-14deg); } }
@keyframes quaken { 0%, 60%, 100% { transform: scale(1); } 75% { transform: scale(1.35, 1.6); } }
@keyframes winken {
  0%, 40%, 100% { transform: rotate(0); }
  8%, 24% { transform: rotate(var(--a1)); }
  16%, 32% { transform: rotate(var(--a2)); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
