:root {
  --pink: #ff4f9a; --pink-d: #e23a85; --pink-l: #ffd3e6; --pink-xl: #fff0f6;
  --lav: #a77bff; --lav-l: #efe6ff; --peach: #ffb38a; --mint: #22c58b; --mint-l: #dcf8ec;
  --coral: #ff5c6c; --coral-l: #ffe3e6; --gold: #ffbf3c; --sky: #59b8ff;
  --bg: #fff6fa; --card: #ffffff; --text: #3a2140; --muted: #8e7393; --line: #f3dbe7;
  --shadow: 0 6px 20px rgba(226, 58, 133, .12); --r: 20px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1424; --card: #2c1d33; --text: #fbeaf3; --muted: #c4a6c9; --line: #47304f;
    --pink-xl: #3a2240; --pink-l: #5a2c4f; --lav-l: #3a2d55; --mint-l: #1d4236; --coral-l: #4d2229;
    --shadow: 0 6px 20px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  background-image: radial-gradient(circle at 10% 0%, rgba(255, 79, 154, .10), transparent 40%), radial-gradient(circle at 100% 30%, rgba(167, 123, 255, .10), transparent 40%);
  background-attachment: fixed; font-size: 16px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--pink-d); }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.hidden { display: none !important; }

#app { max-width: 620px; margin: 0 auto; min-height: 100%; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 0 10px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 70%, transparent); }
.topbar .title { font-weight: 800; font-size: 1.15rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: .9rem; white-space: nowrap; }
.chip.flame { color: #ff7a2f; } .chip.xp { color: var(--lav); } .chip.off { color: var(--muted); }
.iconbtn { border: 0; background: var(--card); width: 40px; height: 40px; border-radius: 14px; box-shadow: var(--shadow); font-size: 1.15rem; cursor: pointer; display: grid; place-items: center; }

.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 0 0 14px; }
.card.tint { background: linear-gradient(135deg, var(--pink-xl), var(--lav-l)); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.section-title { font-weight: 800; color: var(--muted); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin: 18px 4px 8px; }

.btn {
  border: 0; border-radius: 16px; padding: 13px 18px; font-weight: 800; cursor: pointer; font-size: 1rem;
  background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-d); transition: transform .06s, box-shadow .06s, opacity .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-d); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--pink-d); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.lav { background: var(--lav); box-shadow: 0 4px 0 #8657e6; }
.btn.mint { background: var(--mint); box-shadow: 0 4px 0 #17a372; }
.btn.coral { background: var(--coral); box-shadow: 0 4px 0 #d9404f; }
.btn.small { padding: 8px 12px; font-size: .88rem; border-radius: 12px; }
.link { background: none; border: 0; color: var(--pink-d); font-weight: 700; cursor: pointer; padding: 6px; }

label.field { display: block; font-weight: 700; font-size: .9rem; margin: 10px 0 4px; }
.input, select.input, textarea.input {
  width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--pink); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--line); border-radius: 99px; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--pink); } .switch input:checked::after { left: 23px; }

/* Bottom-Navigation */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.nav-inner { display: flex; max-width: 620px; width: 100%; justify-content: space-around; }
.nav a { text-decoration: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 14px; }
.nav a .ic { font-size: 1.45rem; line-height: 1.2; filter: grayscale(.6); }
.nav a.active { color: var(--pink-d); background: var(--pink-xl); } .nav a.active .ic { filter: none; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 30px 0; }
.logo { font-size: 2.2rem; font-weight: 900; background: linear-gradient(90deg, var(--pink), var(--lav)); -webkit-background-clip: text; background-clip: text; color: transparent; text-align: center; }
.profiles { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 24px 0; }
.profile { border: 0; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 18px 16px 12px; width: 120px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 800; }
.profile .av { font-size: 2.6rem; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--pink-l), var(--lav-l)); }
.profile.sel { outline: 3px solid var(--pink); }
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; justify-content: center; margin: 14px 0; }
.pinpad button { height: 62px; border-radius: 20px; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 1.4rem; font-weight: 800; cursor: pointer; }
.pinpad button:active { background: var(--pink-l); }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 10px 0; min-height: 18px; }
.pindots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); } .pindots i.on { background: var(--pink); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pick button { font-size: 1.5rem; width: 46px; height: 46px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; }
.avatar-pick button.sel { border-color: var(--pink); background: var(--pink-xl); }

/* Haustier */
.pet-card { display: flex; gap: 12px; align-items: center; position: relative; overflow: hidden; }
.pet-stage { width: 120px; height: 120px; flex: none; position: relative; }
.pet-stage.big { width: 220px; height: 220px; margin: 0 auto; }
.pet-stage svg { width: 100%; height: 100%; overflow: visible; }
.pet-bob { animation: bob 3s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-4px) scale(1.02, .98); } }
.pet-blink { animation: blink 4.5s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.bubble { background: var(--card); border-radius: 16px; padding: 10px 12px; font-weight: 700; font-size: .92rem; position: relative; box-shadow: var(--shadow); }
.bar { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--lav)); border-radius: 99px; transition: width .6s; }
.bar.mint > i { background: linear-gradient(90deg, #4be0a7, var(--mint)); }
.sparkle { position: absolute; pointer-events: none; animation: twinkle 2.5s infinite; font-size: 14px; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.5); } 50% { opacity: 1; transform: scale(1); } }

/* Kurse */
.course { display: flex; gap: 12px; align-items: center; cursor: pointer; text-decoration: none; color: inherit; }
.course .em { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 1.8rem; flex: none; background: linear-gradient(135deg, var(--pink-l), var(--lav-l)); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; font-weight: 800; background: var(--pink-xl); color: var(--pink-d); }
.badge.lav { background: var(--lav-l); color: var(--lav); } .badge.mint { background: var(--mint-l); color: #129067; } .badge.coral { background: var(--coral-l); color: var(--coral); } .badge.gold { background: #fff3d6; color: #b07800; }
.empty { text-align: center; padding: 30px 16px; } .empty .big { font-size: 3rem; }

/* Lernpfad */
.unit-head { margin: 22px 0 6px; padding: 14px 16px; border-radius: var(--r); color: #fff; background: linear-gradient(135deg, var(--pink), var(--lav)); box-shadow: var(--shadow); }
.unit-head h2 { margin: 0; } .unit-head .small { opacity: .9; }
.path { display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 8px; }
.node { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 160px; text-align: center; cursor: pointer; background: none; border: 0; padding: 0; }
.node .dot { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; background: var(--card); border: 4px solid var(--line); box-shadow: 0 6px 0 var(--line); position: relative; transition: transform .1s; }
.node:active .dot { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.node.done .dot { background: linear-gradient(135deg, var(--pink), var(--lav)); border-color: #fff; box-shadow: 0 6px 0 var(--pink-d); color: #fff; }
.node.next .dot { border-color: var(--pink); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 0 var(--line), 0 0 0 0 rgba(255, 79, 154, .45); } 50% { box-shadow: 0 6px 0 var(--line), 0 0 0 12px rgba(255, 79, 154, 0); } }
.node .lbl { font-weight: 800; font-size: .88rem; line-height: 1.2; }
.node .stars { font-size: .8rem; letter-spacing: 1px; }
.node .ring { position: absolute; inset: -9px; }

/* Erklärseite & Grafiken */
.intro-summary { font-size: 1.04rem; }
.kw { display: grid; gap: 8px; }
.kw div { background: var(--pink-xl); border-radius: 14px; padding: 9px 12px; }
.kw b { color: var(--pink-d); }
.diagram { margin-top: 6px; }
.dg-title { font-weight: 800; text-align: center; margin-bottom: 10px; }
.mm-center { margin: 0 auto 14px; width: fit-content; max-width: 90%; padding: 12px 20px; border-radius: 999px; background: linear-gradient(135deg, var(--pink), var(--lav)); color: #fff; font-weight: 900; text-align: center; position: relative; }
.mm-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; position: relative; }
.mm-branch { border-radius: 16px; padding: 10px; background: var(--card); border: 2px solid var(--c, var(--pink-l)); position: relative; }
.mm-branch::before { content: ""; position: absolute; top: -12px; left: 50%; width: 2px; height: 10px; background: var(--c, var(--pink-l)); }
.mm-branch .bl { font-weight: 800; color: var(--c2, var(--pink-d)); margin-bottom: 4px; }
.mm-branch .ch { display: flex; flex-wrap: wrap; gap: 4px; }
.mm-branch .ch span { font-size: .8rem; padding: 2px 8px; border-radius: 99px; background: var(--pink-xl); }
.flow { display: flex; flex-direction: column; gap: 0; }
.flow .st { display: flex; gap: 12px; align-items: stretch; }
.flow .num { width: 34px; flex: none; display: flex; flex-direction: column; align-items: center; }
.flow .num b { width: 34px; height: 34px; border-radius: 50%; background: var(--pink); color: #fff; display: grid; place-items: center; font-weight: 900; }
.flow .num i { flex: 1; width: 3px; background: var(--pink-l); margin: 2px 0; min-height: 10px; }
.flow .tx { padding: 5px 0 12px; } .flow .tx b { display: block; }
.timeline .num b { width: 16px; height: 16px; margin-top: 4px; background: var(--lav); border: 3px solid var(--lav-l); }
.cmp { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; overflow: hidden; border-radius: 14px; }
.cmp th { background: linear-gradient(135deg, var(--pink), var(--lav)); color: #fff; padding: 8px; text-align: left; }
.cmp td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp tr td:first-child { font-weight: 800; }
.cmp tr:nth-child(even) td { background: var(--pink-xl); }
.table-wrap { overflow-x: auto; }

/* Lern-Session */
.session { position: fixed; inset: 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column; }
.session-top { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; max-width: 620px; width: 100%; margin: 0 auto; }
.session-top .bar { flex: 1; height: 16px; }
.session-body { flex: 1; overflow-y: auto; padding: 8px 16px 20px; max-width: 620px; width: 100%; margin: 0 auto; }
.session-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); background: var(--card); }
.session-foot .inner { max-width: 620px; margin: 0 auto; }
.session-foot.ok { background: var(--mint-l); border-color: transparent; }
.session-foot.bad { background: var(--coral-l); border-color: transparent; }
.session-foot.part { background: #fff3d6; border-color: transparent; }
@media (prefers-color-scheme: dark) { .session-foot.part { background: #4a3a1b; } }
.fb-title { font-weight: 900; font-size: 1.15rem; margin-bottom: 4px; }
.ok .fb-title { color: #109065; } .bad .fb-title { color: var(--coral); } .part .fb-title { color: #b07800; }
.fb-body { margin-bottom: 10px; max-height: 38vh; overflow-y: auto; }
.ex-kind { font-weight: 800; color: var(--lav); font-size: .85rem; margin: 6px 0; display: flex; gap: 6px; align-items: center; }
.ex-prompt { font-size: 1.3rem; font-weight: 800; margin: 4px 0 16px; }
.ex-prompt .big { font-size: 1.7rem; display: block; color: var(--pink-d); }
.ex-sub { color: var(--muted); font-weight: 700; margin-top: -8px; margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.opt { text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px; cursor: pointer; font-weight: 700; box-shadow: 0 3px 0 var(--line); display: flex; gap: 10px; align-items: center; }
.opt .k { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .78rem; color: var(--muted); flex: none; }
.opt.sel { border-color: var(--pink); background: var(--pink-xl); box-shadow: 0 3px 0 var(--pink-l); }
.opt.right { border-color: var(--mint); background: var(--mint-l); } .opt.wrong { border-color: var(--coral); background: var(--coral-l); }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf .opt { justify-content: center; font-size: 1.1rem; padding: 22px 10px; }
.answer-input { font-size: 1.15rem; }
.cloze-text { font-size: 1.15rem; line-height: 2.3; }
.cloze-text input { border: 0; border-bottom: 3px solid var(--pink); background: var(--pink-xl); border-radius: 8px 8px 0 0; padding: 2px 8px; min-width: 70px; outline: none; font-weight: 700; text-align: center; }
.cloze-text input.right { border-color: var(--mint); background: var(--mint-l); } .cloze-text input.wrong { border-color: var(--coral); background: var(--coral-l); }
.tokens { display: flex; flex-wrap: wrap; gap: 8px; min-height: 54px; padding: 8px; border-radius: 16px; }
.tokens.target { border: 2px dashed var(--line); margin-bottom: 18px; background: var(--card); }
.tok { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 12px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.tok.used { visibility: hidden; }
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pairs .col { display: grid; gap: 10px; align-content: start; }
.pairs .opt { justify-content: center; text-align: center; min-height: 54px; font-size: .95rem; }
.pairs .opt.gone { opacity: .25; pointer-events: none; border-color: var(--mint); }
.wc { font-size: .8rem; color: var(--muted); text-align: right; margin-top: 4px; }
.kp-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.kp-list li { display: flex; gap: 8px; align-items: flex-start; }
.kp-list label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.kp-list input { width: 20px; height: 20px; accent-color: var(--pink); flex: none; margin-top: 1px; }
.sample { background: var(--card); border-radius: 12px; padding: 10px; font-size: .92rem; border-left: 4px solid var(--lav); margin-top: 6px; }
.round-banner { text-align: center; padding: 30px 10px; }
.round-banner .big { font-size: 3rem; }
.override { margin-top: 6px; }
.hint-btn { margin-top: 10px; }

/* Ergebnis */
.result { text-align: center; padding: 20px 0; }
.result .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.stat { background: var(--card); border-radius: 18px; padding: 12px 6px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.4rem; } .stat span { font-size: .78rem; color: var(--muted); font-weight: 700; }
.confetti { position: fixed; top: -20px; pointer-events: none; z-index: 50; animation: fall linear forwards; font-size: 22px; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* Diagramm XP */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 10px; }
.chart div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.chart i { width: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(var(--pink), var(--lav)); min-height: 3px; }
.chart i.zero { background: var(--line); }
.chart span { font-size: .62rem; color: var(--muted); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grade-pill { min-width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem; color: #fff; padding: 0 6px; }
.dropzone { border: 3px dashed var(--pink-l); border-radius: var(--r); padding: 26px 14px; text-align: center; cursor: pointer; background: var(--pink-xl); transition: background .2s; }
.dropzone.over { background: var(--pink-l); }
.filelist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.filelist li { display: flex; gap: 8px; align-items: center; background: var(--card); padding: 8px 10px; border-radius: 12px; font-size: .9rem; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 700; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); animation: pop .25s; }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }
.spinner { width: 18px; height: 18px; border: 3px solid var(--pink-l); border-top-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-bg { position: fixed; inset: 0; background: rgba(40, 10, 40, .4); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg); width: 100%; max-width: 620px; border-radius: 26px 26px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; animation: up .25s; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.species { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.species svg { width: 100%; height: 100%; display: block; }
.species button { border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 4px; cursor: pointer; aspect-ratio: 1; }
.species button.sel { border-color: var(--pink); background: var(--pink-xl); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.swatches button.sel { box-shadow: 0 0 0 3px var(--pink); }
kbd { font-family: inherit; font-size: .75rem; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line); }
