/* Lernkoffer – bunt & verspielt, aber gut lesbar */
@font-face { font-family: "Andika"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/andika-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Andika"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/andika-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/fredoka-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/fredoka-latin-700-normal.woff2") format("woff2"); }

:root {
  --sky: #DFF3FF;
  --sky2: #C9EBFF;
  --card: #FFFFFF;
  --ink: #23324A;
  --muted: #5D6B82;
  --line: #D5E3F0;
  --coral: #FF6B6B;
  --sun: #FFC93C;
  --teal: #19B5A5;
  --grape: #7B61FF;
  --leaf: #3BB273;
  --leaf-bg: #E3F8EC;
  --hint-bg: #FFF3CC;
  --s0: #1E6FD9;
  --s1: #E0413C;
  --radius: 26px;
  --fs: 22px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--sky); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Andika", "Trebuchet MS", Verdana, sans-serif;
  font-size: var(--fs);
  line-height: 1.45;
  letter-spacing: .03em;
  word-spacing: .12em;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(circle at 12% 18%, #fff 0 46px, transparent 47px),
    radial-gradient(circle at 18% 16%, #fff 0 34px, transparent 35px),
    radial-gradient(circle at 86% 9%, #fff 0 40px, transparent 41px),
    radial-gradient(circle at 91% 11%, #fff 0 28px, transparent 29px),
    linear-gradient(var(--sky), var(--sky2));
  background-attachment: fixed;
}
body.big { --fs: 26px; }
h1, h2, .num, .tile b, .chip b, .next, .opt, .q, .pad button, .word { font-family: "Fredoka", "Andika", "Trebuchet MS", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; letter-spacing: inherit; }
button:focus-visible { outline: 5px solid var(--sun); outline-offset: 3px; }

/* Kopfzeile */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); background: var(--grape); color: #fff; box-shadow: 0 5px 0 #5A43D6; }
.bar h1 { flex: 1; margin: 0; font-size: 1.15em; font-weight: 600; text-align: center; letter-spacing: .04em; }
.icon-btn { width: 58px; height: 58px; border-radius: 18px; font-size: 28px; background: rgba(255,255,255,.18); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); }
.icon-btn:active { transform: translateY(2px); }

main { max-width: 900px; margin: 0 auto; padding: 24px calc(16px + env(safe-area-inset-right)) calc(70px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); outline: none; }
html, body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
h2 { font-size: 1.25em; font-weight: 600; margin: .3em 0 .6em; }
.muted { color: var(--muted); font-size: .8em; }

/* Maskottchen */
.hello { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; }
.hello .mascot { width: 130px; flex: none; }
.bubble { position: relative; background: #fff; border-radius: 24px; padding: 16px 20px; font-size: 1.05em; box-shadow: 0 5px 0 var(--line); flex: 1; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.bubble::before { content: ""; position: absolute; left: -16px; bottom: 26px; border: 10px solid transparent; border-right: 16px solid #fff; }
.bubble b { font-family: "Fredoka", sans-serif; font-weight: 600; }
.mascot { display: block; }
.mascot.bounce { animation: bounce .6s; }
@keyframes bounce { 30% { transform: translateY(-14px) rotate(-4deg); } 60% { transform: translateY(0) rotate(3deg); } }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.tile { border-radius: var(--radius); padding: 26px 20px; text-align: center; color: #fff; min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--c); box-shadow: 0 8px 0 var(--cd); transition: transform .08s; }
.tile .big { font-size: 70px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(0,0,0,.12)); }
.tile b { font-size: 1.5em; font-weight: 600; }
.tile span.sub { font-size: .8em; opacity: .95; }
.tile:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--cd); }
.grid-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.chip { background: #fff; border-radius: 22px; border: 4px solid var(--c, var(--line)); padding: 14px 10px 12px; text-align: center; min-height: 122px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 6px 0 var(--c); transition: transform .08s; }
.chip:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--c); }
.chip .num { font-size: 1.8em; font-weight: 700; color: var(--c); line-height: 1.1; }
.chip b { font-weight: 600; }
.stars { font-size: .85em; letter-spacing: 0; min-height: 1.2em; }
.teacher-link { display: block; margin: 40px auto 0; color: var(--muted); font-size: .7em; text-decoration: underline; }

/* Aufgabe */
.task { background: #fff; border-radius: var(--radius); border: 5px solid var(--c, var(--grape)); padding: 20px; box-shadow: 0 8px 0 rgba(35,50,74,.12); }
.progress { display: flex; gap: 6px; margin-bottom: 16px; }
.progress i { flex: 1; height: 14px; border-radius: 7px; background: #EEF3F8; }
.progress i.done { background: var(--c, var(--leaf)); }
.progress i.now { background: var(--sun); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.q { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 2.3em; font-weight: 600; margin: 10px 0; flex-wrap: wrap; }
.say { width: 58px; height: 58px; border-radius: 50%; background: var(--sun); font-size: 26px; flex: none; box-shadow: 0 4px 0 #E0A800; }
.say:active { transform: translateY(3px); box-shadow: 0 1px 0 #E0A800; }
.answer-box { display: inline-block; min-width: 2.4em; padding: 0 .2em; border-radius: 14px; background: #F2F7FC; border: 4px dashed var(--c, var(--grape)); text-align: center; min-height: 1.3em; line-height: 1.2; }

.dots { display: grid; grid-template-rows: repeat(5, auto); grid-auto-flow: column; justify-content: center; gap: 6px 22px; margin: 8px 0 12px; }
.grp { display: flex; gap: 6px; padding: 5px 9px; border: 3px solid #E6EEF6; border-radius: 999px; background: #FAFCFF; }
.grp i { width: 18px; height: 18px; border-radius: 50%; background: var(--c); display: block; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.grp i:nth-child(5) { margin-right: 8px; }
.numline { width: 100%; height: auto; margin: 6px 0; }

.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.pad button { height: 72px; border-radius: 20px; background: #F2F7FC; font-size: 1.5em; font-weight: 600; box-shadow: 0 5px 0 var(--line); }
.pad button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.pad button.ok { background: var(--leaf); color: #fff; box-shadow: 0 5px 0 #2A8F59; grid-column: span 2; white-space: nowrap; font-size: 1.2em; }
.pad button.del { font-size: 1.1em; }
.tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 6px 0; }
.tool { padding: 10px 18px; border-radius: 999px; background: #F2F7FC; border: 3px solid var(--line); font-size: .8em; font-weight: 700; }
.tool[aria-pressed="true"] { background: var(--hint-bg); border-color: var(--sun); }

.feedback { margin-top: 14px; padding: 12px 16px; border-radius: 20px; font-size: .95em; display: flex; align-items: center; gap: 12px; }
.feedback .mascot { width: 64px; flex: none; }
.feedback.good { background: var(--leaf-bg); }
.feedback.hint { background: var(--hint-bg); }
.feedback:empty { display: none; }
.next { display: block; margin: 16px auto 0; padding: 16px 40px; border-radius: 999px; background: var(--c, var(--grape)); color: #fff; font-weight: 600; font-size: 1.15em; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.next:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }

/* Deutsch */
.pic { font-size: 90px; text-align: center; line-height: 1.1; filter: drop-shadow(0 5px 0 rgba(0,0,0,.08)); }
.word { font-size: 2.2em; font-weight: 600; text-align: center; letter-spacing: .08em; margin: 6px 0 4px; }
.gap { display: inline-block; min-width: 1.6em; border-radius: 10px; background: #F2F7FC; border: 4px dashed var(--c); }
.mark { text-decoration: underline; text-decoration-thickness: 6px; text-underline-offset: 7px; text-decoration-color: var(--sun); }
.opts { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.opt { min-width: 112px; height: 88px; padding: 0 22px; border-radius: 24px; background: #fff; border: 4px solid var(--c); color: var(--c); font-size: 1.7em; font-weight: 600; box-shadow: 0 6px 0 var(--c); }
.opt:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--c); }
.opt.right { background: var(--leaf); border-color: var(--leaf); color: #fff; box-shadow: 0 6px 0 #2A8F59; }
.opt.wiggle { animation: wiggle .4s; }
@keyframes wiggle { 25% { transform: translateX(-7px) rotate(-3deg); } 75% { transform: translateX(7px) rotate(3deg); } }
.rule { background: var(--hint-bg); border-radius: 20px; padding: 12px 16px; font-size: .85em; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; }
.rule .say { width: 46px; height: 46px; font-size: 22px; }

body.silben .s0 { color: var(--s0); }
body.silben .s1 { color: var(--s1); }

/* Konfetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: fall 1.3s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .confetti, .mascot.bounce, .progress i.now { animation: none !important; display: none; } }

/* Ende */
.done { text-align: center; }
.done .mascot { width: 160px; margin: 0 auto; }

/* Einstellungen & Lehrkraft */
.panel { background: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: 0 6px 0 var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 2px solid #EEF3F8; }
.row:last-child { border-bottom: 0; }
.switch { width: 78px; height: 44px; border-radius: 999px; background: #CBD6E2; position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 36px; height: 36px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 2px 3px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--leaf); }
.switch[aria-checked="true"]::after { left: 38px; }
table.stat { width: 100%; border-collapse: collapse; font-size: .7em; }
table.stat th, table.stat td { text-align: left; padding: 8px; border-bottom: 2px solid #EEF3F8; vertical-align: top; }
.bar-mini { height: 12px; border-radius: 6px; background: #EEF3F8; overflow: hidden; min-width: 80px; }
.bar-mini span { display: block; height: 100%; background: var(--leaf); }
.btn { padding: 12px 20px; border-radius: 16px; background: #fff; font-size: .8em; font-weight: 700; box-shadow: 0 4px 0 var(--line); }
.btn.danger { color: #C0392B; }

@media (max-width: 520px) {
  :root { --fs: 19px; }
  .pad button { height: 60px; }
  .opt { min-width: 86px; height: 74px; }
  .pic { font-size: 70px; }
  .hello .mascot { width: 96px; }
  .tile { min-height: 150px; }
}
@media print {
  .bar, .no-print { display: none !important; }
  html, body { background: #fff; font-size: 12pt; }
  .panel { box-shadow: none; padding: 0; }
}

a.btn, a.icon-btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }

/* ---------- Stufen, Schwierigkeit, neue Aufgaben ---------- */
.stabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 18px; }
.stab { padding: 10px 18px; border-radius: 999px; background: #fff; font-weight: 700; font-size: .85em; box-shadow: 0 4px 0 var(--line); }
.stab.on { background: var(--grape); color: #fff; box-shadow: 0 4px 0 #5A43D6; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-top: 10px; }
.level { background: #fff; border-radius: var(--radius); border: 4px solid var(--c); box-shadow: 0 7px 0 var(--c); padding: 22px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: "Fredoka", sans-serif; font-size: 1.2em; }
.level .lic { font-size: 54px; line-height: 1; }
.level:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--c); }
.frage { text-align: center; margin: 0 0 4px; font-size: 1.05em; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.q-text { font-size: 1.1em; font-weight: 600; text-align: center; line-height: 1.5; display: block; }
.cmpbox { display: inline-block; min-width: 1.4em; border-radius: 12px; border: 4px dashed var(--c); color: var(--c); text-align: center; }
.note-sm { text-align: center; color: var(--muted); font-size: .85em; margin: 0; }
.riddle { display: block; font-size: .62em; line-height: 1.6; letter-spacing: .04em; font-weight: 600; }
.hidden-word { color: #C9D6E3; letter-spacing: .3em; }
.opt.emoji { font-size: 2.6em; min-width: 120px; height: 110px; font-family: inherit; }
.opt.words { font-size: 1.15em; min-width: 150px; }
#visual { display: flex; justify-content: center; margin: 6px 0; }
#visual:empty { display: none; }
.clock { max-width: 70vw; height: auto; }
/* Zwanzigerfeld */
.field { display: inline-flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: #FAFCFF; border: 3px solid #E6EEF6; border-radius: 16px; }
.frow { display: flex; gap: 6px; }
.frow i { width: 22px; height: 22px; border-radius: 50%; display: block; border: 2px solid #D5E3F0; }
.frow i:nth-child(5) { margin-right: 10px; }
.frow i.a { background: var(--coral); border-color: var(--coral); }
.frow i.b { background: var(--s0); border-color: var(--s0); }
.frow i.x { background: #fff; border-color: var(--coral); position: relative; }
.frow i.x::after { content: ""; position: absolute; left: -3px; right: -3px; top: 8px; height: 3px; background: #23324A; transform: rotate(-45deg); }
/* Hunderter, Zehner, Einer */
.blocks { display: flex; align-items: flex-end; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
.blocks .hun { width: 62px; height: 62px; border-radius: 4px; background: repeating-linear-gradient(0deg, #1E6FD9 0 5.2px, #6FA8F0 5.2px 6.2px), #1E6FD9; background-blend-mode: normal; box-shadow: inset 0 0 0 2px #1452A6; }
.blocks .ten { width: 9px; height: 62px; border-radius: 3px; background: repeating-linear-gradient(0deg, #E0413C 0 5.2px, #F59A97 5.2px 6.2px); }
.blocks .ones { display: inline-flex; flex-wrap: wrap; width: 40px; gap: 4px; align-content: flex-end; }
.blocks .ones i { width: 10px; height: 10px; border-radius: 50%; background: #19B5A5; display: block; }
/* Stellenwerttafel */
table.stw { border-collapse: collapse; font-family: "Fredoka", sans-serif; }
table.stw th, table.stw td { border: 3px solid #D5E3F0; width: 54px; text-align: center; padding: 6px 0; }
table.stw th { background: #F2F7FC; font-size: .75em; color: var(--muted); }
table.stw td { font-size: 1.6em; font-weight: 600; height: 52px; }
/* Geld (selbst gezeichnet) */
.money { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; max-width: 100%; }
.coin { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-family: "Fredoka", sans-serif; font-weight: 700; font-size: .55em; color: #3B2A10; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.c1, .c2, .c5 { background: #D08A5B; width: 38px; height: 38px; } .c5 { width: 44px; height: 44px; }
.c10, .c20, .c50 { background: #E9C46A; width: 46px; height: 46px; } .c50 { width: 54px; height: 54px; }
.c100, .c200 { background: radial-gradient(circle, #E9C46A 0 52%, #C9D1D9 53%); width: 56px; height: 56px; } .c200 { width: 62px; height: 62px; }
.note { display: inline-flex; align-items: center; justify-content: center; width: 96px; height: 52px; border-radius: 8px; font-family: "Fredoka", sans-serif; font-weight: 700; color: #23324A; box-shadow: inset 0 0 0 3px rgba(255,255,255,.6), 0 3px 0 rgba(0,0,0,.12); }
.n500 { background: #C9CFD6; } .n1000 { background: #F2A7A1; } .n2000 { background: #A9C8F2; }
/* Sätze bauen */
.built { min-height: 64px; border: 4px dashed var(--c); border-radius: 18px; padding: 12px 16px; font-size: 1.25em; font-weight: 600; text-align: center; margin: 10px 0; background: #FAFCFF; }
.wtiles { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 10px; }
.wtile { padding: 12px 18px; border-radius: 16px; background: #fff; border: 3px solid var(--c); box-shadow: 0 5px 0 var(--c); font-size: 1.15em; font-weight: 700; }
.wtile:disabled { opacity: .25; box-shadow: none; }
.q-ask { flex-direction: column; gap: 10px; }
.q-ask .q-text { font-size: .5em; }
.blocks .hun { width: 84px; height: 84px; background: repeating-linear-gradient(0deg, #1E6FD9 0 7.4px, #6FA8F0 7.4px 8.4px); }
.blocks .ten { width: 13px; height: 84px; background: repeating-linear-gradient(0deg, #E0413C 0 7.4px, #F59A97 7.4px 8.4px); }
.blocks .ones { width: 52px; gap: 5px; }
.blocks .ones i { width: 14px; height: 14px; }
.coin { font-size: .72em; }
.c1, .c2 { width: 46px; height: 46px; } .c5 { width: 52px; height: 52px; }
.c10, .c20 { width: 56px; height: 56px; } .c50 { width: 64px; height: 64px; }
.c100 { width: 68px; height: 68px; } .c200 { width: 74px; height: 74px; }
.note { width: 120px; height: 64px; font-size: 1em; }
#visual > * { max-width: 100%; }
.blocks { flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.bgroup { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end; max-width: 100%; }
@media (max-width: 600px) { .blocks .hun { width: 56px; height: 56px; background: repeating-linear-gradient(0deg, #1E6FD9 0 4.6px, #6FA8F0 4.6px 5.6px); } .blocks .ten { height: 56px; width: 10px; background: repeating-linear-gradient(0deg, #E0413C 0 4.6px, #F59A97 4.6px 5.6px); } }
