/* Lele – kindgerechtes, ruhiges Design: große Ziele, klare Schrift, warme Farben. */

:root {
  --bg: #FFF4E0;
  --card: #FFFFFF;
  --ink: #3A2E4D;
  --muted: #857A93;
  --line: #EDE2D0;
  --syl0: #1D5FD6;   /* Silbe blau */
  --syl1: #D62D3A;   /* Silbe rot */
  --go: #2FAE66;
  --wrong: #D62D3A;
  --shadow: 0 6px 0 rgba(58, 46, 77, .10), 0 10px 24px rgba(58, 46, 77, .08);
  --radius: 26px;
  --font-letter: 'Andika', 'Comic Sans MS', system-ui, sans-serif;
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
mark { background: none; color: var(--syl1); text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .12em; }

.loading { text-align: center; margin-top: 40vh; color: var(--muted); }
.muted { color: var(--muted); font-weight: 600; }

/* ---------- Kopfzeile ---------- */

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
}
.bar h1 { flex: 1; margin: 0; font-size: 1.25rem; font-weight: 900; text-align: center; }
.home-btn {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  font-size: 1.7rem; background: var(--card); box-shadow: var(--shadow);
}
.home-btn:active { transform: translateY(3px); }

.stars {
  min-width: 52px; padding: 8px 12px; border-radius: 999px; background: var(--card);
  box-shadow: var(--shadow); font-size: 1.05rem; white-space: nowrap; text-align: center;
}
.stars.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

.screen {
  max-width: 720px; margin: 0 auto; padding: 8px var(--gutter) 40px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

/* ---------- Startseite ---------- */

.home { max-width: 720px; margin: 0 auto; padding: 14px var(--gutter) 28px; }
.home-top { display: flex; align-items: center; justify-content: space-between; }
.logo { font-family: var(--font-letter); font-size: 3.2rem; line-height: 1; }
.logo .s0, .logo-sub .s0 { color: var(--syl0); }
.logo .s1, .logo-sub .s1 { color: var(--syl1); }
.logo-sub { font-size: .95rem; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }
.hello { font-size: 1.5rem; margin: 6px 0 16px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 620px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  aspect-ratio: 1 / .9; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow); color: #fff; text-align: center; padding: 8px;
  transition: transform .1s;
}
.tile:active { transform: translateY(4px) scale(.98); }
.tile-emoji { font-size: clamp(2.8rem, 15vw, 4rem); line-height: 1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.12)); }
.tile-label { font-size: clamp(1rem, 4.6vw, 1.3rem); font-weight: 900; text-shadow: 0 2px 0 rgba(0,0,0,.15); }
.t1 { background: #F0802A; }
.t2 { background: #1E9BD7; }
.t3 { background: #8E5CD9; }
.t4 { background: #2FAE66; }
.t5 { background: #E8505B; }
.t6 { background: #14A3A3; }

.my-letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0 8px; }
.my-letters span {
  font-family: var(--font-letter); font-size: 1.6rem; color: var(--c);
  background: var(--card); border-radius: 14px; min-width: 46px; padding: 2px 8px; text-align: center;
  box-shadow: 0 3px 0 rgba(58,46,77,.08);
}

.home-foot { display: flex; justify-content: center; margin-top: 18px; }
.parent-btn {
  position: relative; overflow: hidden; padding: 12px 20px; border-radius: 999px;
  background: var(--card); color: var(--muted); font-size: .95rem; box-shadow: var(--shadow);
  touch-action: none;
}
.parent-btn .fill { position: absolute; inset: 0; width: 0; background: #FFE2B8; transition: width .1s; }
.parent-btn.holding .fill { width: 100%; transition: width 1.5s linear; }
.parent-btn .txt { position: relative; }

/* ---------- Allgemeine Bausteine ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 10px 20px; border-radius: 20px;
  background: var(--card); box-shadow: var(--shadow); font-size: 1.15rem; font-weight: 800;
}
.btn:active { transform: translateY(3px); }
.btn.big { min-height: 66px; font-size: 1.35rem; padding: 12px 26px; }
.btn.go { background: var(--go); color: #fff; }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 1rem; border-radius: 14px; }
.btn.danger { background: #FDE8EA; color: var(--wrong); }
.btn.recording { background: var(--wrong); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.prompt { margin: 4px 0 0; font-size: 1.3rem; text-align: center; }
.prompt.small { font-size: 1.05rem; color: var(--muted); }

.dots { display: flex; gap: 8px; }
.dots span { width: 16px; height: 16px; border-radius: 50%; background: #E8DCC8; }
.dots span.on { background: #F7B731; box-shadow: 0 0 0 3px #FFE7A8; }

.tabs {
  display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: #F3E6CF; width: max-content; max-width: 100%;
}
.tabs a { padding: 10px 16px; border-radius: 999px; font-size: 1rem; white-space: nowrap; }
.tabs a.on { background: var(--card); box-shadow: 0 3px 0 rgba(58,46,77,.08); }

.pic {
  font-size: clamp(5rem, 28vw, 8rem); line-height: 1.1; padding: 10px 22px;
  border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.pic.big { font-size: clamp(6rem, 34vw, 9.5rem); }
.pic.ear { font-size: clamp(4rem, 22vw, 6rem); }
.boing { animation: boing .5s ease; }
@keyframes boing { 30% { transform: scale(1.15) rotate(-4deg); } 60% { transform: scale(.96) rotate(3deg); } }
.flip { animation: flip .5s ease; }
@keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }

.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

.empty, .finish { text-align: center; padding-top: 6vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big-emoji, .trophy { font-size: 6rem; }
.trophy { animation: boing 1s ease infinite; }
.finish h2 { font-size: 2.4rem; margin: 0; }

.confetti {
  position: fixed; top: -60px; z-index: 50; pointer-events: none;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(115vh) rotate(540deg); } }

/* ---------- Buchstaben-Übersicht ---------- */

.sec { align-self: flex-start; margin: 8px 0 0; font-size: 1.15rem; }
.lgrid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.lgrid.small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.ltile {
  background: var(--card); border-radius: 22px; box-shadow: var(--shadow);
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--c);
}
.ltile:active { transform: translateY(3px); }
.ltile .lt { font-family: var(--font-letter); font-size: 2.4rem; line-height: 1.05; display: flex; gap: 4px; align-items: baseline; }
.ltile .lo { font-size: .85em; }
.ltile .le { font-size: 1.6rem; }
.lgrid.small .ltile .lt { font-size: 1.6rem; }
.lgrid.small .ltile .le { font-size: 1.1rem; }
.ltile.faded { opacity: .55; filter: saturate(.6); }

/* ---------- Buchstaben-Karte ---------- */

.lcard { width: 100%; display: flex; align-items: center; gap: 6px; touch-action: pan-y; }
.lcard-main {
  flex: 1; min-width: 0; background: var(--card); border-radius: 32px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; padding: 14px 10px 20px; gap: 6px;
  border-top: 10px solid var(--c);
}
.big-letter {
  font-family: var(--font-letter); color: var(--c); line-height: 1;
  font-size: clamp(5.5rem, 30vw, 10rem); display: flex; gap: .25em; align-items: baseline;
}
.big-letter .lo { font-size: .85em; }
.lcard .pic { box-shadow: none; background: transparent; padding: 0 10px; }
.anchor { font-family: var(--font-letter); font-size: clamp(2rem, 10vw, 3rem); }
.nav {
  width: 44px; height: 88px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow);
  font-size: 1.3rem; color: var(--muted); flex: none;
}
.parent-hint { text-align: center; color: var(--ink); font-weight: 600; font-size: .95rem; background: #FFF9EF; border: 2px dashed var(--line); border-radius: 18px; padding: 10px 14px; margin: 0; }

/* ---------- Spiele ---------- */

.reveal { font-family: var(--font-letter); font-size: 2.2rem; min-height: 1.3em; }
.choices { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; width: 100%; }
.choice {
  min-width: 96px; min-height: 96px; padding: 8px 18px; border-radius: 26px; background: var(--card);
  box-shadow: var(--shadow); font-family: var(--font-letter); color: var(--c, var(--ink));
  font-size: clamp(2.8rem, 14vw, 4rem); line-height: 1; display: flex; gap: .2em; align-items: baseline; justify-content: center;
  transition: transform .1s;
}
.choice .lo { font-size: .85em; }
.choice:active { transform: translateY(4px); }
.choice.right { background: #DDF6E7; box-shadow: 0 0 0 5px var(--go), var(--shadow); transform: scale(1.08); }
.choice.wrong { opacity: .35; }
.pic-choice { font-family: inherit; font-size: clamp(3.2rem, 17vw, 4.6rem); }

.target {
  display: flex; align-items: center; gap: 14px; padding: 8px 22px; border-radius: 26px;
  background: var(--card); box-shadow: var(--shadow); color: var(--c);
}
.target .tl { font-family: var(--font-letter); font-size: 4rem; line-height: 1; display: flex; gap: .2em; align-items: baseline; }
.target .tl .lo { font-size: .85em; }
.target .te { font-size: 2.6rem; }

.search-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: min(100%, 420px); }
.cell {
  aspect-ratio: 1; border-radius: 22px; background: var(--card); box-shadow: var(--shadow);
  font-family: var(--font-letter); font-size: clamp(2.6rem, 13vw, 3.6rem); color: var(--ink);
}
.cell.found { background: var(--c); color: #fff; transform: scale(.94); }

/* Silben */
.syl-word { display: flex; justify-content: center; flex-wrap: wrap; font-family: var(--font-letter); line-height: 1.1; }
.syl { position: relative; padding: 0 .04em .18em; font-family: var(--font-letter); }
.syl.s0 { color: var(--syl0); }
.syl.s1 { color: var(--syl1); }
.syl::after { /* Silbenbogen */
  content: ''; position: absolute; left: 8%; right: 8%; bottom: 0; height: .22em;
  border: .05em solid currentColor; border-top: 0; border-radius: 0 0 999px 999px; opacity: .55;
}
.read-word { font-size: clamp(3.2rem, 15vw, 5.4rem); margin-top: 6px; }
.read-word.big { font-size: clamp(3.6rem, 17vw, 6.2rem); margin-top: 18px; }
.read-word button.syl { font-size: inherit; }
.syl-choice { font-size: clamp(2.6rem, 13vw, 3.6rem); }
.syl-choice .syl { padding-bottom: .2em; }
.mystery { perspective: 600px; }

.train { display: flex; align-items: flex-end; gap: 70px; margin-top: 18px; transition: gap .6s cubic-bezier(.5, 0, .3, 1.4); }
.train.joined { gap: 4px; }
.loco { font-size: 3.4rem; margin-right: -64px; transform: scaleX(-1); }
.train.joined .loco { margin-right: 0; }
.loco { transition: margin .6s; }
.wagon {
  position: relative; width: 104px; height: 104px; border-radius: 20px 20px 12px 12px;
  background: var(--c); color: #fff; font-family: var(--font-letter); font-size: 3.6rem; line-height: 1;
  box-shadow: 0 6px 0 rgba(0,0,0,.15); margin-bottom: 14px;
}
.wagon::before, .wagon::after { /* Räder */
  content: ''; position: absolute; bottom: -14px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); border: 5px solid #fff; box-sizing: border-box;
}
.wagon::before { left: 14px; }
.wagon::after { right: 14px; }
.syl-result { font-size: clamp(4rem, 20vw, 6rem); min-height: 1.3em; }

/* Nachspuren */
.strip { display: flex; gap: 8px; overflow-x: auto; width: 100%; padding: 4px 2px 10px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-width: 52px; height: 52px; padding: 0 10px; border-radius: 16px; background: var(--card);
  box-shadow: 0 3px 0 rgba(58,46,77,.1); font-family: var(--font-letter); font-size: 1.7rem; color: var(--c);
}
.chip.on { background: var(--c); color: #fff; }
.trace {
  position: relative; width: 100%; height: min(54vh, 92vw); background: var(--card);
  border-radius: 28px; box-shadow: var(--shadow); touch-action: none; overflow: hidden;
}
.trace canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.crayon { width: 44px; height: 44px; border-radius: 50%; background: var(--c); box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.crayon.on { outline: 4px solid var(--c); outline-offset: 3px; }

/* ---------- Elternbereich ---------- */

.parents { align-items: stretch; }
.panel { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: 0 3px 0 rgba(58,46,77,.06); font-weight: 600; }
.panel h2 { margin: 0 0 10px; font-size: 1.15rem; font-weight: 900; }
.panel p { margin: 8px 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field input[type="text"], .field select {
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: #FFFDF8; font-size: 1.1rem; color: var(--ink);
}
.field input[type="range"] { width: 100%; accent-color: var(--go); }
.seg { display: flex; gap: 10px; flex-wrap: wrap; }
.seg label, .check { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; background: #FFF9EF; border: 2px solid var(--line); }
.check { margin-top: 12px; width: max-content; max-width: 100%; }
input[type="radio"], input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--go); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lchip {
  position: relative; min-width: 50px; height: 46px; padding: 0 10px; border-radius: 14px;
  background: #F4EFE7; color: #B3A9BF; font-family: var(--font-letter); font-size: 1.3rem;
}
.lchip.on { background: var(--c); color: #fff; }
.lchip .dot { position: absolute; top: -4px; right: -4px; border: 2px solid #fff; }
.dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; vertical-align: middle; }
.dot.green { background: #2FAE66; }
.dot.yellow { background: #F7B731; }
.dot.red { background: #E8505B; }
.dot.grey { background: #C9C1D2; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 14px; background: #FFF9EF; }
.rec-l { font-family: var(--font-letter); font-size: 1.5rem; color: var(--c); min-width: 48px; text-align: center; }
.rec-info { flex: 1; min-width: 0; font-size: .95rem; }
.note { background: #FFF2D6; border-radius: 12px; padding: 10px 12px; }
.engines { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.engine {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 16px;
  background: #FFF9EF; border: 2px solid var(--line); cursor: pointer;
}
.engine.on { border-color: var(--go); background: #EEF9F2; }
.engine input { margin-top: 2px; flex: none; }
.engine span { display: flex; flex-direction: column; gap: 2px; }
.engine small { color: var(--muted); font-weight: 600; font-size: .88rem; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.row.left { justify-content: flex-start; align-items: center; margin-top: 10px; }
.tips ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 380px) {
  .wagon { width: 88px; height: 88px; font-size: 3rem; }
  .train { gap: 46px; }
  .nav { width: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
  .confetti { animation-duration: 1.2s !important; }
}
